Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove geocoderLookupFn expect because doesn't happen anymore #1155

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading