Skip to content

Commit

Permalink
fix: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
louisewang1 committed Jan 18, 2022
1 parent 9d707e6 commit 7bcecb4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cypress/support/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ export const mockGetItemCategories = (items, shouldThrowError) => {
method: DEFAULT_GET.method,
url: new RegExp(
`${API_HOST}/${parseStringToRegExp(
buildGetItemCategoriesRoute(items[0].id),
buildGetItemCategoriesRoute(items[0]?.id),
)}`,
),
},
Expand All @@ -1324,7 +1324,7 @@ export const mockGetItemCategories = (items, shouldThrowError) => {
return;
}
const itemId = url.slice(API_HOST.length).split('/')[2];
const result = items.find(({ id }) => id === itemId).categories || [];
const result = items.find(({ id }) => id === itemId)?.categories || [];
reply(result);
},
).as('getItemCategories');
Expand Down

0 comments on commit 7bcecb4

Please sign in to comment.