diff --git a/src/RootWithIntl.test.js b/src/RootWithIntl.test.js index 2beb96b77..24507b40d 100644 --- a/src/RootWithIntl.test.js +++ b/src/RootWithIntl.test.js @@ -5,17 +5,26 @@ import { render, screen } from '@folio/jest-config-stripes/testing-library/react import { Router as DefaultRouter } from 'react-router-dom'; import { createMemoryHistory } from 'history'; -import Login from './components/Login'; -import MainNav from './components/MainNav'; -import MainContainer from './components/MainContainer'; -import ModuleContainer from './components/ModuleContainer'; +import { + Login, + MainNav, + MainContainer, + ModuleContainer, + OverlayContainer, + StaleBundleWarning, + SessionEventContainer, +} from './components'; + import RootWithIntl from './RootWithIntl'; import Stripes from './Stripes'; jest.mock('./components/Login', () => () => ''); jest.mock('./components/MainNav', () => () => ''); -jest.mock('./components/ModuleContainer', () => () => ''); +jest.mock('./components/OverlayContainer', () => () => ''); +jest.mock('./components/ModuleContainer', () => ({ children }) => children); jest.mock('./components/MainContainer', () => ({ children }) => children); +jest.mock('./components/StaleBundleWarning', () => () => ''); +jest.mock('./components/SessionEventContainer', () => () => ''); const defaultHistory = createMemoryHistory(); @@ -82,14 +91,33 @@ describe('RootWithIntl', () => { const stripes = new Stripes({ epics: {}, logger: {}, bindings: {}, config: {}, store, discovery: { isFinished: true } }); await render(); - expect(screen.getByText(//)).toBeInTheDocument(); + expect(screen.queryByText(//)).toBeNull(); + expect(screen.queryByText(//)).toBeInTheDocument(); + expect(screen.getByText(//)).toBeInTheDocument(); }); it('if discovery is finished', async () => { const stripes = new Stripes({ epics: {}, logger: {}, bindings: {}, config: {}, store, okapi: {}, discovery: { isFinished: true } }); await render(); - expect(screen.getByText(//)).toBeInTheDocument(); + expect(screen.queryByText(//)).toBeNull(); + expect(screen.queryByText(//)).toBeInTheDocument(); + expect(screen.getByText(//)).toBeInTheDocument(); }); }); + + it('renders StaleBundleWarning', async () => { + const stripes = new Stripes({ epics: {}, logger: {}, bindings: {}, config: { staleBundleWarning: {} }, store, okapi: {}, discovery: { isFinished: true } }); + await render(); + + expect(screen.getByText(//)).toBeInTheDocument(); + }); + + it('renders SessionEventContainer', async () => { + const stripes = new Stripes({ epics: {}, logger: {}, bindings: {}, config: { useSecureTokens: true }, store, okapi: {}, discovery: { isFinished: true } }); + await render(); + + expect(screen.getByText(//)).toBeInTheDocument(); + }); + }); diff --git a/src/components/index.js b/src/components/index.js index 99e2dcd54..f6e471bba 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -31,6 +31,7 @@ export { default as BadRequestScreen } from './BadRequestScreen'; export { default as NoPermissionScreen } from './NoPermissionScreen'; export { default as ResetPasswordNotAvailableScreen } from './ResetPasswordNotAvailableScreen'; export { default as SessionEventContainer } from './SessionEventContainer'; +export { default as StaleBundleWarning } from './StaleBundleWarning'; export * from './ModuleHierarchy'; export * from './Namespace';