Skip to content

Commit

Permalink
additional test
Browse files Browse the repository at this point in the history
  • Loading branch information
SKarolFolio committed Nov 18, 2024
1 parent 4be6e4f commit 0e4cdc6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/test/__tests__/common/hooks/useSearchFiltersData.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,17 @@ describe('useSearchFiltersData', () => {
});
expect(setFacetsData).toHaveBeenCalledWith('facetsData');
});

test('onToggleFilterGroupState - updates selectedFacetsGroups', () => {
const setSelectedFacetsGroups = jest.fn();
(useRecoilState as jest.Mock).mockReturnValue([['facet1'], setSelectedFacetsGroups]);

const { result } = renderHook(() => useSearchFiltersData());

act(() => {
const updatedGroups = result.current.onToggleFilterGroupState('facet2', true);
expect(updatedGroups).toEqual(['facet1', 'facet2']);
expect(setSelectedFacetsGroups).toHaveBeenCalledWith(['facet1', 'facet2']);
});
});
});

0 comments on commit 0e4cdc6

Please sign in to comment.