update the rest of the organizations tests

This commit is contained in:
John Mitchell
2019-04-22 15:11:28 -04:00
parent 54499dbf69
commit 667cbb0c20
9 changed files with 138 additions and 252 deletions

View File

@@ -1,12 +1,12 @@
import React from 'react';
import { mount } from 'enzyme';
import { MemoryRouter } from 'react-router-dom';
import { I18nProvider } from '@lingui/react';
import { mountWithContexts } from '../../../enzymeHelpers';
import OrganizationListItem from '../../../../src/pages/Organizations/components/OrganizationListItem';
describe('<OrganizationListItem />', () => {
test('initially renders succesfully', () => {
mount(
mountWithContexts(
<I18nProvider>
<MemoryRouter initialEntries={['/organizations']} initialIndex={0}>
<OrganizationListItem />

View File

@@ -1,8 +1,6 @@
import React from 'react';
import { mount } from 'enzyme';
import { MemoryRouter, Router } from 'react-router-dom';
import { createMemoryHistory } from 'history';
import { I18nProvider } from '@lingui/react';
import { mountWithContexts } from '../../../enzymeHelpers';
import { sleep } from '../../../testUtils';
import OrganizationTeamsList from '../../../../src/pages/Organizations/components/OrganizationTeamsList';
@@ -20,20 +18,16 @@ describe('<OrganizationTeamsList />', () => {
});
test('initially renders succesfully', () => {
mount(
<I18nProvider>
<MemoryRouter>
<OrganizationTeamsList
teams={mockData}
itemCount={7}
queryParams={{
page: 1,
page_size: 5,
order_by: 'name',
}}
/>
</MemoryRouter>
</I18nProvider>
mountWithContexts(
<OrganizationTeamsList
teams={mockData}
itemCount={7}
queryParams={{
page: 1,
page_size: 5,
order_by: 'name',
}}
/>
);
});
@@ -42,20 +36,16 @@ describe('<OrganizationTeamsList />', () => {
const history = createMemoryHistory({
initialEntries: ['/organizations/1/teams'],
});
const wrapper = mount(
<Router history={history}>
<I18nProvider>
<OrganizationTeamsList
teams={mockData}
itemCount={7}
queryParams={{
page: 1,
page_size: 5,
order_by: 'name',
}}
/>
</I18nProvider>
</Router>
const wrapper = mountWithContexts(
<OrganizationTeamsList
teams={mockData}
itemCount={7}
queryParams={{
page: 1,
page_size: 5,
order_by: 'name',
}}
/>, { context: { router: { history } } }
);
const toolbar = wrapper.find('DataListToolbar');
@@ -78,20 +68,16 @@ describe('<OrganizationTeamsList />', () => {
const history = createMemoryHistory({
initialEntries: ['/organizations/1/teams'],
});
const wrapper = mount(
<Router history={history}>
<I18nProvider>
<OrganizationTeamsList
teams={mockData}
itemCount={7}
queryParams={{
page: 1,
page_size: 5,
order_by: 'name',
}}
/>
</I18nProvider>
</Router>
const wrapper = mountWithContexts(
<OrganizationTeamsList
teams={mockData}
itemCount={7}
queryParams={{
page: 1,
page_size: 5,
order_by: 'name',
}}
/>, { context: { router: { history } } }
);
const pagination = wrapper.find('Pagination');