diff --git a/src/entities/Font/model/store/unifiedFontStore/unifiedFontStore.test.ts b/src/entities/Font/model/store/unifiedFontStore/unifiedFontStore.test.ts index 38c8a4d..cf19a6c 100644 --- a/src/entities/Font/model/store/unifiedFontStore/unifiedFontStore.test.ts +++ b/src/entities/Font/model/store/unifiedFontStore/unifiedFontStore.test.ts @@ -280,3 +280,54 @@ describe('pagination navigation', () => { expect(store.params.limit).toBe(25); }); }); + +describe('filter setters', () => { + let store: UnifiedFontStore; + + beforeEach(() => { + store = new UnifiedFontStore({ limit: 10 }); + }); + + afterEach(() => { + store.destroy(); + queryClient.clear(); + vi.resetAllMocks(); + }); + + it('setProviders() updates the providers param', () => { + store.setProviders(['google']); + + expect(store.params.providers).toEqual(['google']); + }); + + it('setCategories() updates the categories param', () => { + store.setCategories(['serif']); + + expect(store.params.categories).toEqual(['serif']); + }); + + it('setSubsets() updates the subsets param', () => { + store.setSubsets(['cyrillic']); + + expect(store.params.subsets).toEqual(['cyrillic']); + }); + + it('setSearch() sets the q param', () => { + store.setSearch('roboto'); + + expect(store.params.q).toBe('roboto'); + }); + + it('setSearch() with empty string sets q to undefined', () => { + store.setSearch('roboto'); + store.setSearch(''); + + expect(store.params.q).toBeUndefined(); + }); + + it('setSort() updates the sort param', () => { + store.setSort('popularity'); + + expect(store.params.sort).toBe('popularity'); + }); +});