fix TemplateList name in tests

This commit is contained in:
Keith Grant 2020-02-12 13:10:14 -08:00
parent c33cc82d53
commit 490b76b141
4 changed files with 19 additions and 19 deletions

View File

@ -88,6 +88,7 @@ function OrganizationsList({ i18n }) {
const handleOrgDelete = async () => {
await deleteOrganizations();
await adjustPagination();
setSelected([]);
};
const adjustPagination = () => {

View File

@ -252,5 +252,4 @@ function TemplateList({ i18n }) {
);
}
export { TemplateList as _TemplatesList };
export default withI18n()(TemplateList);

View File

@ -9,7 +9,7 @@ import {
} from '@api';
import { mountWithContexts, waitForElement } from '@testUtils/enzymeHelpers';
import TemplatesList from './TemplateList';
import TemplateList from './TemplateList';
jest.mock('@api');
@ -94,7 +94,7 @@ describe('<TemplateList />', () => {
test('initially renders successfully', async () => {
await act(async () => {
mountWithContexts(
<TemplatesList
<TemplateList
match={{ path: '/templates', url: '/templates' }}
location={{ search: '', pathname: '/templates' }}
/>
@ -105,7 +105,7 @@ describe('<TemplateList />', () => {
test('Templates are retrieved from the api and the components finishes loading', async () => {
let wrapper;
await act(async () => {
wrapper = mountWithContexts(<TemplatesList />);
wrapper = mountWithContexts(<TemplateList />);
});
expect(UnifiedJobTemplatesAPI.read).toBeCalled();
await act(async () => {
@ -115,7 +115,7 @@ describe('<TemplateList />', () => {
});
test('handleSelect is called when a template list item is selected', async () => {
const wrapper = mountWithContexts(<TemplatesList />);
const wrapper = mountWithContexts(<TemplateList />);
await act(async () => {
await waitForElement(wrapper, 'ContentLoading', el => el.length === 0);
});
@ -143,7 +143,7 @@ describe('<TemplateList />', () => {
});
test('handleSelectAll is called when a template list item is selected', async () => {
const wrapper = mountWithContexts(<TemplatesList />);
const wrapper = mountWithContexts(<TemplateList />);
await act(async () => {
await waitForElement(wrapper, 'ContentLoading', el => el.length === 0);
});
@ -158,7 +158,7 @@ describe('<TemplateList />', () => {
});
test('delete button is disabled if user does not have delete capabilities on a selected template', async () => {
const wrapper = mountWithContexts(<TemplatesList />);
const wrapper = mountWithContexts(<TemplateList />);
await act(async () => {
await waitForElement(wrapper, 'ContentLoading', el => el.length === 0);
});
@ -217,7 +217,7 @@ describe('<TemplateList />', () => {
});
test('api is called to delete templates for each selected template.', async () => {
const wrapper = mountWithContexts(<TemplatesList />);
const wrapper = mountWithContexts(<TemplateList />);
await act(async () => {
await waitForElement(wrapper, 'ContentLoading', el => el.length === 0);
});
@ -277,7 +277,7 @@ describe('<TemplateList />', () => {
},
})
);
const wrapper = mountWithContexts(<TemplatesList />);
const wrapper = mountWithContexts(<TemplateList />);
await act(async () => {
await waitForElement(wrapper, 'ContentLoading', el => el.length === 0);
});
@ -315,7 +315,7 @@ describe('<TemplateList />', () => {
const wrapper = mountWithContexts(
<Route
path="/projects/:id/job_templates"
component={() => <TemplatesList />}
component={() => <TemplateList />}
/>,
{
context: {

View File

@ -2,12 +2,12 @@ import React from 'react';
import { mountWithContexts } from '@testUtils/enzymeHelpers';
import TemplatesListItem from './TemplateListItem';
import TemplateListItem from './TemplateListItem';
describe('<TemplateListItem />', () => {
test('launch button shown to users with start capabilities', () => {
const wrapper = mountWithContexts(
<TemplatesListItem
<TemplateListItem
isSelected={false}
template={{
id: 1,
@ -26,7 +26,7 @@ describe('<TemplateListItem />', () => {
});
test('launch button hidden from users without start capabilities', () => {
const wrapper = mountWithContexts(
<TemplatesListItem
<TemplateListItem
isSelected={false}
template={{
id: 1,
@ -45,7 +45,7 @@ describe('<TemplateListItem />', () => {
});
test('edit button shown to users with edit capabilities', () => {
const wrapper = mountWithContexts(
<TemplatesListItem
<TemplateListItem
isSelected={false}
template={{
id: 1,
@ -64,7 +64,7 @@ describe('<TemplateListItem />', () => {
});
test('edit button hidden from users without edit capabilities', () => {
const wrapper = mountWithContexts(
<TemplatesListItem
<TemplateListItem
isSelected={false}
template={{
id: 1,
@ -83,7 +83,7 @@ describe('<TemplateListItem />', () => {
});
test('missing resource icon is shown.', () => {
const wrapper = mountWithContexts(
<TemplatesListItem
<TemplateListItem
isSelected={false}
template={{
id: 1,
@ -102,7 +102,7 @@ describe('<TemplateListItem />', () => {
});
test('missing resource icon is not shown when there is a project and an inventory.', () => {
const wrapper = mountWithContexts(
<TemplatesListItem
<TemplateListItem
isSelected={false}
template={{
id: 1,
@ -123,7 +123,7 @@ describe('<TemplateListItem />', () => {
});
test('missing resource icon is not shown when inventory is prompt_on_launch, and a project', () => {
const wrapper = mountWithContexts(
<TemplatesListItem
<TemplateListItem
isSelected={false}
template={{
id: 1,
@ -144,7 +144,7 @@ describe('<TemplateListItem />', () => {
});
test('missing resource icon is not shown type is workflow_job_template', () => {
const wrapper = mountWithContexts(
<TemplatesListItem
<TemplateListItem
isSelected={false}
template={{
id: 1,