Skip to content

Commit

Permalink
feat: fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Rassl committed Oct 16, 2024
1 parent 5463402 commit 7fa0b15
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/components/App/SideBar/FilterSearch/__tests__/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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 })
Expand Down

0 comments on commit 7fa0b15

Please sign in to comment.