From 38f8caef320f2eeb87526502ac299afa36107e15 Mon Sep 17 00:00:00 2001 From: devinleighsmith Date: Wed, 11 Oct 2023 12:48:22 -0700 Subject: [PATCH] test corrections. --- .../features/properties/filter/PropertyFilter.test.tsx | 10 +++++++++- .../features/properties/list/PropertyListView.test.tsx | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/source/frontend/src/features/properties/filter/PropertyFilter.test.tsx b/source/frontend/src/features/properties/filter/PropertyFilter.test.tsx index a7af23c1fa..605d2cfc01 100644 --- a/source/frontend/src/features/properties/filter/PropertyFilter.test.tsx +++ b/source/frontend/src/features/properties/filter/PropertyFilter.test.tsx @@ -1,10 +1,12 @@ import { useKeycloak } from '@react-keycloak/web'; -import axios from 'axios'; +import axios, { AxiosResponse } from 'axios'; import { createMemoryHistory } from 'history'; import configureMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; import * as API from '@/constants/API'; +import { useApiGeocoder } from '@/hooks/pims-api/useApiGeocoder'; +import { IPagedItems, IProperty } from '@/interfaces'; import filterSlice from '@/store/slices/filter/filterSlice'; import { ILookupCode, lookupCodesSlice } from '@/store/slices/lookupCodes'; import { act, cleanup, fireEvent, render, waitFor } from '@/utils/test-utils'; @@ -18,6 +20,12 @@ const onFilterChange = jest.fn(); //prevent web calls from being made during tests. jest.mock('axios'); jest.mock('@react-keycloak/web'); +jest.mock('@/hooks/pims-api/useApiGeocoder'); + +const mockApiGetSitePidsApi = jest.fn>>, any>(); +(useApiGeocoder as unknown as jest.Mock>).mockReturnValue({ + getSitePidsApi: mockApiGetSitePidsApi, +}); const mockedAxios = axios as jest.Mocked; const mockKeycloak = (claims: string[]) => { diff --git a/source/frontend/src/features/properties/list/PropertyListView.test.tsx b/source/frontend/src/features/properties/list/PropertyListView.test.tsx index 06296bef4b..b3e70c36ff 100644 --- a/source/frontend/src/features/properties/list/PropertyListView.test.tsx +++ b/source/frontend/src/features/properties/list/PropertyListView.test.tsx @@ -4,6 +4,7 @@ import { createMemoryHistory } from 'history'; import * as API from '@/constants/API'; import Claims from '@/constants/claims'; +import { useApiGeocoder } from '@/hooks/pims-api/useApiGeocoder'; import { useApiProperties } from '@/hooks/pims-api/useApiProperties'; import { IPagedItems, IProperty } from '@/interfaces'; import { mockParcel } from '@/mocks/filterData.mock'; @@ -23,6 +24,11 @@ const mockApiGetPropertiesPagedApi = jest.fn>>, any>(); +(useApiGeocoder as unknown as jest.Mock>).mockReturnValue({ + getSitePidsApi: mockApiGetSitePidsApi, +}); + const mockAxios = new MockAdapter(axios); const history = createMemoryHistory();