mirror of
https://github.com/ansible/awx.git
synced 2026-03-22 11:25:08 -02:30
Merge remote-tracking branch 'origin/add-org-new' into react-context-api
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { mount, shallow } from 'enzyme';
|
||||
import { I18nProvider } from '@lingui/react';
|
||||
import { asyncFlush } from '../../jest.setup';
|
||||
import AtLogin from '../../src/pages/Login';
|
||||
import api from '../../src/api';
|
||||
@@ -26,7 +27,13 @@ describe('<Login />', () => {
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
loginWrapper = mount(<MemoryRouter><AtLogin /></MemoryRouter>);
|
||||
loginWrapper = mount(
|
||||
<MemoryRouter>
|
||||
<I18nProvider>
|
||||
<AtLogin />
|
||||
</I18nProvider>
|
||||
</MemoryRouter>
|
||||
);
|
||||
findChildren();
|
||||
});
|
||||
|
||||
@@ -49,7 +56,13 @@ describe('<Login />', () => {
|
||||
});
|
||||
|
||||
test('custom logo renders Brand component with correct src and alt', () => {
|
||||
loginWrapper = mount(<MemoryRouter><AtLogin logo="images/foo.jpg" alt="Foo Application" /></MemoryRouter>);
|
||||
loginWrapper = mount(
|
||||
<MemoryRouter>
|
||||
<I18nProvider>
|
||||
<AtLogin logo="images/foo.jpg" alt="Foo Application" />
|
||||
</I18nProvider>
|
||||
</MemoryRouter>
|
||||
);
|
||||
findChildren();
|
||||
expect(loginHeaderLogo.length).toBe(1);
|
||||
expect(loginHeaderLogo.props().src).toBe('data:image/jpeg;images/foo.jpg');
|
||||
@@ -57,7 +70,13 @@ describe('<Login />', () => {
|
||||
});
|
||||
|
||||
test('default logo renders Brand component with correct src and alt', () => {
|
||||
loginWrapper = mount(<MemoryRouter><AtLogin /></MemoryRouter>);
|
||||
loginWrapper = mount(
|
||||
<MemoryRouter>
|
||||
<I18nProvider>
|
||||
<AtLogin />
|
||||
</I18nProvider>
|
||||
</MemoryRouter>
|
||||
);
|
||||
findChildren();
|
||||
expect(loginHeaderLogo.length).toBe(1);
|
||||
expect(loginHeaderLogo.props().src).toBe('tower-logo-header.svg');
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { I18nProvider } from '@lingui/react';
|
||||
import OrganizationDetail from '../../../../src/pages/Organizations/components/OrganizationDetail';
|
||||
|
||||
describe('<OrganizationDetail />', () => {
|
||||
test('initially renders succesfully', () => {
|
||||
mount(
|
||||
<MemoryRouter initialEntries={['/organizations/1']} initialIndex={0}>
|
||||
<OrganizationDetail
|
||||
match={{ path: '/organizations/:id', url: '/organizations/1' }}
|
||||
location={{ search: '', pathname: '/organizations/1' }}
|
||||
/>
|
||||
</MemoryRouter>
|
||||
<I18nProvider>
|
||||
<MemoryRouter initialEntries={['/organizations/1']} initialIndex={0}>
|
||||
<OrganizationDetail
|
||||
match={{ path: '/organizations/:id', url: '/organizations/1' }}
|
||||
location={{ search: '', pathname: '/organizations/1' }}
|
||||
/>
|
||||
</MemoryRouter>
|
||||
</I18nProvider>
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { I18nProvider } from '@lingui/react';
|
||||
import OrganizationListItem from '../../../../src/pages/Organizations/components/OrganizationListItem';
|
||||
|
||||
describe('<OrganizationListItem />', () => {
|
||||
test('initially renders succesfully', () => {
|
||||
mount(
|
||||
<MemoryRouter initialEntries={['/organizations']} initialIndex={0}>
|
||||
<OrganizationListItem />
|
||||
</MemoryRouter>
|
||||
<I18nProvider>
|
||||
<MemoryRouter initialEntries={['/organizations']} initialIndex={0}>
|
||||
<OrganizationListItem />
|
||||
</MemoryRouter>
|
||||
</I18nProvider>
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
import React from 'react';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { mount } from 'enzyme';
|
||||
import { I18nProvider } from '@lingui/react';
|
||||
import Organizations from '../../../src/pages/Organizations/index';
|
||||
|
||||
describe('<Organizations />', () => {
|
||||
test('initially renders succesfully', () => {
|
||||
mount(
|
||||
<MemoryRouter initialEntries={['/organizations']} initialIndex={0}>
|
||||
<Organizations
|
||||
match={{ path: '/organizations', url: '/organizations' }}
|
||||
location={{ search: '', pathname: '/organizations' }}
|
||||
/>
|
||||
<I18nProvider>
|
||||
<Organizations
|
||||
match={{ path: '/organizations', url: '/organizations' }}
|
||||
location={{ search: '', pathname: '/organizations' }}
|
||||
/>
|
||||
</I18nProvider>
|
||||
</MemoryRouter>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { I18nProvider } from '@lingui/react';
|
||||
import OrganizationView from '../../../../src/pages/Organizations/views/Organization.view';
|
||||
|
||||
describe('<OrganizationView />', () => {
|
||||
test('initially renders succesfully', () => {
|
||||
mount(
|
||||
<MemoryRouter initialEntries={['/organizations/1']} initialIndex={0}>
|
||||
<OrganizationView
|
||||
match={{ path: '/organizations/:id', url: '/organizations/1' }}
|
||||
location={{ search: '', pathname: '/organizations/1' }}
|
||||
/>
|
||||
</MemoryRouter>
|
||||
<I18nProvider>
|
||||
<MemoryRouter initialEntries={['/organizations/1']} initialIndex={0}>
|
||||
<OrganizationView
|
||||
match={{ path: '/organizations/:id', url: '/organizations/1' }}
|
||||
location={{ search: '', pathname: '/organizations/1' }}
|
||||
/>
|
||||
</MemoryRouter>
|
||||
</I18nProvider>
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { I18nProvider } from '@lingui/react';
|
||||
import OrganizationsList from '../../../../src/pages/Organizations/views/Organizations.list';
|
||||
|
||||
describe('<OrganizationsList />', () => {
|
||||
test('initially renders succesfully', () => {
|
||||
mount(
|
||||
<MemoryRouter initialEntries={['/organizations']} initialIndex={0}>
|
||||
<OrganizationsList
|
||||
match={{ path: '/organizations', url: '/organizations' }}
|
||||
location={{ search: '', pathname: '/organizations' }}
|
||||
/>
|
||||
<I18nProvider>
|
||||
<OrganizationsList
|
||||
match={{ path: '/organizations', url: '/organizations' }}
|
||||
location={{ search: '', pathname: '/organizations' }}
|
||||
/>
|
||||
</I18nProvider>
|
||||
</MemoryRouter>
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user