mirror of
https://github.com/ansible/awx.git
synced 2026-02-15 02:00:01 -03:30
fix linting issues
This commit is contained in:
@@ -7,8 +7,6 @@ import { asyncFlush } from '../jest.setup';
|
||||
|
||||
import App from '../src/App';
|
||||
|
||||
const DEFAULT_ACTIVE_GROUP = 'views_group';
|
||||
|
||||
describe('<App />', () => {
|
||||
test('expected content is rendered', () => {
|
||||
const appWrapper = mount(
|
||||
@@ -60,13 +58,13 @@ describe('<App />', () => {
|
||||
const ansible_version = '111';
|
||||
const version = '222';
|
||||
|
||||
const getConfig = jest.fn(() => Promise.resolve({ data: { ansible_version, version} }));
|
||||
const getConfig = jest.fn(() => Promise.resolve({ data: { ansible_version, version } }));
|
||||
const api = { getConfig };
|
||||
|
||||
const wrapper = mount(
|
||||
<MemoryRouter>
|
||||
<I18nProvider>
|
||||
<App api={api}/>
|
||||
<App api={api} />
|
||||
</I18nProvider>
|
||||
</MemoryRouter>
|
||||
);
|
||||
|
||||
@@ -105,7 +105,7 @@ describe('APIClient (api.js)', () => {
|
||||
const mockHttp = ({ post: jest.fn(createPromise) });
|
||||
|
||||
const api = new APIClient(mockHttp);
|
||||
const data = { name: 'test '};
|
||||
const data = { name: 'test ' };
|
||||
await api.createOrganization(data);
|
||||
|
||||
expect(mockHttp.post).toHaveBeenCalledTimes(1);
|
||||
|
||||
@@ -2,8 +2,8 @@ import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import AnsibleSelect from '../../src/components/AnsibleSelect';
|
||||
|
||||
const label = "test select"
|
||||
const mockData = ["/venv/baz/", "/venv/ansible/"];
|
||||
const label = 'test select';
|
||||
const mockData = ['/venv/baz/', '/venv/ansible/'];
|
||||
describe('<AnsibleSelect />', () => {
|
||||
test('initially renders succesfully', async () => {
|
||||
mount(
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
|
||||
import { I18nProvider } from '@lingui/react';
|
||||
import Background from '../../src/components/Background';
|
||||
|
||||
describe('Background', () => {
|
||||
test('renders the expected content', () => {
|
||||
const wrapper = mount(<Background><div id="test"/></Background>);
|
||||
expect(wrapper).toHaveLength(1);
|
||||
expect(wrapper.find('BackgroundImage')).toHaveLength(1);
|
||||
expect(wrapper.find('#test')).toHaveLength(1);
|
||||
const wrapper = mount(<Background><div id="test" /></Background>);
|
||||
expect(wrapper).toHaveLength(1);
|
||||
expect(wrapper.find('BackgroundImage')).toHaveLength(1);
|
||||
expect(wrapper.find('#test')).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ describe('<DataListToolbar />', () => {
|
||||
<I18nProvider>
|
||||
<DataListToolbar
|
||||
isAllSelected={false}
|
||||
showExpandCollapse={true}
|
||||
showExpandCollapse
|
||||
sortedColumnKey="name"
|
||||
sortOrder="ascending"
|
||||
columns={columns}
|
||||
@@ -94,10 +94,10 @@ describe('<DataListToolbar />', () => {
|
||||
sortDropdownToggle.at(1).simulate('click');
|
||||
sortDropdownToggle.at(0).simulate('click');
|
||||
toolbar.update();
|
||||
|
||||
|
||||
const sortDropdownItems = toolbar.find(sortDropdownItemsSelector);
|
||||
expect(sortDropdownItems.length).toBe(2);
|
||||
|
||||
|
||||
const mockedSortEvent = { target: { innerText: 'Bar' } };
|
||||
sortDropdownItems.at(0).simulate('click', mockedSortEvent);
|
||||
toolbar = mount(
|
||||
@@ -114,28 +114,28 @@ describe('<DataListToolbar />', () => {
|
||||
</I18nProvider>
|
||||
);
|
||||
toolbar.update();
|
||||
|
||||
|
||||
const sortDropdownToggleDescending = toolbar.find(sortDropdownToggleSelector);
|
||||
expect(sortDropdownToggleDescending.length).toBe(2);
|
||||
sortDropdownToggleDescending.at(1).simulate('click');
|
||||
sortDropdownToggleDescending.at(0).simulate('click');
|
||||
toolbar.update();
|
||||
|
||||
|
||||
const sortDropdownItemsDescending = toolbar.find(sortDropdownItemsSelector);
|
||||
expect(sortDropdownItemsDescending.length).toBe(2);
|
||||
|
||||
|
||||
const mockedSortEventDescending = { target: { innerText: 'Bar' } };
|
||||
sortDropdownItems.at(0).simulate('click', mockedSortEventDescending);
|
||||
toolbar.update();
|
||||
|
||||
|
||||
const searchDropdownToggle = toolbar.find(searchDropdownToggleSelector);
|
||||
expect(searchDropdownToggle.length).toBe(1);
|
||||
searchDropdownToggle.at(0).simulate('click');
|
||||
toolbar.update();
|
||||
|
||||
|
||||
const searchDropdownItems = toolbar.find(searchDropdownItemsSelector);
|
||||
expect(searchDropdownItems.length).toBe(3);
|
||||
|
||||
|
||||
const mockedSearchEvent = { target: { innerText: 'Bar' } };
|
||||
searchDropdownItems.at(0).simulate('click', mockedSearchEvent);
|
||||
});
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import Lookup from '../../src/components/Lookup';
|
||||
import { I18nProvider } from '@lingui/react';
|
||||
import Lookup from '../../src/components/Lookup';
|
||||
|
||||
const mockData = [{ name: 'foo', id: 0, isChecked: false }];
|
||||
let mockData = [{ name: 'foo', id: 0, isChecked: false }];
|
||||
describe('<Lookup />', () => {
|
||||
test('initially renders succesfully', () => {
|
||||
mount(
|
||||
@@ -46,7 +46,7 @@ describe('<Lookup />', () => {
|
||||
});
|
||||
test('calls "onRemove" when remove icon is clicked', () => {
|
||||
const spy = jest.spyOn(Lookup.prototype, 'onRemove');
|
||||
const mockData = [{ name: 'foo', id: 0, isChecked: false }, { name: 'bar', id: 1, isChecked: true }];
|
||||
mockData = [{ name: 'foo', id: 0, isChecked: false }, { name: 'bar', id: 1, isChecked: true }];
|
||||
const wrapper = mount(
|
||||
<I18nProvider>
|
||||
<Lookup
|
||||
@@ -61,7 +61,7 @@ describe('<Lookup />', () => {
|
||||
});
|
||||
test('"wrapTags" method properly handles data', () => {
|
||||
const spy = jest.spyOn(Lookup.prototype, 'wrapTags');
|
||||
const mockData = [{ name: 'foo', id: 0, isChecked: false }, { name: 'bar', id: 1, isChecked: false }];
|
||||
mockData = [{ name: 'foo', id: 0, isChecked: false }, { name: 'bar', id: 1, isChecked: false }];
|
||||
const wrapper = mount(
|
||||
<I18nProvider>
|
||||
<Lookup
|
||||
|
||||
@@ -10,7 +10,7 @@ describe('PageHeaderToolbar', () => {
|
||||
const pageUserDropdownSelector = 'Dropdown UserIcon';
|
||||
|
||||
test('expected content is rendered on initialization', () => {
|
||||
const wrapper = mount(<I18nProvider><PageHeaderToolbar/></I18nProvider>);
|
||||
const wrapper = mount(<I18nProvider><PageHeaderToolbar /></I18nProvider>);
|
||||
|
||||
expect(wrapper.find(pageHelpDropdownSelector)).toHaveLength(1);
|
||||
expect(wrapper.find(pageUserDropdownSelector)).toHaveLength(1);
|
||||
|
||||
@@ -162,7 +162,7 @@ describe('<Pagination />', () => {
|
||||
pageSizeOptions={[5, 10, 25, 50]}
|
||||
onSetPage={onSetPage}
|
||||
/>
|
||||
</I18nProvider>
|
||||
</I18nProvider>
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -57,7 +57,6 @@ describe('<TowerLogo />', () => {
|
||||
});
|
||||
|
||||
test('handles mouse over and out state.hover changes', () => {
|
||||
const onLogoClick = jest.fn();
|
||||
logoWrapper = mount(
|
||||
<MemoryRouter>
|
||||
<I18nProvider>
|
||||
|
||||
@@ -2,7 +2,7 @@ import { mount } from 'enzyme';
|
||||
import { main, getLanguage } from '../src/index';
|
||||
|
||||
const render = template => mount(template);
|
||||
const data = { custom_logo: 'foo', custom_login_info: '' }
|
||||
const data = { custom_logo: 'foo', custom_login_info: '' };
|
||||
|
||||
describe('index.jsx', () => {
|
||||
test('login loads when unauthenticated', async (done) => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import OrganizationAdd from '../../../../src/pages/Organizations/screens/OrganizationAdd'
|
||||
import OrganizationAdd from '../../../../src/pages/Organizations/screens/OrganizationAdd';
|
||||
|
||||
describe('<OrganizationAdd />', () => {
|
||||
test('initially renders succesfully', () => {
|
||||
@@ -69,7 +69,7 @@ describe('<OrganizationAdd />', () => {
|
||||
});
|
||||
test('API response is formatted properly', (done) => {
|
||||
const spy = jest.spyOn(OrganizationAdd.WrappedComponent.prototype, 'format');
|
||||
const mockedResp = {data: {id: 1, name: 'foo bar'} };
|
||||
const mockedResp = { data: { id: 1, name: 'foo bar' } };
|
||||
const api = { getInstanceGroups: jest.fn().mockResolvedValue(mockedResp) };
|
||||
mount(
|
||||
<MemoryRouter>
|
||||
@@ -86,7 +86,7 @@ describe('<OrganizationAdd />', () => {
|
||||
test('Successful form submission triggers redirect', (done) => {
|
||||
const onSuccess = jest.spyOn(OrganizationAdd.WrappedComponent.prototype, 'onSuccess');
|
||||
const resetForm = jest.spyOn(OrganizationAdd.WrappedComponent.prototype, 'resetForm');
|
||||
const mockedResp = {data: {id: 1, related: {instance_groups: '/bar'}}};
|
||||
const mockedResp = { data: { id: 1, related: { instance_groups: '/bar' } } };
|
||||
const api = { createOrganization: jest.fn().mockResolvedValue(mockedResp), createInstanceGroups: jest.fn().mockResolvedValue('done') };
|
||||
const wrapper = mount(
|
||||
<MemoryRouter>
|
||||
|
||||
@@ -8,11 +8,11 @@ describe('qs (qs.js)', () => {
|
||||
[{ order_by: 'name', page: 1, page_size: 5 }, 'order_by=name&page=1&page_size=5'],
|
||||
[{ '-order_by': 'name', page: '1', page_size: 5 }, '-order_by=name&page=1&page_size=5'],
|
||||
]
|
||||
.forEach(([params, expectedQueryString]) => {
|
||||
const actualQueryString = encodeQueryString(params);
|
||||
.forEach(([params, expectedQueryString]) => {
|
||||
const actualQueryString = encodeQueryString(params);
|
||||
|
||||
expect(actualQueryString).toEqual(expectedQueryString);
|
||||
});
|
||||
expect(actualQueryString).toEqual(expectedQueryString);
|
||||
});
|
||||
});
|
||||
|
||||
test('parseQueryString returns the expected queryParams', () => {
|
||||
@@ -20,10 +20,10 @@ describe('qs (qs.js)', () => {
|
||||
['order_by=name&page=1&page_size=5', ['page', 'page_size'], { order_by: 'name', page: 1, page_size: 5 }],
|
||||
['order_by=name&page=1&page_size=5', ['page_size'], { order_by: 'name', page: '1', page_size: 5 }],
|
||||
]
|
||||
.forEach(([queryString, integerFields, expectedQueryParams]) => {
|
||||
const actualQueryParams = parseQueryString(queryString, integerFields);
|
||||
.forEach(([queryString, integerFields, expectedQueryParams]) => {
|
||||
const actualQueryParams = parseQueryString(queryString, integerFields);
|
||||
|
||||
expect(actualQueryParams).toEqual(expectedQueryParams)
|
||||
});
|
||||
expect(actualQueryParams).toEqual(expectedQueryParams);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user