Skip to content

Commit

Permalink
fix tests for root with intl, remove unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
aidynoJ committed Oct 2, 2024
1 parent 9442f86 commit 66d7c68
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default class StripesCore extends Component {
return (
<StrictWrapper>
<div
id="events-container"
id="events-portal"
className={css.eventsContainer}
/>
<Root
Expand Down
2 changes: 1 addition & 1 deletion src/RootWithIntl.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const RootWithIntl = ({ stripes, token = '', isAuthenticated = false, disableAut
createPortal(<SessionEventContainer
history={history}
/>,
document.getElementById('events-container'))}
document.getElementById('events-portal'))}
<Switch>
<TitledRoute
name="home"
Expand Down
19 changes: 5 additions & 14 deletions src/RootWithIntl.test.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
/* shhhh, eslint, it's ok. we need "unused" imports for mocks */
/* eslint-disable no-unused-vars */

import { render, screen } from '@folio/jest-config-stripes/testing-library/react';
import { Router as DefaultRouter } from 'react-router-dom';
import { createMemoryHistory } from 'history';

import AuthnLogin from './components/AuthnLogin';
import {
Login,
MainNav,
MainContainer,
ModuleContainer,
OverlayContainer,
StaleBundleWarning,
SessionEventContainer,
} from './components';

import RootWithIntl from './RootWithIntl';
import Stripes from './Stripes';

Expand Down Expand Up @@ -54,6 +40,11 @@ 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(<Harness><RootWithIntl stripes={stripes} history={defaultHistory} isAuthenticated={false} /></Harness>);
Expand Down

0 comments on commit 66d7c68

Please sign in to comment.