mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
Reorganize file locations/directory structure (#270)
Reorganize file locations
This commit is contained in:
parent
e3cb8d0447
commit
ee56e9ccfb
@ -124,7 +124,7 @@ API requests can and will fail occasionally so they should include explicit erro
|
||||
|
||||
### App structure
|
||||
|
||||
All source code lives in the `/src` directory and all tests live in the `/__tests__` directory (mimicing the internal structure of `/src`).
|
||||
All source code lives in the `/src` directory and all tests live in the `/testUtils` directory (mimicing the internal structure of `/src`).
|
||||
|
||||
Inside these folders, the internal structure is:
|
||||
- **/components** - All generic components that are meant to be used in multiple contexts throughout awx. Things like buttons, tabs go here.
|
||||
@ -251,7 +251,7 @@ this.state = {
|
||||
|
||||
### Testing components that use contexts
|
||||
|
||||
We have several React contexts that wrap much of the app, including those from react-router, lingui, and some of our own. When testing a component that depends on one or more of these, you can use the `mountWithContexts()` helper function found in `__tests__/enzymeHelpers.jsx`. This can be used just like Enzyme's `mount()` function, except it will wrap the component tree with the necessary context providers and basic stub data.
|
||||
We have several React contexts that wrap much of the app, including those from react-router, lingui, and some of our own. When testing a component that depends on one or more of these, you can use the `mountWithContexts()` helper function found in `testUtils/enzymeHelpers.jsx`. This can be used just like Enzyme's `mount()` function, except it will wrap the component tree with the necessary context providers and basic stub data.
|
||||
|
||||
If you want to stub the value of a context, or assert actions taken on it, you can customize a contexts value by passing a second parameter to `mountWithContexts`. For example, this provides a custom value for the `Config` context:
|
||||
|
||||
|
||||
@ -24,6 +24,6 @@ To run the unit tests on files that you've changed:
|
||||
* `npm test`
|
||||
|
||||
To run a single test (in this case the login page test):
|
||||
* `npm test -- __tests__/pages/Login.test.jsx`
|
||||
* `npm test -- testUtils/pages/Login.test.jsx`
|
||||
|
||||
**note:** Once the test watcher is up and running you can hit `a` to run all the tests
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
import React from 'react';
|
||||
import { mountWithContexts } from '../../enzymeHelpers';
|
||||
import Templates from '../../../src/pages/Templates/Templates';
|
||||
|
||||
describe('<Templates />', () => {
|
||||
test('initially renders succesfully', () => {
|
||||
mountWithContexts(
|
||||
<Templates />
|
||||
);
|
||||
});
|
||||
});
|
||||
@ -3,7 +3,8 @@ module.exports = {
|
||||
'src/**/*.{js,jsx}'
|
||||
],
|
||||
coveragePathIgnorePatterns: [
|
||||
'<rootDir>/src/locales'
|
||||
'<rootDir>/src/locales',
|
||||
'index.js'
|
||||
],
|
||||
moduleNameMapper: {
|
||||
'\\.(css|scss|less)$': '<rootDir>/__mocks__/styleMock.js'
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import React from 'react';
|
||||
|
||||
import { mountWithContexts, waitForElement } from './enzymeHelpers';
|
||||
import { mountWithContexts, waitForElement } from '../testUtils/enzymeHelpers';
|
||||
import { asyncFlush } from '../jest.setup';
|
||||
|
||||
import App from '../src/App';
|
||||
import { ConfigAPI, MeAPI, RootAPI } from '../src/api';
|
||||
import App from './App';
|
||||
import { ConfigAPI, MeAPI, RootAPI } from './api';
|
||||
|
||||
jest.mock('../src/api');
|
||||
jest.mock('./api');
|
||||
|
||||
describe('<App />', () => {
|
||||
const ansible_version = '111';
|
||||
@ -1,4 +1,4 @@
|
||||
import { getLanguage } from '../src/RootProvider';
|
||||
import { getLanguage } from './RootProvider';
|
||||
|
||||
describe('RootProvider.jsx', () => {
|
||||
test('getLanguage returns the expected language code', () => {
|
||||
@ -1,4 +1,4 @@
|
||||
import Base from '../../src/api/Base';
|
||||
import Base from './Base';
|
||||
|
||||
describe('Base', () => {
|
||||
const createPromise = () => Promise.resolve();
|
||||
@ -1,5 +1,5 @@
|
||||
import Organizations from '../../src/api/models/Organizations';
|
||||
import { describeNotificationMixin } from './reusable';
|
||||
import Organizations from './Organizations';
|
||||
import { describeNotificationMixin } from '../../../testUtils/apiReusable';
|
||||
|
||||
describe('OrganizationsAPI', () => {
|
||||
const orgId = 1;
|
||||
@ -1,4 +1,4 @@
|
||||
import Root from '../../src/api/models/Root';
|
||||
import Root from './Root';
|
||||
|
||||
describe('RootAPI', () => {
|
||||
const createPromise = () => Promise.resolve();
|
||||
@ -1,4 +1,4 @@
|
||||
import Teams from '../../src/api/models/Teams';
|
||||
import Teams from './Teams';
|
||||
|
||||
describe('TeamsAPI', () => {
|
||||
const teamId = 1;
|
||||
@ -1,4 +1,4 @@
|
||||
import Users from '../../src/api/models/Users';
|
||||
import Users from './Users';
|
||||
|
||||
describe('UsersAPI', () => {
|
||||
const userId = 1;
|
||||
@ -9,8 +9,8 @@ import {
|
||||
TextListItem
|
||||
} from '@patternfly/react-core';
|
||||
|
||||
import { BrandName } from '../variables';
|
||||
import brandLogoImg from '../../images/brand-logo.svg';
|
||||
import { BrandName } from '../../variables';
|
||||
import brandLogoImg from '../../../images/brand-logo.svg';
|
||||
|
||||
class About extends React.Component {
|
||||
static createSpeechBubble (version) {
|
||||
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { mountWithContexts } from '../enzymeHelpers';
|
||||
import About from '../../src/components/About';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
import About from './About';
|
||||
|
||||
describe('<About />', () => {
|
||||
let aboutWrapper;
|
||||
1
src/components/About/index.js
Normal file
1
src/components/About/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './About';
|
||||
@ -1,10 +1,11 @@
|
||||
/* eslint-disable react/jsx-pascal-case */
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { mountWithContexts } from '../enzymeHelpers';
|
||||
import AddResourceRole, { _AddResourceRole } from '../../src/components/AddRole/AddResourceRole';
|
||||
import { TeamsAPI, UsersAPI } from '../../src/api';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
import AddResourceRole, { _AddResourceRole } from './AddResourceRole';
|
||||
import { TeamsAPI, UsersAPI } from '../../api';
|
||||
|
||||
jest.mock('../../src/api');
|
||||
jest.mock('../../api');
|
||||
|
||||
describe('<_AddResourceRole />', () => {
|
||||
UsersAPI.read.mockResolvedValue({
|
||||
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import CheckboxCard from '../../src/components/AddRole/CheckboxCard';
|
||||
import CheckboxCard from './CheckboxCard';
|
||||
|
||||
describe('<CheckboxCard />', () => {
|
||||
let wrapper;
|
||||
@ -5,7 +5,7 @@ import { withI18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
import PaginatedDataList from '../PaginatedDataList';
|
||||
import DataListToolbar from '../DataListToolbar';
|
||||
import CheckboxListItem from '../ListItem';
|
||||
import CheckboxListItem from '../CheckboxListItem';
|
||||
import SelectedList from '../SelectedList';
|
||||
import { getQSConfig, parseNamespacedQueryString } from '../../util/qs';
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import React from 'react';
|
||||
import { createMemoryHistory } from 'history';
|
||||
import { shallow } from 'enzyme';
|
||||
import { mountWithContexts } from '../enzymeHelpers';
|
||||
import { sleep } from '../testUtils';
|
||||
import SelectResourceStep from '../../src/components/AddRole/SelectResourceStep';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
import { sleep } from '../../../testUtils/testUtils';
|
||||
import SelectResourceStep from './SelectResourceStep';
|
||||
|
||||
describe('<SelectResourceStep />', () => {
|
||||
const columns = [
|
||||
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { mountWithContexts } from '../enzymeHelpers';
|
||||
import SelectRoleStep from '../../src/components/AddRole/SelectRoleStep';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
import SelectRoleStep from './SelectRoleStep';
|
||||
|
||||
describe('<SelectRoleStep />', () => {
|
||||
let wrapper;
|
||||
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import SelectableCard from '../../src/components/AddRole/SelectableCard';
|
||||
import SelectableCard from './SelectableCard';
|
||||
|
||||
describe('<SelectableCard />', () => {
|
||||
let wrapper;
|
||||
5
src/components/AddRole/index.js
Normal file
5
src/components/AddRole/index.js
Normal file
@ -0,0 +1,5 @@
|
||||
export { default as AddResourceRole } from './AddResourceRole';
|
||||
export { default as CheckboxCard } from './CheckboxCard';
|
||||
export { default as SelectableCard } from './SelectableCard';
|
||||
export { default as SelectResourceStep } from './SelectResourceStep';
|
||||
export { default as SelectRoleStep } from './SelectRoleStep';
|
||||
13
src/components/AlertModal/AlertModal.test.jsx
Normal file
13
src/components/AlertModal/AlertModal.test.jsx
Normal file
@ -0,0 +1,13 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
|
||||
import AlertModal from './AlertModal';
|
||||
|
||||
describe('AlertModal', () => {
|
||||
test('renders the expected content', () => {
|
||||
const wrapper = mount(
|
||||
<AlertModal title="Danger!" />
|
||||
);
|
||||
expect(wrapper).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
1
src/components/AlertModal/index.js
Normal file
1
src/components/AlertModal/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './AlertModal';
|
||||
@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
import { mountWithContexts } from '../enzymeHelpers';
|
||||
import AnsibleSelect from '../../src/components/AnsibleSelect';
|
||||
import { _AnsibleSelect } from '../../src/components/AnsibleSelect/AnsibleSelect';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
import AnsibleSelect, { _AnsibleSelect } from './AnsibleSelect';
|
||||
|
||||
const label = 'test select';
|
||||
const mockData = ['/venv/baz/', '/venv/ansible/'];
|
||||
@ -1,3 +1 @@
|
||||
import AnsibleSelect from './AnsibleSelect';
|
||||
|
||||
export default AnsibleSelect;
|
||||
export { default } from './AnsibleSelect';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
|
||||
import Background from '../../src/components/Background';
|
||||
import Background from './Background';
|
||||
|
||||
describe('Background', () => {
|
||||
test('renders the expected content', () => {
|
||||
1
src/components/Background/index.js
Normal file
1
src/components/Background/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './Background';
|
||||
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { mountWithContexts } from '../enzymeHelpers';
|
||||
import BrandLogo from '../../src/components/BrandLogo';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
import BrandLogo from './BrandLogo';
|
||||
|
||||
let logoWrapper;
|
||||
let brandLogoElem;
|
||||
@ -1,3 +1 @@
|
||||
import BrandLogo from './BrandLogo';
|
||||
|
||||
export default BrandLogo;
|
||||
export { default } from './BrandLogo';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import Breadcrumbs from '../../src/components/Breadcrumbs/Breadcrumbs';
|
||||
import Breadcrumbs from './Breadcrumbs';
|
||||
|
||||
describe('<Breadcrumb />', () => {
|
||||
let breadcrumbWrapper;
|
||||
1
src/components/Breadcrumbs/index.js
Normal file
1
src/components/Breadcrumbs/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './Breadcrumbs';
|
||||
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { mountWithContexts } from '../enzymeHelpers';
|
||||
import CardCloseButton from '../../src/components/CardCloseButton';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
import CardCloseButton from './CardCloseButton';
|
||||
|
||||
describe('<CardCloseButton>', () => {
|
||||
test('should render close button', () => {
|
||||
1
src/components/CardCloseButton/index.js
Normal file
1
src/components/CardCloseButton/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './CardCloseButton';
|
||||
18
src/components/CheckboxListItem/CheckboxListItem.test.jsx
Normal file
18
src/components/CheckboxListItem/CheckboxListItem.test.jsx
Normal file
@ -0,0 +1,18 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
|
||||
import CheckboxListItem from './CheckboxListItem';
|
||||
|
||||
describe('CheckboxListItem', () => {
|
||||
test('renders the expected content', () => {
|
||||
const wrapper = mount(
|
||||
<CheckboxListItem
|
||||
itemId={1}
|
||||
name="Buzz"
|
||||
isSelected={false}
|
||||
onSelect={() => {}}
|
||||
/>
|
||||
);
|
||||
expect(wrapper).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
1
src/components/CheckboxListItem/index.js
Normal file
1
src/components/CheckboxListItem/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './CheckboxListItem';
|
||||
11
src/components/Chip/Chip.test.jsx
Normal file
11
src/components/Chip/Chip.test.jsx
Normal file
@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
|
||||
import Chip from './Chip';
|
||||
|
||||
describe('Chip', () => {
|
||||
test('renders the expected content', () => {
|
||||
const wrapper = mount(<Chip />);
|
||||
expect(wrapper).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
import { mountWithContexts } from '../../enzymeHelpers';
|
||||
import { ChipGroup, Chip } from '../../../src/components/Chip';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
import { ChipGroup, Chip } from '.';
|
||||
|
||||
describe('<ChipGroup />', () => {
|
||||
test('should render all chips', () => {
|
||||
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import { Formik } from 'formik';
|
||||
import { sleep } from '../../../__tests__/testUtils';
|
||||
import { sleep } from '../../../testUtils/testUtils';
|
||||
import VariablesField from './VariablesField';
|
||||
|
||||
describe('VariablesField', () => {
|
||||
|
||||
11
src/components/ContentEmpty/ContentEmpty.test.jsx
Normal file
11
src/components/ContentEmpty/ContentEmpty.test.jsx
Normal file
@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
|
||||
import ContentEmpty from './ContentEmpty';
|
||||
|
||||
describe('ContentEmpty', () => {
|
||||
test('renders the expected content', () => {
|
||||
const wrapper = mountWithContexts(<ContentEmpty />);
|
||||
expect(wrapper).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
1
src/components/ContentEmpty/index.js
Normal file
1
src/components/ContentEmpty/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './ContentEmpty';
|
||||
11
src/components/ContentError/ContentError.test.jsx
Normal file
11
src/components/ContentError/ContentError.test.jsx
Normal file
@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
|
||||
import ContentError from './ContentError';
|
||||
|
||||
describe('ContentError', () => {
|
||||
test('renders the expected content', () => {
|
||||
const wrapper = mountWithContexts(<ContentError />);
|
||||
expect(wrapper).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
1
src/components/ContentError/index.js
Normal file
1
src/components/ContentError/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './ContentError';
|
||||
11
src/components/ContentLoading/ContentLoading.test.jsx
Normal file
11
src/components/ContentLoading/ContentLoading.test.jsx
Normal file
@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
|
||||
import ContentLoading from './ContentLoading';
|
||||
|
||||
describe('ContentLoading', () => {
|
||||
test('renders the expected content', () => {
|
||||
const wrapper = mountWithContexts(<ContentLoading />);
|
||||
expect(wrapper).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
1
src/components/ContentLoading/index.js
Normal file
1
src/components/ContentLoading/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './ContentLoading';
|
||||
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { mountWithContexts } from '../enzymeHelpers';
|
||||
import DataListToolbar from '../../src/components/DataListToolbar';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
import DataListToolbar from './DataListToolbar';
|
||||
|
||||
describe('<DataListToolbar />', () => {
|
||||
let toolbar;
|
||||
@ -1,3 +1 @@
|
||||
import DataListToolbar from './DataListToolbar';
|
||||
|
||||
export default DataListToolbar;
|
||||
export { default } from './DataListToolbar';
|
||||
|
||||
13
src/components/DetailList/Detail.test.jsx
Normal file
13
src/components/DetailList/Detail.test.jsx
Normal file
@ -0,0 +1,13 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
|
||||
import Detail from './Detail';
|
||||
|
||||
describe('Detail', () => {
|
||||
test('renders the expected content', () => {
|
||||
const wrapper = mount(
|
||||
<Detail label="foo" />
|
||||
);
|
||||
expect(wrapper).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
11
src/components/DetailList/DetailList.test.jsx
Normal file
11
src/components/DetailList/DetailList.test.jsx
Normal file
@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
|
||||
import DetailList from './DetailList';
|
||||
|
||||
describe('DetailList', () => {
|
||||
test('renders the expected content', () => {
|
||||
const wrapper = mount(<DetailList />);
|
||||
expect(wrapper).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { mountWithContexts } from '../enzymeHelpers';
|
||||
import ExpandCollapse from '../../src/components/ExpandCollapse';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
import ExpandCollapse from './ExpandCollapse';
|
||||
|
||||
describe('<ExpandCollapse />', () => {
|
||||
const onCompact = jest.fn();
|
||||
@ -1,3 +1 @@
|
||||
import ExpandCollapse from './ExpandCollapse';
|
||||
|
||||
export default ExpandCollapse;
|
||||
export { default } from './ExpandCollapse';
|
||||
|
||||
16
src/components/FormActionGroup/FormActionGroup.test.jsx
Normal file
16
src/components/FormActionGroup/FormActionGroup.test.jsx
Normal file
@ -0,0 +1,16 @@
|
||||
import React from 'react';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
|
||||
import FormActionGroup from './FormActionGroup';
|
||||
|
||||
describe('FormActionGroup', () => {
|
||||
test('renders the expected content', () => {
|
||||
const wrapper = mountWithContexts(
|
||||
<FormActionGroup
|
||||
onSubmit={() => {}}
|
||||
onCancel={() => {}}
|
||||
/>
|
||||
);
|
||||
expect(wrapper).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
1
src/components/FormActionGroup/index.js
Normal file
1
src/components/FormActionGroup/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './FormActionGroup';
|
||||
@ -11,7 +11,7 @@ function FormField (props) {
|
||||
name={name}
|
||||
validate={validate}
|
||||
render={({ field, form }) => {
|
||||
const isValid = !form.touched[field.name] || !form.errors[field.name];
|
||||
const isValid = form && (!form.touched[field.name] || !form.errors[field.name]);
|
||||
|
||||
return (
|
||||
<FormGroup
|
||||
1
src/components/FormField/index.js
Normal file
1
src/components/FormField/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './FormField';
|
||||
11
src/components/FormRow/FormRow.test.jsx
Normal file
11
src/components/FormRow/FormRow.test.jsx
Normal file
@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
|
||||
import FormRow from './FormRow';
|
||||
|
||||
describe('FormRow', () => {
|
||||
test('renders the expected content', () => {
|
||||
const wrapper = mount(<FormRow />);
|
||||
expect(wrapper).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
1
src/components/FormRow/index.js
Normal file
1
src/components/FormRow/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './FormRow';
|
||||
@ -1,3 +0,0 @@
|
||||
import CheckboxListItem from './CheckboxListItem';
|
||||
|
||||
export default CheckboxListItem;
|
||||
@ -13,7 +13,7 @@ import { t } from '@lingui/macro';
|
||||
|
||||
import PaginatedDataList from '../PaginatedDataList';
|
||||
import DataListToolbar from '../DataListToolbar';
|
||||
import CheckboxListItem from '../ListItem';
|
||||
import CheckboxListItem from '../CheckboxListItem';
|
||||
import SelectedList from '../SelectedList';
|
||||
import { ChipGroup, Chip } from '../Chip';
|
||||
import { getQSConfig, parseNamespacedQueryString } from '../../util/qs';
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
/* eslint-disable react/jsx-pascal-case */
|
||||
import React from 'react';
|
||||
import { createMemoryHistory } from 'history';
|
||||
import { mountWithContexts } from '../enzymeHelpers';
|
||||
import Lookup from '../../src/components/Lookup';
|
||||
import { _Lookup } from '../../src/components/Lookup/Lookup';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
import Lookup, { _Lookup } from './Lookup';
|
||||
|
||||
let mockData = [{ name: 'foo', id: 1, isChecked: false }];
|
||||
const mockColumns = [
|
||||
@ -1,3 +1 @@
|
||||
import Lookup from './Lookup';
|
||||
|
||||
export default Lookup;
|
||||
export { default } from './Lookup';
|
||||
|
||||
@ -3,7 +3,7 @@ import { MemoryRouter } from 'react-router-dom';
|
||||
import { mount } from 'enzyme';
|
||||
|
||||
import { Nav } from '@patternfly/react-core';
|
||||
import NavExpandableGroup from '../../src/components/NavExpandableGroup';
|
||||
import NavExpandableGroup from './NavExpandableGroup';
|
||||
|
||||
describe('NavExpandableGroup', () => {
|
||||
test('initialization and render', () => {
|
||||
1
src/components/NavExpandableGroup/index.js
Normal file
1
src/components/NavExpandableGroup/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './NavExpandableGroup';
|
||||
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { mountWithContexts } from '../enzymeHelpers';
|
||||
import NotificationListItem from '../../src/components/NotificationsList/NotificationListItem';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
import NotificationListItem from './NotificationListItem';
|
||||
|
||||
describe('<NotificationListItem canToggleNotifications />', () => {
|
||||
let wrapper;
|
||||
1
src/components/NotificationsList/index.js
Normal file
1
src/components/NotificationsList/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './NotificationListItem';
|
||||
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { mountWithContexts } from '../enzymeHelpers';
|
||||
import PageHeaderToolbar from '../../src/components/PageHeaderToolbar';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
import PageHeaderToolbar from './PageHeaderToolbar';
|
||||
|
||||
describe('PageHeaderToolbar', () => {
|
||||
const pageHelpDropdownSelector = 'Dropdown QuestionCircleIcon';
|
||||
1
src/components/PageHeaderToolbar/index.js
Normal file
1
src/components/PageHeaderToolbar/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './PageHeaderToolbar';
|
||||
@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import { createMemoryHistory } from 'history';
|
||||
import { mountWithContexts } from '../../enzymeHelpers';
|
||||
import { sleep } from '../../testUtils';
|
||||
import PaginatedDataList from '../../../src/components/PaginatedDataList';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
import { sleep } from '../../../testUtils/testUtils';
|
||||
import PaginatedDataList from './PaginatedDataList';
|
||||
|
||||
const mockData = [
|
||||
{ id: 1, name: 'one', url: '/org/team/1' },
|
||||
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { mountWithContexts } from '../../enzymeHelpers';
|
||||
import { ToolbarAddButton } from '../../../src/components/PaginatedDataList';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
import ToolbarAddButton from './ToolbarAddButton';
|
||||
|
||||
describe('<ToolbarAddButton />', () => {
|
||||
test('should render button', () => {
|
||||
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { mountWithContexts } from '../../enzymeHelpers';
|
||||
import { ToolbarDeleteButton } from '../../../src/components/PaginatedDataList';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
import ToolbarDeleteButton from './ToolbarDeleteButton';
|
||||
|
||||
const itemA = {
|
||||
id: 1,
|
||||
@ -1,6 +1,4 @@
|
||||
import PaginatedDataList from './PaginatedDataList';
|
||||
|
||||
export default PaginatedDataList;
|
||||
export { default } from './PaginatedDataList';
|
||||
export { default as PaginatedDataListItem } from './PaginatedDataListItem';
|
||||
export { default as ToolbarDeleteButton } from './ToolbarDeleteButton';
|
||||
export { default as ToolbarAddButton } from './ToolbarAddButton';
|
||||
|
||||
16
src/components/Pagination/Pagination.test.jsx
Normal file
16
src/components/Pagination/Pagination.test.jsx
Normal file
@ -0,0 +1,16 @@
|
||||
import React from 'react';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
|
||||
import Pagination from './Pagination';
|
||||
|
||||
describe('Pagination', () => {
|
||||
test('renders the expected content', () => {
|
||||
const wrapper = mountWithContexts(
|
||||
<Pagination
|
||||
itemCount={0}
|
||||
max={9000}
|
||||
/>
|
||||
);
|
||||
expect(wrapper).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
@ -1,3 +1 @@
|
||||
import Pagination from './Pagination';
|
||||
|
||||
export default Pagination;
|
||||
export { default } from './Pagination';
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
/* eslint-disable react/jsx-pascal-case */
|
||||
import React from 'react';
|
||||
import { mount, shallow } from 'enzyme';
|
||||
import { Router } from 'react-router-dom';
|
||||
import { createMemoryHistory } from 'history';
|
||||
import { Tab } from '@patternfly/react-core';
|
||||
import RoutedTabs, { _RoutedTabs } from '../../src/components/Tabs/RoutedTabs';
|
||||
import RoutedTabs, { _RoutedTabs } from './RoutedTabs';
|
||||
|
||||
let wrapper;
|
||||
let history;
|
||||
1
src/components/RoutedTabs/index.js
Normal file
1
src/components/RoutedTabs/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './RoutedTabs';
|
||||
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { mountWithContexts } from '../enzymeHelpers';
|
||||
import Search from '../../src/components/Search';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
import Search from './Search';
|
||||
|
||||
describe('<Search />', () => {
|
||||
let search;
|
||||
@ -1,3 +1 @@
|
||||
import Search from './Search';
|
||||
|
||||
export default Search;
|
||||
export { default } from './Search';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import SelectedList from '../../src/components/SelectedList';
|
||||
import { ChipGroup } from '../../src/components/Chip';
|
||||
import { ChipGroup } from '../Chip';
|
||||
import SelectedList from './SelectedList';
|
||||
|
||||
describe('<SelectedList />', () => {
|
||||
test('initially renders succesfully', () => {
|
||||
@ -16,7 +16,7 @@ describe('<SelectedList />', () => {
|
||||
];
|
||||
mount(
|
||||
<SelectedList
|
||||
label="Selected"
|
||||
label="Selectedeeee"
|
||||
selected={mockSelected}
|
||||
showOverflowAfter={5}
|
||||
onRemove={() => {}}
|
||||
@ -1,3 +1 @@
|
||||
import SelectedList from './SelectedList';
|
||||
|
||||
export default SelectedList;
|
||||
export { default } from './SelectedList';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { mountWithContexts } from '../enzymeHelpers';
|
||||
import Sort from '../../src/components/Sort';
|
||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||
import Sort from './Sort';
|
||||
|
||||
describe('<Sort />', () => {
|
||||
let sort;
|
||||
@ -1,3 +1 @@
|
||||
import Sort from './Sort';
|
||||
|
||||
export default Sort;
|
||||
export { default } from './Sort';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
|
||||
import VerticalSeparator from '../../src/components/VerticalSeparator';
|
||||
import VerticalSeparator from './VerticalSeparator';
|
||||
|
||||
describe('VerticalSeparator', () => {
|
||||
test('renders the expected content', () => {
|
||||
@ -1,3 +1 @@
|
||||
import VerticalSeparator from './VerticalSeparator';
|
||||
|
||||
export default VerticalSeparator;
|
||||
export { default } from './VerticalSeparator';
|
||||
|
||||
@ -20,29 +20,29 @@ import App from './App';
|
||||
import { BrandName } from './variables';
|
||||
import { isAuthenticated } from './util/auth';
|
||||
|
||||
import Applications from './pages/Applications';
|
||||
import Credentials from './pages/Credentials';
|
||||
import CredentialTypes from './pages/CredentialTypes';
|
||||
import Dashboard from './pages/Dashboard';
|
||||
import InstanceGroups from './pages/InstanceGroups';
|
||||
import Inventories from './pages/Inventories';
|
||||
import InventoryScripts from './pages/InventoryScripts';
|
||||
import Jobs from './pages/Jobs';
|
||||
import Login from './pages/Login';
|
||||
import ManagementJobs from './pages/ManagementJobs';
|
||||
import NotificationTemplates from './pages/NotificationTemplates';
|
||||
import Organizations from './pages/Organizations/Organizations';
|
||||
import Portal from './pages/Portal';
|
||||
import Projects from './pages/Projects';
|
||||
import Schedules from './pages/Schedules';
|
||||
import AuthSettings from './pages/AuthSettings';
|
||||
import JobsSettings from './pages/JobsSettings';
|
||||
import SystemSettings from './pages/SystemSettings';
|
||||
import UISettings from './pages/UISettings';
|
||||
import License from './pages/License';
|
||||
import Teams from './pages/Teams';
|
||||
import Templates from './pages/Templates/Templates';
|
||||
import Users from './pages/Users';
|
||||
import Applications from './screens/Application';
|
||||
import Credentials from './screens/Credential';
|
||||
import CredentialTypes from './screens/CredentialType';
|
||||
import Dashboard from './screens/Dashboard';
|
||||
import InstanceGroups from './screens/InstanceGroup';
|
||||
import Inventories from './screens/Inventory';
|
||||
import InventoryScripts from './screens/InventoryScript';
|
||||
import { Jobs } from './screens/Job';
|
||||
import Login from './screens/Login';
|
||||
import ManagementJobs from './screens/ManagementJob';
|
||||
import NotificationTemplates from './screens/NotificationTemplate';
|
||||
import Organizations from './screens/Organization';
|
||||
import Portal from './screens/Portal';
|
||||
import Projects from './screens/Project';
|
||||
import Schedules from './screens/Schedule';
|
||||
import AuthSettings from './screens/AuthSetting';
|
||||
import JobsSettings from './screens/JobsSetting';
|
||||
import SystemSettings from './screens/SystemSetting';
|
||||
import UISettings from './screens/UISetting';
|
||||
import License from './screens/License';
|
||||
import Teams from './screens/Team';
|
||||
import Templates from './screens/Template';
|
||||
import Users from './screens/User';
|
||||
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export function main (render) {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { main } from '../src/index';
|
||||
import { main } from './index';
|
||||
|
||||
const render = template => mount(
|
||||
<MemoryRouter>
|
||||
@ -1,4 +0,0 @@
|
||||
import JobDetail from './JobDetail';
|
||||
|
||||
export default JobDetail;
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
import JobOutput from './JobOutput';
|
||||
|
||||
export default JobOutput;
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
export { default as Job } from './Job';
|
||||
export { default } from './Jobs';
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user