Skip to content

Commit bc29804

Browse files
authored
updates tests for new category routes (#101)
1 parent 3d5c389 commit bc29804

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

scripts/fetch-service-categories.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const createKey = (name) =>
1818
name.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9\-]/g, '');
1919

2020
const formatCategory = (doc) => ({
21-
key: createKey(doc.Name || doc.name),
21+
key: doc._id || doc.Key || doc.key,
2222
name: doc.Name || doc.name,
2323
subCategories: (doc.SubCategories || []).map((sc) => ({
2424
key: sc.Key || sc.key,

src/data/service-categories.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
]
2323
},
2424
{
25-
"key": "food",
25+
"key": "foodbank",
2626
"name": "Food",
2727
"subCategories": [
2828
{
@@ -60,7 +60,7 @@
6060
]
6161
},
6262
{
63-
"key": "health-services",
63+
"key": "medical",
6464
"name": "Health Services",
6565
"subCategories": [
6666
{
@@ -158,7 +158,7 @@
158158
]
159159
},
160160
{
161-
"key": "accommodation",
161+
"key": "accom",
162162
"name": "Accommodation",
163163
"subCategories": [
164164
{
@@ -200,7 +200,7 @@
200200
]
201201
},
202202
{
203-
"key": "personal-services",
203+
"key": "services",
204204
"name": "Personal Services",
205205
"subCategories": [
206206
{
@@ -256,7 +256,7 @@
256256
]
257257
},
258258
{
259-
"key": "financial-help",
259+
"key": "financial",
260260
"name": "Financial Help",
261261
"subCategories": [
262262
{
@@ -282,7 +282,7 @@
282282
]
283283
},
284284
{
285-
"key": "personal-items",
285+
"key": "items",
286286
"name": "Personal Items",
287287
"subCategories": [
288288
{
@@ -506,7 +506,7 @@
506506
]
507507
},
508508
{
509-
"key": "drop-in",
509+
"key": "dropin",
510510
"name": "Drop-In",
511511
"subCategories": [
512512
{
@@ -534,7 +534,7 @@
534534
]
535535
},
536536
{
537-
"key": "advice-services",
537+
"key": "support",
538538
"name": "Advice Services",
539539
"subCategories": [
540540
{

tests/__tests__/components/FilterPanel.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ describe('FilterPanel', () => {
2828
const categorySelect = screen.getByLabelText('Category:');
2929

3030
// ✅ Use the correct key now
31-
fireEvent.change(categorySelect, { target: { value: 'food' } });
31+
fireEvent.change(categorySelect, { target: { value: 'foodbank' } });
3232

33-
await waitFor(() => expect(setCategory).toHaveBeenCalledWith('food'));
33+
await waitFor(() => expect(setCategory).toHaveBeenCalledWith('foodbank'));
3434

3535
rerender(
3636
<FilterPanel
37-
selectedCategory="food"
37+
selectedCategory="foodbank"
3838
selectedSubCategory=""
3939
setSelectedCategory={setCategory}
4040
setSelectedSubCategory={setSub}

tests/e2e/find-help.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ test.describe('Find Help Page', () => {
2626

2727
// ✅ Use real generated keys:
2828
await expect(page.locator('#category')).toBeVisible();
29-
await page.locator('#category').selectOption('health-services');
29+
await page.locator('#category').selectOption('medical');
3030

3131
await expect(page.locator('#subCategory')).toBeVisible();
3232
// Example: pick a real subcategory under Health Services:

0 commit comments

Comments
 (0)