diff --git a/plugins/search/src/components/SearchModal/SearchModal.test.tsx b/plugins/search/src/components/SearchModal/SearchModal.test.tsx index d3209f9a9b..b59be710de 100644 --- a/plugins/search/src/components/SearchModal/SearchModal.test.tsx +++ b/plugins/search/src/components/SearchModal/SearchModal.test.tsx @@ -24,16 +24,10 @@ import { rootRouteRef } from '../../plugin'; import { searchApiRef } from '../../apis'; import { SearchModal } from './SearchModal'; - -jest.mock('../SearchContext', () => ({ - ...jest.requireActual('../SearchContext'), - useSearch: jest.fn().mockReturnValue({ - result: {}, - }), -})); +import { SearchContextProvider } from '../SearchContext'; describe('SearchModal', () => { - const query = jest.fn().mockResolvedValue({}); + const query = jest.fn().mockResolvedValue({ results: [] }); const apiRegistry = TestApiRegistry.from( [configApiRef, new ConfigReader({ app: { title: 'Mock app' } })], @@ -45,7 +39,9 @@ describe('SearchModal', () => { it('Should render the Modal correctly', async () => { await renderInTestApp( - + + + , { mountedRoutes: { @@ -60,7 +56,9 @@ describe('SearchModal', () => { it('Calls toggleModal handler', async () => { await renderInTestApp( - + + + , { mountedRoutes: {