1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from 'react';
6 import { mount, configure } from 'enzyme';
7 import Adapter from "enzyme-adapter-react-16";
8 import { CustomTheme } from 'common/custom-theme';
9 import { InactivePanelStateProps, CssRules, InactivePanelRoot } from './inactive-panel';
10 import { MuiThemeProvider, StyledComponentProps } from '@material-ui/core';
12 configure({ adapter: new Adapter() });
14 describe('InactivePanel', () => {
15 let props: InactivePanelStateProps & StyledComponentProps<CssRules>;
24 isLoginClusterFederation: false,
25 inactivePageText: 'Inactive page content',
29 it('should render content and link account option', () => {
31 const expectedMessage = "Inactive page content";
32 const expectedLinkAccountText = 'If you would like to use this login to access another account click "Link Account"';
35 const wrapper = mount(
36 <MuiThemeProvider theme={CustomTheme}>
37 <InactivePanelRoot {...props} />
42 expect(wrapper.find('p').first().text()).toContain(expectedMessage);
43 expect(wrapper.find('p').at(1).text()).toContain(expectedLinkAccountText);
46 it('should render content and link account warning on LoginCluster federations', () => {
48 props.isLoginClusterFederation = true;
49 const expectedMessage = "Inactive page content";
50 const expectedLinkAccountText = 'If you would like to use this login to access another account, please contact your administrator';
53 const wrapper = mount(
54 <MuiThemeProvider theme={CustomTheme}>
55 <InactivePanelRoot {...props} />
60 expect(wrapper.find('p').first().text()).toContain(expectedMessage);
61 expect(wrapper.find('p').at(1).text()).toContain(expectedLinkAccountText);