From 7fa0b152229e41e82dfe90d1fe81ffb6eb819db3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D0=B0=D1=81=D1=83=D0=BB?= Date: Wed, 16 Oct 2024 17:45:19 +0300 Subject: [PATCH] feat: fix unit tests --- .../App/SideBar/FilterSearch/__tests__/index.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/App/SideBar/FilterSearch/__tests__/index.tsx b/src/components/App/SideBar/FilterSearch/__tests__/index.tsx index cea9f97ec..31d3fdd3f 100644 --- a/src/components/App/SideBar/FilterSearch/__tests__/index.tsx +++ b/src/components/App/SideBar/FilterSearch/__tests__/index.tsx @@ -32,9 +32,15 @@ const mockSetAnchorEl = jest.fn() const mockFetchData = jest.fn() const mockSetAbortRequests = jest.fn() const mockOnClose = jest.fn() -const mockSchemaAll = [{ type: 'Type1' }, { type: 'Type2' }, { type: 'Type3' }] + +jest.mock('~/stores/useSchemaStore', () => ({ + useSchemaStore: jest.fn(), +})) describe('FilterSearch Component', () => { + const mockSetSchemas = jest.fn() + const mockSchemaAll = [{ type: 'Type1' }, { type: 'Type2' }, { type: 'Type3' }] + beforeEach(() => { jest.clearAllMocks() @@ -46,9 +52,10 @@ describe('FilterSearch Component', () => { }) // - ;(useSchemaStore as jest.Mock) - .mockReturnValue([mockSchemaAll, jest.fn()])(useFeatureFlagStore as jest.Mock) - .mockReturnValue({ fastFiltersFeatureFlag: true }) + ;(useSchemaStore as jest.Mock).mockReturnValue([mockSchemaAll, mockSetSchemas]) // Return an array + + // + ;(useFeatureFlagStore as jest.Mock).mockReturnValue({ fastFiltersFeatureFlag: true }) // ;(getSchemaAll as jest.Mock).mockResolvedValue({ schemas: mockSchemaAll })