remove 3rd batch of unmount calls

This commit is contained in:
Keith J. Grant
2021-07-09 09:08:32 -07:00
parent bf7663a0a1
commit 81c16f4fa7
69 changed files with 51 additions and 211 deletions

View File

@@ -145,7 +145,6 @@ describe('<ExecutionEnvironmentForm/>', () => {
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('Initially renders successfully', () => { test('Initially renders successfully', () => {

View File

@@ -108,7 +108,6 @@ describe('<HostGroupsList />', () => {
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('initially renders successfully', () => { test('initially renders successfully', () => {

View File

@@ -67,7 +67,6 @@ describe('<ContainerGroupAdd/>', () => {
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('handleSubmit should call the api and redirect to details page', async () => { test('handleSubmit should call the api and redirect to details page', async () => {

View File

@@ -113,7 +113,6 @@ describe('<ContainerGroupEdit/>', () => {
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('initially renders successfully', async () => { test('initially renders successfully', async () => {

View File

@@ -63,7 +63,6 @@ describe('<InstanceGroupAdd/>', () => {
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('handleSubmit should call the api and redirect to details page', async () => { test('handleSubmit should call the api and redirect to details page', async () => {

View File

@@ -91,7 +91,6 @@ describe('<ContainerGroupForm/>', () => {
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('Initially renders successfully', () => { test('Initially renders successfully', () => {

View File

@@ -60,7 +60,6 @@ describe('<InstanceGroupForm/>', () => {
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('Initially renders successfully', () => { test('Initially renders successfully', () => {

View File

@@ -4,10 +4,6 @@ import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
import Inventories from './Inventories'; import Inventories from './Inventories';
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
}));
describe('<Inventories />', () => { describe('<Inventories />', () => {
let pageWrapper; let pageWrapper;
@@ -15,10 +11,6 @@ describe('<Inventories />', () => {
pageWrapper = mountWithContexts(<Inventories />); pageWrapper = mountWithContexts(<Inventories />);
}); });
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => { test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1); expect(pageWrapper.length).toBe(1);
}); });

View File

@@ -43,7 +43,6 @@ describe('<InventoryGroupHostList />', () => {
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('initially renders successfully ', () => { test('initially renders successfully ', () => {

View File

@@ -26,10 +26,6 @@ describe('<InventoryGroupHostListItem />', () => {
); );
}); });
afterEach(() => {
wrapper.unmount();
});
test('should display expected row item content', () => { test('should display expected row item content', () => {
expect(wrapper.find('b').text()).toContain( expect(wrapper.find('b').text()).toContain(
'.host-000001.group-00000.dummy' '.host-000001.group-00000.dummy'

View File

@@ -96,7 +96,6 @@ describe('<InventoryGroupsList />', () => {
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('should fetch groups from api and render them in the list', async () => { test('should fetch groups from api and render them in the list', async () => {
@@ -201,7 +200,6 @@ describe('<InventoryGroupsList/> error handling', () => {
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('should show content error when api throws error on initial render', async () => { test('should show content error when api throws error on initial render', async () => {

View File

@@ -41,10 +41,6 @@ describe('<InventoryHost />', () => {
}); });
}); });
afterEach(() => {
wrapper.unmount();
});
test('should render expected tabs', async () => { test('should render expected tabs', async () => {
const expectedTabs = [ const expectedTabs = [
'Back to Hosts', 'Back to Hosts',

View File

@@ -100,7 +100,6 @@ describe('<InventoryHostGroupsList />', () => {
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('initially renders successfully', () => { test('initially renders successfully', () => {

View File

@@ -44,10 +44,6 @@ describe('<InventoryHostItem />', () => {
); );
}); });
afterEach(() => {
wrapper.unmount();
});
test('edit button shown to users with edit capabilities', () => { test('edit button shown to users with edit capabilities', () => {
expect(wrapper.find('PencilAltIcon').exists()).toBeTruthy(); expect(wrapper.find('PencilAltIcon').exists()).toBeTruthy();
}); });

View File

@@ -3,6 +3,14 @@ import { createMemoryHistory } from 'history';
import { mountWithContexts } from '../../../../testUtils/enzymeHelpers'; import { mountWithContexts } from '../../../../testUtils/enzymeHelpers';
import InventoryHosts from './InventoryHosts'; import InventoryHosts from './InventoryHosts';
jest.mock('./InventoryHostList', () => {
const InventoryHostList = () => <div />;
return {
__esModule: true,
default: InventoryHostList,
};
});
describe('<InventoryHosts />', () => { describe('<InventoryHosts />', () => {
test('should render inventory host list', () => { test('should render inventory host list', () => {
const history = createMemoryHistory({ const history = createMemoryHistory({
@@ -20,6 +28,5 @@ describe('<InventoryHosts />', () => {
}); });
expect(wrapper.find('InventoryHostList').length).toBe(1); expect(wrapper.find('InventoryHostList').length).toBe(1);
wrapper.unmount();
}); });
}); });

View File

@@ -95,7 +95,6 @@ describe('<InventoryRelatedGroupList />', () => {
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('initially renders successfully ', () => { test('initially renders successfully ', () => {

View File

@@ -72,7 +72,6 @@ describe('<InventorySourceAdd />', () => {
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('new form displays primary form fields', async () => { test('new form displays primary form fields', async () => {

View File

@@ -23,7 +23,6 @@ const source = {
describe('<InventorySourceListItem />', () => { describe('<InventorySourceListItem />', () => {
let wrapper; let wrapper;
afterEach(() => { afterEach(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -6,6 +6,5 @@ describe('<InventorySources />', () => {
test('initially renders without crashing', () => { test('initially renders without crashing', () => {
const wrapper = shallow(<InventorySources />); const wrapper = shallow(<InventorySources />);
expect(wrapper.length).toBe(1); expect(wrapper.length).toBe(1);
wrapper.unmount();
}); });
}); });

View File

@@ -22,7 +22,6 @@ describe('<SmartInventory />', () => {
let wrapper; let wrapper;
afterEach(() => { afterEach(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -29,7 +29,6 @@ describe('<SmartInventoryHost />', () => {
let history; let history;
afterEach(() => { afterEach(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -37,7 +37,6 @@ describe('<SmartInventoryHostList />', () => {
afterAll(() => { afterAll(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('initially renders successfully', () => { test('initially renders successfully', () => {

View File

@@ -37,10 +37,6 @@ describe('<SmartInventoryHostListItem />', () => {
); );
}); });
afterEach(() => {
wrapper.unmount();
});
test('should render expected row cells', () => { test('should render expected row cells', () => {
const cells = wrapper.find('Td'); const cells = wrapper.find('Td');
expect(cells).toHaveLength(4); expect(cells).toHaveLength(4);

View File

@@ -8,6 +8,13 @@ import {
import SmartInventoryHosts from './SmartInventoryHosts'; import SmartInventoryHosts from './SmartInventoryHosts';
jest.mock('../../../api'); jest.mock('../../../api');
jest.mock('./SmartInventoryHostList', () => {
const SmartInventoryHostList = () => <div />;
return {
__esModule: true,
default: SmartInventoryHostList,
};
});
describe('<SmartInventoryHosts />', () => { describe('<SmartInventoryHosts />', () => {
test('should render smart inventory host list', () => { test('should render smart inventory host list', () => {
@@ -26,8 +33,10 @@ describe('<SmartInventoryHosts />', () => {
} }
); );
expect(wrapper.find('SmartInventoryHostList').length).toBe(1); expect(wrapper.find('SmartInventoryHostList').length).toBe(1);
expect(wrapper.find('SmartInventoryHostList').prop('inventory')).toEqual({
id: 1,
});
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('should render smart inventory host details', async () => { test('should render smart inventory host details', async () => {
@@ -51,6 +60,5 @@ describe('<SmartInventoryHosts />', () => {
await waitForElement(wrapper, 'ContentLoading', el => el.length === 0); await waitForElement(wrapper, 'ContentLoading', el => el.length === 0);
expect(wrapper.find('SmartInventoryHost').length).toBe(1); expect(wrapper.find('SmartInventoryHost').length).toBe(1);
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
}); });

View File

@@ -21,7 +21,6 @@ describe('<InventorySourceSyncButton />', () => {
); );
}); });
afterEach(() => { afterEach(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -13,10 +13,6 @@ describe('<HostStatusBar />', () => {
wrapper = mountWithContexts(<HostStatusBar counts={mockCounts} />); wrapper = mountWithContexts(<HostStatusBar counts={mockCounts} />);
}); });
afterEach(() => {
wrapper.unmount();
});
test('initially renders without crashing', () => { test('initially renders without crashing', () => {
expect(wrapper.length).toBe(1); expect(wrapper.length).toBe(1);
}); });

View File

@@ -22,10 +22,6 @@ describe('<OutputToolbar />', () => {
); );
}); });
afterEach(() => {
wrapper.unmount();
});
test('initially renders without crashing', () => { test('initially renders without crashing', () => {
expect(wrapper.length).toBe(1); expect(wrapper.length).toBe(1);
}); });

View File

@@ -115,7 +115,6 @@ describe('WorkflowOutput', () => {
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
delete window.SVGElement.prototype.getBBox; delete window.SVGElement.prototype.getBBox;
delete window.SVGElement.prototype.getBoundingClientRect; delete window.SVGElement.prototype.getBoundingClientRect;
delete window.SVGElement.prototype.height; delete window.SVGElement.prototype.height;

View File

@@ -44,10 +44,6 @@ describe('WorkflowOutputToolbar', () => {
); );
}); });
afterAll(() => {
wrapper.unmount();
});
test('should render correct toolbar item', () => { test('should render correct toolbar item', () => {
shouldFind(`Button[ouiaId="edit-workflow"]`); shouldFind(`Button[ouiaId="edit-workflow"]`);
shouldFind('Button#workflow-output-toggle-legend'); shouldFind('Button#workflow-output-toggle-legend');

View File

@@ -4,10 +4,6 @@ import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
import ManagementJobs from './ManagementJobs'; import ManagementJobs from './ManagementJobs';
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
}));
describe('<ManagementJobs />', () => { describe('<ManagementJobs />', () => {
let pageWrapper; let pageWrapper;
let pageSections; let pageSections;
@@ -17,10 +13,6 @@ describe('<ManagementJobs />', () => {
pageSections = pageWrapper.find('PageSection'); pageSections = pageWrapper.find('PageSection');
}); });
afterEach(() => {
pageWrapper.unmount();
});
test('renders ok', () => { test('renders ok', () => {
expect(pageWrapper.length).toBe(1); expect(pageWrapper.length).toBe(1);
expect(pageWrapper.find('ScreenHeader').length).toBe(1); expect(pageWrapper.find('ScreenHeader').length).toBe(1);

View File

@@ -33,7 +33,6 @@ describe('<Metrics/>', () => {
}); });
}); });
afterEach(() => { afterEach(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });
test('should mound properly', () => { test('should mound properly', () => {

View File

@@ -2,26 +2,21 @@ import React from 'react';
import { mountWithContexts } from '../../../testUtils/enzymeHelpers'; import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
import NotificationTemplates from './NotificationTemplates'; import NotificationTemplates from './NotificationTemplates';
jest.mock('react-router-dom', () => ({ jest.mock('./NotificationTemplateList', () => {
...jest.requireActual('react-router-dom'), const NotificationTemplateList = () => <div />;
})); return {
__esModule: true,
default: NotificationTemplateList,
};
});
describe('<NotificationTemplates />', () => { describe('<NotificationTemplates />', () => {
let pageWrapper;
let pageSections;
beforeEach(() => {
pageWrapper = mountWithContexts(<NotificationTemplates />);
pageSections = pageWrapper.find('PageSection');
});
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => { test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1); const wrapper = mountWithContexts(<NotificationTemplates />);
expect(pageSections.length).toBe(2);
const pageSections = wrapper.find('PageSection');
expect(pageSections).toHaveLength(1);
expect(pageSections.first().props().variant).toBe('light'); expect(pageSections.first().props().variant).toBe('light');
expect(wrapper.find('NotificationTemplateList')).toHaveLength(1);
}); });
}); });

View File

@@ -1,37 +1,16 @@
import React from 'react'; import React from 'react';
import { createMemoryHistory } from 'history'; import { shallow } from 'enzyme';
import { _Projects as Projects } from './Projects';
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
import Projects from './Projects';
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
}));
describe('<Projects />', () => { describe('<Projects />', () => {
test('initially renders successfully', () => {
mountWithContexts(<Projects />);
});
test('should display a breadcrumb heading', () => { test('should display a breadcrumb heading', () => {
const history = createMemoryHistory({ const wrapper = shallow(<Projects />);
initialEntries: ['/projects'],
});
const match = { path: '/projects', url: '/projects', isExact: true };
const wrapper = mountWithContexts(<Projects />, { const header = wrapper.find('ScreenHeader');
context: { expect(header.prop('streamType')).toBe('project');
router: { expect(header.prop('breadcrumbConfig')).toEqual({
history, '/projects': 'Projects',
route: { '/projects/add': 'Create New Project',
location: history.location,
match,
},
},
},
}); });
expect(wrapper.find('Title').length).toBe(1);
wrapper.unmount();
}); });
}); });

View File

@@ -98,7 +98,6 @@ describe('<ProjectForm />', () => {
}); });
afterEach(() => { afterEach(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -1,39 +1,15 @@
import React from 'react'; import React from 'react';
import { createMemoryHistory } from 'history'; import { shallow } from 'enzyme';
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
import AllSchedules from './AllSchedules'; import AllSchedules from './AllSchedules';
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
}));
describe('<AllSchedules />', () => { describe('<AllSchedules />', () => {
let wrapper; test('should set breadcrumb config', () => {
const wrapper = shallow(<AllSchedules />);
afterEach(() => { const header = wrapper.find('ScreenHeader');
wrapper.unmount(); expect(header.prop('streamType')).toEqual('schedule');
}); expect(header.prop('breadcrumbConfig')).toEqual({
'/schedules': 'Schedules',
test('initially renders successfully', () => {
wrapper = mountWithContexts(<AllSchedules />);
});
test('should display schedule list breadcrumb heading', () => {
const history = createMemoryHistory({
initialEntries: ['/schedules'],
}); });
wrapper = mountWithContexts(<AllSchedules />, {
context: {
router: {
history,
route: {
location: history.location,
},
},
},
});
expect(wrapper.find('Title').text()).toBe('Schedules');
}); });
}); });

View File

@@ -37,7 +37,6 @@ describe('<JobsDetail />', () => {
}); });
afterAll(() => { afterAll(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -18,7 +18,6 @@ describe('<LDAP />', () => {
let wrapper; let wrapper;
afterEach(() => { afterEach(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -46,7 +46,6 @@ describe('<LDAPDetail />', () => {
}); });
afterAll(() => { afterAll(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -39,7 +39,6 @@ describe('<Logging />', () => {
let wrapper; let wrapper;
afterEach(() => { afterEach(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -34,7 +34,6 @@ describe('<LoggingDetail />', () => {
}); });
afterAll(() => { afterAll(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -20,7 +20,6 @@ describe('<MiscAuthentication />', () => {
}); });
afterEach(() => { afterEach(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -20,7 +20,6 @@ describe('<MiscSystem />', () => {
}); });
afterEach(() => { afterEach(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -23,7 +23,6 @@ describe('<RADIUS />', () => {
}); });
afterEach(() => { afterEach(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -29,7 +29,6 @@ describe('<RADIUSEdit />', () => {
}); });
afterEach(() => { afterEach(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -54,7 +54,6 @@ describe('<SAMLDetail />', () => {
}); });
afterAll(() => { afterAll(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -7,9 +7,7 @@ describe('<SettingList />', () => {
beforeEach(() => { beforeEach(() => {
wrapper = mountWithContexts(<SettingList />); wrapper = mountWithContexts(<SettingList />);
}); });
afterEach(() => {
wrapper.unmount();
});
test('initially renders without crashing', () => { test('initially renders without crashing', () => {
expect(wrapper.length).toBe(1); expect(wrapper.length).toBe(1);
}); });

View File

@@ -30,7 +30,6 @@ describe('<Settings />', () => {
}); });
afterEach(() => { afterEach(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -24,7 +24,6 @@ describe('<Subscription />', () => {
let wrapper; let wrapper;
afterEach(() => { afterEach(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -44,10 +44,6 @@ describe('<SubscriptionDetail />', () => {
}); });
}); });
afterEach(() => {
wrapper.unmount();
});
test('initially renders without crashing', () => { test('initially renders without crashing', () => {
expect(wrapper.find('SubscriptionDetail').length).toBe(1); expect(wrapper.find('SubscriptionDetail').length).toBe(1);
}); });

View File

@@ -29,7 +29,6 @@ describe('<AnalyticsStep />', () => {
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('initially renders without crashing', async () => { test('initially renders without crashing', async () => {

View File

@@ -29,7 +29,6 @@ describe('<EulaStep />', () => {
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('initially renders without crashing', async () => { test('initially renders without crashing', async () => {

View File

@@ -54,7 +54,6 @@ describe('<SubscriptionModal />', () => {
afterAll(() => { afterAll(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('initially renders without crashing', async () => { test('initially renders without crashing', async () => {

View File

@@ -29,7 +29,6 @@ describe('<SubscriptionStep />', () => {
afterAll(() => { afterAll(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('initially renders without crashing', async () => { test('initially renders without crashing', async () => {

View File

@@ -22,7 +22,6 @@ describe('<TACACS />', () => {
let wrapper; let wrapper;
afterEach(() => { afterEach(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -39,7 +39,6 @@ describe('<TACACSDetail />', () => {
}); });
afterAll(() => { afterAll(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -31,7 +31,6 @@ describe('<TACACSEdit />', () => {
}); });
afterEach(() => { afterEach(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -23,7 +23,6 @@ describe('<UI />', () => {
let wrapper; let wrapper;
afterEach(() => { afterEach(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -37,7 +37,6 @@ describe('<UIDetail />', () => {
}); });
afterAll(() => { afterAll(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -29,7 +29,6 @@ describe('<UIEdit />', () => {
}); });
afterEach(() => { afterEach(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -8,6 +8,5 @@ describe('RevertAllAlert', () => {
<RevertAllAlert onClose={() => {}} onRevertAll={() => {}} /> <RevertAllAlert onClose={() => {}} onRevertAll={() => {}} />
); );
expect(wrapper).toHaveLength(1); expect(wrapper).toHaveLength(1);
wrapper.unmount();
}); });
}); });

View File

@@ -7,10 +7,6 @@ import RevertButton from './RevertButton';
describe('RevertButton', () => { describe('RevertButton', () => {
let wrapper; let wrapper;
afterEach(() => {
wrapper.unmount();
});
test('button text should display "Revert"', async () => { test('button text should display "Revert"', async () => {
wrapper = mountWithContexts( wrapper = mountWithContexts(
<Formik <Formik

View File

@@ -12,6 +12,5 @@ describe('RevertFormActionGroup', () => {
/> />
); );
expect(wrapper).toHaveLength(1); expect(wrapper).toHaveLength(1);
wrapper.unmount();
}); });
}); });

View File

@@ -33,10 +33,6 @@ describe('<TeamDetail />', () => {
await waitForElement(wrapper, 'ContentLoading', el => el.length === 0); await waitForElement(wrapper, 'ContentLoading', el => el.length === 0);
}); });
afterEach(() => {
wrapper.unmount();
});
test('initially renders successfully', async () => { test('initially renders successfully', async () => {
await waitForElement(wrapper, 'TeamDetail'); await waitForElement(wrapper, 'TeamDetail');
}); });

View File

@@ -175,7 +175,6 @@ describe('<TeamRolesList />', () => {
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
}); });
test('should render properly', async () => { test('should render properly', async () => {
TeamsAPI.readRoles.mockResolvedValue(roles); TeamsAPI.readRoles.mockResolvedValue(roles);

View File

@@ -30,7 +30,6 @@ describe('<TeamForm />', () => {
}; };
afterEach(() => { afterEach(() => {
wrapper.unmount();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@@ -75,12 +75,6 @@ describe('<SurveyPreviewModal />', () => {
}); });
waitForElement(wrapper, 'Form'); waitForElement(wrapper, 'Form');
}); });
afterAll(() => {
wrapper.unmount();
});
test('renders successfully', async () => {
expect(wrapper.find('SurveyPreviewModal').length).toBe(1);
});
test('Renders proper fields', async () => { test('Renders proper fields', async () => {
const question1 = wrapper.find('FormGroup[label="Text Question"]'); const question1 = wrapper.find('FormGroup[label="Text Question"]');

View File

@@ -55,10 +55,6 @@ describe('<SurveyQuestionEdit />', () => {
}); });
}); });
afterEach(() => {
wrapper.unmount();
});
test('should render form', () => { test('should render form', () => {
expect(wrapper.find('SurveyQuestionForm')).toHaveLength(1); expect(wrapper.find('SurveyQuestionForm')).toHaveLength(1);
}); });
@@ -149,8 +145,6 @@ describe('<SurveyQuestionEdit />', () => {
expect(history.location.pathname).toEqual( expect(history.location.pathname).toEqual(
'/templates/job_templates/1/survey' '/templates/job_templates/1/survey'
); );
wrapper.unmount();
}); });
}); });
}); });

View File

@@ -3,10 +3,6 @@ import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
import Templates from './Templates'; import Templates from './Templates';
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
}));
describe('<Templates />', () => { describe('<Templates />', () => {
let pageWrapper; let pageWrapper;
@@ -14,10 +10,6 @@ describe('<Templates />', () => {
pageWrapper = mountWithContexts(<Templates />); pageWrapper = mountWithContexts(<Templates />);
}); });
afterEach(() => {
pageWrapper.unmount();
});
test('initially renders without crashing', () => { test('initially renders without crashing', () => {
expect(pageWrapper.length).toBe(1); expect(pageWrapper.length).toBe(1);
}); });

View File

@@ -23,6 +23,7 @@ describe('<WebhookSubForm />', () => {
webhook_service: 'github', webhook_service: 'github',
webhook_key: 'webhook key', webhook_key: 'webhook key',
}; };
beforeEach(async () => { beforeEach(async () => {
history = createMemoryHistory({ history = createMemoryHistory({
initialEntries: ['templates/job_template/51/edit'], initialEntries: ['templates/job_template/51/edit'],
@@ -51,13 +52,11 @@ describe('<WebhookSubForm />', () => {
); );
}); });
}); });
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
wrapper.unmount();
});
test('mounts properly', () => {
expect(wrapper.length).toBe(1);
}); });
test('should render initial values properly', () => { test('should render initial values properly', () => {
waitForElement(wrapper, 'Lookup__ChipHolder', el => el.lenth > 0); waitForElement(wrapper, 'Lookup__ChipHolder', el => el.lenth > 0);
expect(wrapper.find('AnsibleSelect').prop('value')).toBe('github'); expect(wrapper.find('AnsibleSelect').prop('value')).toBe('github');
@@ -73,6 +72,7 @@ describe('<WebhookSubForm />', () => {
'Github credential' 'Github credential'
); );
}); });
test('should make other credential type available', async () => { test('should make other credential type available', async () => {
CredentialsAPI.read.mockResolvedValue({ CredentialsAPI.read.mockResolvedValue({
data: { results: [{ id: 13, name: 'GitLab credential' }] }, data: { results: [{ id: 13, name: 'GitLab credential' }] },
@@ -93,6 +93,7 @@ describe('<WebhookSubForm />', () => {
.prop('value') .prop('value')
).toBe('A NEW WEBHOOK KEY WILL BE GENERATED ON SAVE.'); ).toBe('A NEW WEBHOOK KEY WILL BE GENERATED ON SAVE.');
}); });
test('should have disabled button to update webhook key', async () => { test('should have disabled button to update webhook key', async () => {
let newWrapper; let newWrapper;
await act(async () => { await act(async () => {