diff --git a/frontend/__tests__/CookiesPage.test.tsx b/frontend/__tests__/CookiesPage.test.tsx index db2892e1b..183381fa9 100644 --- a/frontend/__tests__/CookiesPage.test.tsx +++ b/frontend/__tests__/CookiesPage.test.tsx @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: 2022 - 2023 Dusan Mijatovic (dv4all) // SPDX-FileCopyrightText: 2022 - 2023 dv4all -// SPDX-FileCopyrightText: 2023 Dusan Mijatovic (Netherlands eScience Center) -// SPDX-FileCopyrightText: 2023 Netherlands eScience Center +// SPDX-FileCopyrightText: 2023 - 2025 Dusan Mijatovic (Netherlands eScience Center) +// SPDX-FileCopyrightText: 2023 - 2025 Netherlands eScience Center // // SPDX-License-Identifier: Apache-2.0 @@ -13,6 +13,9 @@ import CookiesPage from '../pages/cookies' // use DEFAULT MOCK for login providers list // required when AppHeader component is used jest.mock('~/auth/api/useLoginProviders') +// MOCK global search +jest.mock('~/components/GlobalSearchAutocomplete/apiGlobalSearch') +jest.mock('~/components/GlobalSearchAutocomplete/useHasRemotes') it('renders cookies page with title Cookies', async() => { @@ -22,8 +25,8 @@ it('renders cookies page with title Cookies', async() => { } render(WrappedComponentWithProps( CookiesPage, { - props - })) + props + })) const heading = await screen.findByRole('heading',{ name: 'Cookies' }) @@ -39,8 +42,8 @@ it('renders cookies page with anonymous statistics checkbox ON', async() => { } render(WrappedComponentWithProps( CookiesPage, { - props - })) + props + })) const heading = await screen.findByRole('heading',{ name: 'Tracking cookies' @@ -61,8 +64,8 @@ it('renders cookies page with anonymous statistics checkbox OFF', async() => { } render(WrappedComponentWithProps( CookiesPage, { - props - })) + props + })) const checkbox = await screen.findByRole('checkbox', { checked:false diff --git a/frontend/__tests__/OrganisationPage.test.tsx b/frontend/__tests__/OrganisationPage.test.tsx index 29489e359..7df4ac521 100644 --- a/frontend/__tests__/OrganisationPage.test.tsx +++ b/frontend/__tests__/OrganisationPage.test.tsx @@ -18,16 +18,20 @@ import mockSoftware from '~/components/organisation/software/__mocks__/mockSoftw import mockProjects from '~/components/organisation/projects/__mocks__/mockProjects.json' import mockUnits from '~/components/organisation/units/__mocks__/mockUnits.json' import {TabKey} from '~/components/organisation/tabs/OrganisationTabItems' +import {OrganisationForContext} from '~/components/organisation/context/OrganisationContext' // MOCK user agreement call jest.mock('~/components/user/settings/useUserAgreements') +// global search +jest.mock('~/components/GlobalSearchAutocomplete/apiGlobalSearch') +jest.mock('~/components/GlobalSearchAutocomplete/useHasRemotes') // use DEFAULT MOCK for login providers list // required when AppHeader component is used jest.mock('~/auth/api/useLoginProviders') const mockProps = { - organisation: mockOrganisation, + organisation: mockOrganisation as OrganisationForContext, slug:['dutch-research-council'], tab: 'software' as TabKey, ror: mockRORIinfo as any, diff --git a/frontend/__tests__/ProjectEditPage.test.tsx b/frontend/__tests__/ProjectEditPage.test.tsx index 397d1553d..4f848d907 100644 --- a/frontend/__tests__/ProjectEditPage.test.tsx +++ b/frontend/__tests__/ProjectEditPage.test.tsx @@ -1,7 +1,7 @@ -// SPDX-FileCopyrightText: 2023 Dusan Mijatovic (Netherlands eScience Center) +// SPDX-FileCopyrightText: 2023 - 2025 Dusan Mijatovic (Netherlands eScience Center) +// SPDX-FileCopyrightText: 2023 - 2025 Netherlands eScience Center // SPDX-FileCopyrightText: 2023 Dusan Mijatovic (dv4all) // SPDX-FileCopyrightText: 2023 Dusan Mijatovic (dv4all) (dv4all) -// SPDX-FileCopyrightText: 2023 Netherlands eScience Center // SPDX-FileCopyrightText: 2023 dv4all // // SPDX-License-Identifier: Apache-2.0 @@ -22,6 +22,9 @@ import mockProjectToEdit from '~/components/projects/edit/information/__mocks__/ jest.mock('~/auth/api/useLoginProviders') // mock user agreement call jest.mock('~/components/user/settings/useUserAgreements') +// global search +jest.mock('~/components/GlobalSearchAutocomplete/apiGlobalSearch') +jest.mock('~/components/GlobalSearchAutocomplete/useHasRemotes') // MOCK isMaintainerOf const mockIsMaintainer = jest.fn(props => Promise.resolve(false)) @@ -44,7 +47,6 @@ window.IntersectionObserver = jest.fn(() => ({ unobserve: mockUnobserve, } as any)) - const mockProps = { // information page pageIndex: 0, diff --git a/frontend/__tests__/SoftwareEditPage.test.tsx b/frontend/__tests__/SoftwareEditPage.test.tsx index 74654820c..2101dbd71 100644 --- a/frontend/__tests__/SoftwareEditPage.test.tsx +++ b/frontend/__tests__/SoftwareEditPage.test.tsx @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: 2023 - 2024 Dusan Mijatovic (Netherlands eScience Center) -// SPDX-FileCopyrightText: 2023 - 2024 Netherlands eScience Center +// SPDX-FileCopyrightText: 2023 - 2025 Dusan Mijatovic (Netherlands eScience Center) +// SPDX-FileCopyrightText: 2023 - 2025 Netherlands eScience Center // SPDX-FileCopyrightText: 2023 Dusan Mijatovic (dv4all) // SPDX-FileCopyrightText: 2023 Dusan Mijatovic (dv4all) (dv4all) // SPDX-FileCopyrightText: 2023 dv4all @@ -24,6 +24,9 @@ import {RsdSettingsState} from '~/config/rsdSettingsReducer' jest.mock('~/auth/api/useLoginProviders') // mock user agreement call jest.mock('~/components/user/settings/useUserAgreements') +// MOCK global search +jest.mock('~/components/GlobalSearchAutocomplete/apiGlobalSearch') +jest.mock('~/components/GlobalSearchAutocomplete/useHasRemotes') // MOCK isMaintainerOf const mockIsMaintainer = jest.fn(props => Promise.resolve(false)) diff --git a/frontend/__tests__/UserPages.test.tsx b/frontend/__tests__/UserPages.test.tsx index bc9d5c1e9..30482084a 100644 --- a/frontend/__tests__/UserPages.test.tsx +++ b/frontend/__tests__/UserPages.test.tsx @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: 2023 - 2024 Dusan Mijatovic (Netherlands eScience Center) -// SPDX-FileCopyrightText: 2023 - 2024 Netherlands eScience Center +// SPDX-FileCopyrightText: 2023 - 2025 Dusan Mijatovic (Netherlands eScience Center) +// SPDX-FileCopyrightText: 2023 - 2025 Netherlands eScience Center // SPDX-FileCopyrightText: 2023 Dusan Mijatovic (dv4all) // SPDX-FileCopyrightText: 2023 Dusan Mijatovic (dv4all) (dv4all) // SPDX-FileCopyrightText: 2023 Ewan Cahen (Netherlands eScience Center) @@ -32,6 +32,9 @@ jest.mock('~/components/user/software/useUserSoftware') jest.mock('~/components/user/organisations/useUserOrganisations') // MOCK user communities list jest.mock('~/components/user/communities/useUserCommunities') +// MOCK global search +jest.mock('~/components/GlobalSearchAutocomplete/apiGlobalSearch') +jest.mock('~/components/GlobalSearchAutocomplete/useHasRemotes') // MOCKS const mockProps = {