diff --git a/src/App.jsx b/src/App.jsx
index afc27ff70a..1e1053d982 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -48,7 +48,7 @@ class App extends Component {
version: null,
isAboutModalOpen: false,
isNavOpen,
- configError: false,
+ hasConfigError: false,
};
this.handleLogout = this.handleLogout.bind(this);
@@ -81,7 +81,7 @@ class App extends Component {
}
handleConfigErrorClose () {
- this.setState({ configError: false });
+ this.setState({ hasConfigError: false });
}
async loadConfig () {
@@ -92,7 +92,7 @@ class App extends Component {
this.setState({ ansible_version, custom_virtualenvs, version, me });
} catch (err) {
- this.setState({ configError: true });
+ this.setState({ hasConfigError: true });
}
}
@@ -104,7 +104,7 @@ class App extends Component {
isNavOpen,
me,
version,
- configError,
+ hasConfigError,
} = this.state;
const {
i18n,
@@ -170,7 +170,7 @@ class App extends Component {
onClose={this.handleAboutClose}
/>
', () => {
diff --git a/src/screens/AuthSetting/AuthSettings.test.jsx b/src/screens/AuthSetting/AuthSettings.test.jsx
index f19ac23575..93aa0a8aa6 100644
--- a/src/screens/AuthSetting/AuthSettings.test.jsx
+++ b/src/screens/AuthSetting/AuthSettings.test.jsx
@@ -1,5 +1,7 @@
import React from 'react';
-import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
+
+import { mountWithContexts } from '@testUtils/enzymeHelpers';
+
import AuthSettings from './AuthSettings';
describe('', () => {
diff --git a/src/screens/Credential/Credentials.test.jsx b/src/screens/Credential/Credentials.test.jsx
index 73c4dfc588..5e65514281 100644
--- a/src/screens/Credential/Credentials.test.jsx
+++ b/src/screens/Credential/Credentials.test.jsx
@@ -1,5 +1,7 @@
import React from 'react';
-import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
+
+import { mountWithContexts } from '@testUtils/enzymeHelpers';
+
import Credentials from './Credentials';
describe('', () => {
diff --git a/src/screens/CredentialType/CredentialTypes.test.jsx b/src/screens/CredentialType/CredentialTypes.test.jsx
index 9fc3eaeb19..9ef45e3709 100644
--- a/src/screens/CredentialType/CredentialTypes.test.jsx
+++ b/src/screens/CredentialType/CredentialTypes.test.jsx
@@ -1,5 +1,7 @@
import React from 'react';
-import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
+
+import { mountWithContexts } from '@testUtils/enzymeHelpers';
+
import CredentialTypes from './CredentialTypes';
describe('', () => {
diff --git a/src/screens/Dashboard/Dashboard.test.jsx b/src/screens/Dashboard/Dashboard.test.jsx
index b11c727cf5..6a8562dabe 100644
--- a/src/screens/Dashboard/Dashboard.test.jsx
+++ b/src/screens/Dashboard/Dashboard.test.jsx
@@ -1,5 +1,7 @@
import React from 'react';
-import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
+
+import { mountWithContexts } from '@testUtils/enzymeHelpers';
+
import Dashboard from './Dashboard';
describe('', () => {
diff --git a/src/screens/InstanceGroup/InstanceGroups.test.jsx b/src/screens/InstanceGroup/InstanceGroups.test.jsx
index a66a63aaa9..8e924033cb 100644
--- a/src/screens/InstanceGroup/InstanceGroups.test.jsx
+++ b/src/screens/InstanceGroup/InstanceGroups.test.jsx
@@ -1,5 +1,7 @@
import React from 'react';
-import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
+
+import { mountWithContexts } from '@testUtils/enzymeHelpers';
+
import InstanceGroups from './InstanceGroups';
describe('', () => {
diff --git a/src/screens/Inventory/Inventories.test.jsx b/src/screens/Inventory/Inventories.test.jsx
index 1e41d3b70f..24ca2c1db8 100644
--- a/src/screens/Inventory/Inventories.test.jsx
+++ b/src/screens/Inventory/Inventories.test.jsx
@@ -1,5 +1,7 @@
import React from 'react';
-import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
+
+import { mountWithContexts } from '@testUtils/enzymeHelpers';
+
import Inventories from './Inventories';
describe('', () => {
diff --git a/src/screens/InventoryScript/InventoryScripts.test.jsx b/src/screens/InventoryScript/InventoryScripts.test.jsx
index 33c05957e0..cfce2e3d45 100644
--- a/src/screens/InventoryScript/InventoryScripts.test.jsx
+++ b/src/screens/InventoryScript/InventoryScripts.test.jsx
@@ -1,5 +1,7 @@
import React from 'react';
-import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
+
+import { mountWithContexts } from '@testUtils/enzymeHelpers';
+
import InventoryScripts from './InventoryScripts';
describe('', () => {
diff --git a/src/screens/Job/JobList/JobList.jsx b/src/screens/Job/JobList/JobList.jsx
index ed581b6057..07736823a6 100644
--- a/src/screens/Job/JobList/JobList.jsx
+++ b/src/screens/Job/JobList/JobList.jsx
@@ -32,7 +32,7 @@ class JobList extends Component {
this.state = {
hasContentLoading: true,
hasContentError: false,
- deletionError: false,
+ hasDeletionError: false,
selected: [],
jobs: [],
itemCount: 0,
@@ -56,7 +56,7 @@ class JobList extends Component {
}
handleDeleteErrorClose () {
- this.setState({ deletionError: false });
+ this.setState({ hasDeletionError: false });
}
handleSelectAll (isSelected) {
@@ -76,11 +76,11 @@ class JobList extends Component {
async handleDelete () {
const { selected } = this.state;
- this.setState({ hasContentLoading: true, deletionError: false });
+ this.setState({ hasContentLoading: true, hasDeletionError: false });
try {
await Promise.all(selected.map(({ id }) => UnifiedJobsAPI.destroy(id)));
} catch (err) {
- this.setState({ deletionError: true });
+ this.setState({ hasDeletionError: true });
} finally {
await this.loadJobs();
}
@@ -109,7 +109,7 @@ class JobList extends Component {
const {
hasContentError,
hasContentLoading,
- deletionError,
+ hasDeletionError,
jobs,
itemCount,
selected,
@@ -166,7 +166,7 @@ class JobList extends Component {
/>
', () => {
diff --git a/src/screens/License/License.test.jsx b/src/screens/License/License.test.jsx
index 176571d073..393d8dda6d 100644
--- a/src/screens/License/License.test.jsx
+++ b/src/screens/License/License.test.jsx
@@ -1,5 +1,7 @@
import React from 'react';
-import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
+
+import { mountWithContexts } from '@testUtils/enzymeHelpers';
+
import License from './License';
describe('', () => {
diff --git a/src/screens/Login/Login.jsx b/src/screens/Login/Login.jsx
index f6a4843846..2d47a8fc7c 100644
--- a/src/screens/Login/Login.jsx
+++ b/src/screens/Login/Login.jsx
@@ -25,8 +25,8 @@ class AWXLogin extends Component {
this.state = {
username: '',
password: '',
- authenticationError: false,
- validationError: false,
+ hasAuthError: false,
+ hasValidationError: false,
isAuthenticating: false,
isLoading: true,
logo: null,
@@ -66,16 +66,16 @@ class AWXLogin extends Component {
return;
}
- this.setState({ authenticationError: false, isAuthenticating: true });
+ this.setState({ hasAuthError: false, isAuthenticating: true });
try {
// note: if authentication is successful, the appropriate cookie will be set automatically
// and isAuthenticated() (the source of truth) will start returning true.
await RootAPI.login(username, password);
} catch (err) {
if (err && err.response && err.response.status === 401) {
- this.setState({ validationError: true });
+ this.setState({ hasValidationError: true });
} else {
- this.setState({ authenticationError: true });
+ this.setState({ hasAuthError: true });
}
} finally {
this.setState({ isAuthenticating: false });
@@ -83,17 +83,17 @@ class AWXLogin extends Component {
}
handleChangeUsername (value) {
- this.setState({ username: value, validationError: false });
+ this.setState({ username: value, hasValidationError: false });
}
handleChangePassword (value) {
- this.setState({ password: value, validationError: false });
+ this.setState({ password: value, hasValidationError: false });
}
render () {
const {
- authenticationError,
- validationError,
+ hasAuthError,
+ hasValidationError,
username,
password,
isLoading,
@@ -115,7 +115,7 @@ class AWXLogin extends Component {
}
let helperText;
- if (validationError) {
+ if (hasValidationError) {
helperText = i18n._(t`Invalid username or password. Please try again.`);
} else {
helperText = i18n._(t`There was a problem signing in. Please try again.`);
@@ -129,15 +129,15 @@ class AWXLogin extends Component {
textContent={loginInfo}
>
', () => {
async function findChildren (wrapper) {
@@ -60,7 +62,7 @@ describe('', () => {
} = await findChildren(loginWrapper);
expect(usernameInput.props().value).toBe('');
expect(passwordInput.props().value).toBe('');
- expect(awxLogin.state('validationError')).toBe(false);
+ expect(awxLogin.state('hasValidationError')).toBe(false);
expect(submitButton.props().isDisabled).toBe(false);
done();
});
@@ -126,14 +128,14 @@ describe('', () => {
submitButton.simulate('click');
await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('username') === 'invalid');
await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('password') === 'invalid');
- await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('validationError') === true);
+ await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('hasValidationError') === true);
await waitForElement(loginWrapper, formError, (el) => el.length === 1);
usernameInput.props().onChange({ currentTarget: { value: 'dsarif' } });
passwordInput.props().onChange({ currentTarget: { value: 'freneticpny' } });
await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('username') === 'dsarif');
await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('password') === 'freneticpny');
- await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('validationError') === false);
+ await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('hasValidationError') === false);
await waitForElement(loginWrapper, formError, (el) => el.length === 0);
done();
@@ -151,16 +153,16 @@ describe('', () => {
RootAPI.login.mockRejectedValueOnce({ response: { status: 500 } });
submitButton.simulate('click');
- await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('authenticationError') === true);
+ await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('hasAuthError') === true);
usernameInput.props().onChange({ currentTarget: { value: 'sgrimes' } });
passwordInput.props().onChange({ currentTarget: { value: 'ovid' } });
await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('username') === 'sgrimes');
await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('password') === 'ovid');
- await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('authenticationError') === true);
+ await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('hasAuthError') === true);
submitButton.simulate('click');
- await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('authenticationError') === false);
+ await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('hasAuthError') === false);
done();
});
diff --git a/src/screens/ManagementJob/ManagementJobs.test.jsx b/src/screens/ManagementJob/ManagementJobs.test.jsx
index 5e1962dda4..125fc10fac 100644
--- a/src/screens/ManagementJob/ManagementJobs.test.jsx
+++ b/src/screens/ManagementJob/ManagementJobs.test.jsx
@@ -1,5 +1,7 @@
import React from 'react';
-import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
+
+import { mountWithContexts } from '@testUtils/enzymeHelpers';
+
import ManagementJobs from './ManagementJobs';
describe('', () => {
diff --git a/src/screens/NotificationTemplate/NotifcationTemplates.test.jsx b/src/screens/NotificationTemplate/NotifcationTemplates.test.jsx
index de4a4d494f..88ff84bc3f 100644
--- a/src/screens/NotificationTemplate/NotifcationTemplates.test.jsx
+++ b/src/screens/NotificationTemplate/NotifcationTemplates.test.jsx
@@ -1,5 +1,7 @@
import React from 'react';
-import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
+
+import { mountWithContexts } from '@testUtils/enzymeHelpers';
+
import NotificationTemplates from './NotificationTemplates';
describe('', () => {
diff --git a/src/screens/Organization/OrganizationEdit/OrganizationEdit.test.jsx b/src/screens/Organization/OrganizationEdit/OrganizationEdit.test.jsx
index 2277cd601b..c635652c99 100644
--- a/src/screens/Organization/OrganizationEdit/OrganizationEdit.test.jsx
+++ b/src/screens/Organization/OrganizationEdit/OrganizationEdit.test.jsx
@@ -10,8 +10,6 @@ jest.mock('@api');
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
describe('', () => {
- let api;
-
const mockData = {
name: 'Foo',
description: 'Bar',
@@ -22,23 +20,8 @@ describe('', () => {
}
};
- beforeEach(() => {
- api = {
- getInstanceGroups: jest.fn(),
- updateOrganizationDetails: jest.fn(),
- associateInstanceGroup: jest.fn(),
- disassociate: jest.fn(),
- };
- });
-
test('handleSubmit should call api update', () => {
- const wrapper = mountWithContexts(
- , { context: { network: {
- api,
- } } }
- );
+ const wrapper = mountWithContexts();
const updatedOrgData = {
name: 'new name',
@@ -51,13 +34,7 @@ describe('', () => {
});
test('handleSubmit associates and disassociates instance groups', async () => {
- const wrapper = mountWithContexts(
- , { context: { network: {
- api,
- } } }
- );
+ const wrapper = mountWithContexts();
const updatedOrgData = {
name: 'new name',
@@ -77,14 +54,8 @@ describe('', () => {
push: jest.fn(),
};
const wrapper = mountWithContexts(
- , { context: {
- network: {
- api: { api },
- },
- router: { history }
- } }
+ ,
+ { context: { router: { history } } }
);
expect(history.push).not.toHaveBeenCalled();
diff --git a/src/screens/Portal/Portal.test.jsx b/src/screens/Portal/Portal.test.jsx
index 0ad075812b..b0f16f2642 100644
--- a/src/screens/Portal/Portal.test.jsx
+++ b/src/screens/Portal/Portal.test.jsx
@@ -1,5 +1,7 @@
import React from 'react';
-import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
+
+import { mountWithContexts } from '@testUtils/enzymeHelpers';
+
import Portal from './Portal';
describe('', () => {
diff --git a/src/screens/Project/Projects.test.jsx b/src/screens/Project/Projects.test.jsx
index 7f19cb4016..bfc3ed03ed 100644
--- a/src/screens/Project/Projects.test.jsx
+++ b/src/screens/Project/Projects.test.jsx
@@ -1,5 +1,7 @@
import React from 'react';
-import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
+
+import { mountWithContexts } from '@testUtils/enzymeHelpers';
+
import Projects from './Projects';
describe('', () => {
diff --git a/src/screens/Schedule/Schedules.test.jsx b/src/screens/Schedule/Schedules.test.jsx
index aebcc8a192..11e11d8c40 100644
--- a/src/screens/Schedule/Schedules.test.jsx
+++ b/src/screens/Schedule/Schedules.test.jsx
@@ -1,5 +1,7 @@
import React from 'react';
-import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
+
+import { mountWithContexts } from '@testUtils/enzymeHelpers';
+
import Schedules from './Schedules';
describe('', () => {
diff --git a/src/screens/SystemSetting/SystemSettings.test.jsx b/src/screens/SystemSetting/SystemSettings.test.jsx
index 52e559d0e5..acdff2e0f6 100644
--- a/src/screens/SystemSetting/SystemSettings.test.jsx
+++ b/src/screens/SystemSetting/SystemSettings.test.jsx
@@ -1,5 +1,7 @@
import React from 'react';
-import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
+
+import { mountWithContexts } from '@testUtils/enzymeHelpers';
+
import SystemSettings from './SystemSettings';
describe('', () => {
diff --git a/src/screens/Team/Teams.test.jsx b/src/screens/Team/Teams.test.jsx
index c845ad599a..5edb1fece6 100644
--- a/src/screens/Team/Teams.test.jsx
+++ b/src/screens/Team/Teams.test.jsx
@@ -1,5 +1,7 @@
import React from 'react';
-import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
+
+import { mountWithContexts } from '@testUtils/enzymeHelpers';
+
import Teams from './Teams';
describe('', () => {
diff --git a/src/screens/UISetting/UISettings.test.jsx b/src/screens/UISetting/UISettings.test.jsx
index 1d209bb1d4..b9459c50f0 100644
--- a/src/screens/UISetting/UISettings.test.jsx
+++ b/src/screens/UISetting/UISettings.test.jsx
@@ -1,5 +1,7 @@
import React from 'react';
-import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
+
+import { mountWithContexts } from '@testUtils/enzymeHelpers';
+
import UISettings from './UISettings';
describe('', () => {
diff --git a/src/screens/User/Users.test.jsx b/src/screens/User/Users.test.jsx
index cf714b7774..aed28f73dd 100644
--- a/src/screens/User/Users.test.jsx
+++ b/src/screens/User/Users.test.jsx
@@ -1,5 +1,7 @@
import React from 'react';
-import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
+
+import { mountWithContexts } from '@testUtils/enzymeHelpers';
+
import Users from './Users';
describe('', () => {