From 8501e7e66f0ea512695434a842c2fb0326c575f8 Mon Sep 17 00:00:00 2001 From: aidynoJ Date: Wed, 9 Oct 2024 20:26:39 +0500 Subject: [PATCH] fix tests --- src/App.js | 6 +----- src/RootWithIntl.test.js | 5 ----- .../SessionEventContainer/SessionEventContainer.test.js | 6 ++++++ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/App.js b/src/App.js index 64517dac..9f2605d2 100644 --- a/src/App.js +++ b/src/App.js @@ -39,11 +39,7 @@ export default class StripesCore extends Component { const parsedTenant = storedTenant ? JSON.parse(storedTenant) : undefined; const okapi = (typeof okapiConfig === 'object' && Object.keys(okapiConfig).length > 0) - ? { - ...okapiConfig, - tenant: parsedTenant?.tenantName || okapiConfig.tenant, - clientId: parsedTenant?.clientId || okapiConfig.clientId - } : { withoutOkapi: true }; + ? { ...okapiConfig, tenant: parsedTenant?.tenantName || okapiConfig.tenant, clientId: parsedTenant?.clientId || okapiConfig.clientId } : { withoutOkapi: true }; const initialState = merge({}, { okapi }, props.initialState); diff --git a/src/RootWithIntl.test.js b/src/RootWithIntl.test.js index 971e9e09..198558f4 100644 --- a/src/RootWithIntl.test.js +++ b/src/RootWithIntl.test.js @@ -40,11 +40,6 @@ const store = { }; describe('RootWithIntl', () => { - beforeAll(() => { - const eventsPortal = document.createElement('div'); - eventsPortal.id = 'events-portal'; - document.body.appendChild(eventsPortal); - }); it('renders login without one of (isAuthenticated, token, disableAuth)', async () => { const stripes = new Stripes({ epics: {}, logger: {}, bindings: {}, config: {}, store, discovery: { isFinished: false } }); await render(); diff --git a/src/components/SessionEventContainer/SessionEventContainer.test.js b/src/components/SessionEventContainer/SessionEventContainer.test.js index ddca458c..539d7006 100644 --- a/src/components/SessionEventContainer/SessionEventContainer.test.js +++ b/src/components/SessionEventContainer/SessionEventContainer.test.js @@ -16,6 +16,7 @@ import { import { RTR_TIMEOUT_EVENT } from '../Root/constants'; import { toggleRtrModal } from '../../okapiActions'; +import { eventsPortal } from '../../constants'; jest.mock('./KeepWorkingModal', () => (() =>
KeepWorkingModal
)); jest.mock('../../loginServices'); @@ -37,6 +38,11 @@ const stripes = { }; describe('SessionEventContainer', () => { + beforeAll(() => { + const eventsPortalElement = document.createElement('div'); + eventsPortalElement.id = eventsPortal; + document.body.appendChild(eventsPortalElement); + }); it('Renders nothing if useSecureTokens is false', async () => { const insecureStripes = { config: {