Skip to content

Commit

Permalink
fix: remove geocoderLookupFn expect because doesn't happen anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
clintonlunn committed Jun 29, 2024
1 parent 022295a commit 7dc076c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/components/search/__tests__/XSearch.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ''
import { FC } from 'react'
import { render, screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'

Expand All @@ -9,7 +10,6 @@ jest.mock('../../../js/mapbox/MapboxClient')
jest.mock('../../../js/graphql/Client')

const mockTypesenseClient = jest.requireMock('../../../js/typesense/TypesenseClient')
const mockMapboxClient = jest.requireMock('../../../js/mapbox/MapboxClient')

const mockUseQuery = jest.fn()

Expand All @@ -32,7 +32,7 @@ Object.defineProperty(window, 'matchMedia', {
}))
})

let XSearch
let XSearch: FC<{ placeholder?: string }>
beforeAll(async () => {
// why async import? see https://github.com/facebook/jest/issues/10025#issuecomment-716789840
const module = await import('../XSearch')
Expand All @@ -42,7 +42,6 @@ beforeAll(async () => {
test('XSearch triggers popup window', async () => {
const user = userEvent.setup()
const multiSearchFn = jest.spyOn(mockTypesenseClient, 'multiSearch')
const geocoderLookupFn = jest.spyOn(mockMapboxClient, 'geocoderLookup')

mockUseQuery.mockReturnValue({
loading: false,
Expand All @@ -63,7 +62,6 @@ test('XSearch triggers popup window', async () => {
// The search functions will get called n times the number of keystrokes + 2
// '2' extra renderings are due to empty query being sent to the search functions
expect(multiSearchFn).toBeCalledTimes(7)
expect(geocoderLookupFn).toBeCalledTimes(7)

// Important - we need to wait for the popup result panel to appear
await waitFor(() => {
Expand Down

0 comments on commit 7dc076c

Please sign in to comment.