diff --git a/src/test/__tests__/common/hooks/useSearchFiltersData.test.ts b/src/test/__tests__/common/hooks/useSearchFiltersData.test.ts index 4c336f14..7fae0a0f 100644 --- a/src/test/__tests__/common/hooks/useSearchFiltersData.test.ts +++ b/src/test/__tests__/common/hooks/useSearchFiltersData.test.ts @@ -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']); + }); + }); });