Skip to content

Commit 2ca574d

Browse files
committed
test(SearchAutocompleteList): update mock to use useFilteredOptions hook
The component was refactored to use useFilteredOptions instead of OptionListContextProvider, so the test mock needs to be updated to match the implementation. This fixes the failing test.
1 parent 82c1fe3 commit 2ca574d

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

tests/ui/components/SearchAutocompleteListTest.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,20 @@ jest.mock('@hooks/useResponsiveLayout', () => ({
3434
})),
3535
}));
3636

37-
jest.mock('@components/OptionListContextProvider', () => {
38-
const ActualReact = jest.requireActual<typeof React>('react');
39-
return {
40-
useOptionsList: jest.fn(() => ({
41-
options: {},
42-
areOptionsInitialized: true,
43-
})),
44-
OptionsListStateContext: ActualReact.createContext({
45-
areOptionsInitialized: true,
46-
}),
47-
};
48-
});
37+
jest.mock('@hooks/useFilteredOptions', () => ({
38+
// eslint-disable-next-line @typescript-eslint/naming-convention
39+
__esModule: true,
40+
default: jest.fn(() => ({
41+
options: {
42+
reports: [],
43+
personalDetails: [],
44+
},
45+
isLoading: false,
46+
loadMore: jest.fn(),
47+
hasMore: false,
48+
isLoadingMore: false,
49+
})),
50+
}));
4951

5052
jest.mock('@libs/OptionsListUtils', () => ({
5153
getSearchOptions: jest.fn(() => ({

0 commit comments

Comments
 (0)