diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/ContentLibrary.test.tsx b/frontend/libs/studio-content-library/src/ContentLibrary/ContentLibrary.test.tsx index 8311f02d373..bd08e460d6c 100644 --- a/frontend/libs/studio-content-library/src/ContentLibrary/ContentLibrary.test.tsx +++ b/frontend/libs/studio-content-library/src/ContentLibrary/ContentLibrary.test.tsx @@ -6,7 +6,7 @@ import { mockPagesConfig } from '../../mocks/mockPagesConfig'; import { textMock } from '@studio/testing/mocks/i18nMock'; import { RouterContext } from '../contexts/RouterContext'; import type { PageName } from '../types/PageName'; -import { renderWithBrowserRouter } from '../../test-utils/renderWithBrowserRouter'; +import { renderWithProviders } from '../../test-utils/renderWithProviders'; const navigateMock = jest.fn(); @@ -52,7 +52,7 @@ describe('ContentLibrary', () => { }); const renderContentLibrary = (currentPage: PageName = undefined) => { - renderWithBrowserRouter( + renderWithProviders( , diff --git a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/PagesRouter/PagesRouter.test.tsx b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/PagesRouter/PagesRouter.test.tsx index c25079939fc..f93208608ef 100644 --- a/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/PagesRouter/PagesRouter.test.tsx +++ b/frontend/libs/studio-content-library/src/ContentLibrary/LibraryBody/PagesRouter/PagesRouter.test.tsx @@ -5,7 +5,7 @@ import { PagesRouter } from './PagesRouter'; import { textMock } from '@studio/testing/mocks/i18nMock'; import { RouterContext } from '../../../contexts/RouterContext'; import type { PageName } from '../../../types/PageName'; -import { renderWithBrowserRouter } from '../../../../test-utils/renderWithBrowserRouter'; +import { renderWithProviders } from '../../../../test-utils/renderWithProviders'; const navigateMock = jest.fn(); @@ -35,7 +35,7 @@ describe('PagesRouter', () => { }); const renderPagesRouter = (pageNames: PageName[] = ['codeList', 'images']) => { - renderWithBrowserRouter( + renderWithProviders( , diff --git a/frontend/libs/studio-content-library/src/config/ContentResourceLibraryImpl.test.tsx b/frontend/libs/studio-content-library/src/config/ContentResourceLibraryImpl.test.tsx index 3ab804ead59..180209adb4b 100644 --- a/frontend/libs/studio-content-library/src/config/ContentResourceLibraryImpl.test.tsx +++ b/frontend/libs/studio-content-library/src/config/ContentResourceLibraryImpl.test.tsx @@ -2,7 +2,7 @@ import { screen } from '@testing-library/react'; import type { PagesConfig } from '../types/PagesProps'; import { ResourceContentLibraryImpl } from './ContentResourceLibraryImpl'; import { textMock } from '@studio/testing/mocks/i18nMock'; -import { renderWithBrowserRouter } from '../../test-utils/renderWithBrowserRouter'; +import { renderWithProviders } from '../../test-utils/renderWithProviders'; describe('ContentResourceLibraryImpl', () => { it('renders ContentResourceLibraryImpl with given pages', () => { @@ -53,5 +53,5 @@ describe('ContentResourceLibraryImpl', () => { const renderContentResourceLibraryImpl = (pages: PagesConfig) => { const contentResourceLibraryImpl = new ResourceContentLibraryImpl({ pages }); const { getContentResourceLibrary } = contentResourceLibraryImpl; - renderWithBrowserRouter(getContentResourceLibrary()); + renderWithProviders(getContentResourceLibrary()); }; diff --git a/frontend/libs/studio-content-library/test-utils/renderWithBrowserRouter.tsx b/frontend/libs/studio-content-library/test-utils/renderWithBrowserRouter.tsx deleted file mode 100644 index a0e21c65ad9..00000000000 --- a/frontend/libs/studio-content-library/test-utils/renderWithBrowserRouter.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import type { ReactNode } from 'react'; -import React from 'react'; -import { BrowserRouter } from 'react-router-dom'; -import type { RenderResult } from '@testing-library/react'; -import { render } from '@testing-library/react'; - -export function renderWithBrowserRouter(component: ReactNode): RenderResult { - return render({component}); -} diff --git a/frontend/libs/studio-content-library/test-utils/renderWithProviders.tsx b/frontend/libs/studio-content-library/test-utils/renderWithProviders.tsx new file mode 100644 index 00000000000..9b071a3390b --- /dev/null +++ b/frontend/libs/studio-content-library/test-utils/renderWithProviders.tsx @@ -0,0 +1,15 @@ +import type { ReactNode } from 'react'; +import React from 'react'; +import { BrowserRouter } from 'react-router-dom'; +import type { RenderResult } from '@testing-library/react'; +import { render } from '@testing-library/react'; +import { ToastContainer, Slide } from 'react-toastify'; + +export function renderWithProviders(component: ReactNode): RenderResult { + return render( + <> + + {component} + , + ); +}