mirror of
https://github.com/ansible/awx.git
synced 2026-03-18 01:17:35 -02:30
Merge pull request #287 from jakemcdermott/more-big-pr-fixups
misc cleanup from big prs
This commit is contained in:
10
src/App.jsx
10
src/App.jsx
@@ -48,7 +48,7 @@ class App extends Component {
|
|||||||
version: null,
|
version: null,
|
||||||
isAboutModalOpen: false,
|
isAboutModalOpen: false,
|
||||||
isNavOpen,
|
isNavOpen,
|
||||||
configError: false,
|
hasConfigError: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.handleLogout = this.handleLogout.bind(this);
|
this.handleLogout = this.handleLogout.bind(this);
|
||||||
@@ -81,7 +81,7 @@ class App extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleConfigErrorClose () {
|
handleConfigErrorClose () {
|
||||||
this.setState({ configError: false });
|
this.setState({ hasConfigError: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadConfig () {
|
async loadConfig () {
|
||||||
@@ -92,7 +92,7 @@ class App extends Component {
|
|||||||
|
|
||||||
this.setState({ ansible_version, custom_virtualenvs, version, me });
|
this.setState({ ansible_version, custom_virtualenvs, version, me });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.setState({ configError: true });
|
this.setState({ hasConfigError: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ class App extends Component {
|
|||||||
isNavOpen,
|
isNavOpen,
|
||||||
me,
|
me,
|
||||||
version,
|
version,
|
||||||
configError,
|
hasConfigError,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
const {
|
const {
|
||||||
i18n,
|
i18n,
|
||||||
@@ -170,7 +170,7 @@ class App extends Component {
|
|||||||
onClose={this.handleAboutClose}
|
onClose={this.handleAboutClose}
|
||||||
/>
|
/>
|
||||||
<AlertModal
|
<AlertModal
|
||||||
isOpen={configError}
|
isOpen={hasConfigError}
|
||||||
variant="danger"
|
variant="danger"
|
||||||
title={i18n._(t`Error!`)}
|
title={i18n._(t`Error!`)}
|
||||||
onClose={this.handleConfigErrorClose}
|
onClose={this.handleConfigErrorClose}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { mountWithContexts, waitForElement } from '../testUtils/enzymeHelpers';
|
import { mountWithContexts, waitForElement } from '@testUtils/enzymeHelpers';
|
||||||
|
import { ConfigAPI, MeAPI, RootAPI } from '@api';
|
||||||
import { asyncFlush } from '../jest.setup';
|
import { asyncFlush } from '../jest.setup';
|
||||||
|
|
||||||
import App from './App';
|
import App from './App';
|
||||||
import { ConfigAPI, MeAPI, RootAPI } from './api';
|
|
||||||
|
|
||||||
jest.mock('./api');
|
jest.mock('./api');
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|
||||||
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
import Applications from './Applications';
|
import Applications from './Applications';
|
||||||
|
|
||||||
describe('<Applications />', () => {
|
describe('<Applications />', () => {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|
||||||
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
import AuthSettings from './AuthSettings';
|
import AuthSettings from './AuthSettings';
|
||||||
|
|
||||||
describe('<AuthSettings />', () => {
|
describe('<AuthSettings />', () => {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|
||||||
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
import Credentials from './Credentials';
|
import Credentials from './Credentials';
|
||||||
|
|
||||||
describe('<Credentials />', () => {
|
describe('<Credentials />', () => {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|
||||||
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
import CredentialTypes from './CredentialTypes';
|
import CredentialTypes from './CredentialTypes';
|
||||||
|
|
||||||
describe('<CredentialTypes />', () => {
|
describe('<CredentialTypes />', () => {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|
||||||
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
import Dashboard from './Dashboard';
|
import Dashboard from './Dashboard';
|
||||||
|
|
||||||
describe('<Dashboard />', () => {
|
describe('<Dashboard />', () => {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|
||||||
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
import InstanceGroups from './InstanceGroups';
|
import InstanceGroups from './InstanceGroups';
|
||||||
|
|
||||||
describe('<InstanceGroups />', () => {
|
describe('<InstanceGroups />', () => {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|
||||||
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
import Inventories from './Inventories';
|
import Inventories from './Inventories';
|
||||||
|
|
||||||
describe('<Inventories />', () => {
|
describe('<Inventories />', () => {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|
||||||
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
import InventoryScripts from './InventoryScripts';
|
import InventoryScripts from './InventoryScripts';
|
||||||
|
|
||||||
describe('<InventoryScripts />', () => {
|
describe('<InventoryScripts />', () => {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class JobList extends Component {
|
|||||||
this.state = {
|
this.state = {
|
||||||
hasContentLoading: true,
|
hasContentLoading: true,
|
||||||
hasContentError: false,
|
hasContentError: false,
|
||||||
deletionError: false,
|
hasDeletionError: false,
|
||||||
selected: [],
|
selected: [],
|
||||||
jobs: [],
|
jobs: [],
|
||||||
itemCount: 0,
|
itemCount: 0,
|
||||||
@@ -56,7 +56,7 @@ class JobList extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleDeleteErrorClose () {
|
handleDeleteErrorClose () {
|
||||||
this.setState({ deletionError: false });
|
this.setState({ hasDeletionError: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSelectAll (isSelected) {
|
handleSelectAll (isSelected) {
|
||||||
@@ -76,11 +76,11 @@ class JobList extends Component {
|
|||||||
|
|
||||||
async handleDelete () {
|
async handleDelete () {
|
||||||
const { selected } = this.state;
|
const { selected } = this.state;
|
||||||
this.setState({ hasContentLoading: true, deletionError: false });
|
this.setState({ hasContentLoading: true, hasDeletionError: false });
|
||||||
try {
|
try {
|
||||||
await Promise.all(selected.map(({ id }) => UnifiedJobsAPI.destroy(id)));
|
await Promise.all(selected.map(({ id }) => UnifiedJobsAPI.destroy(id)));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.setState({ deletionError: true });
|
this.setState({ hasDeletionError: true });
|
||||||
} finally {
|
} finally {
|
||||||
await this.loadJobs();
|
await this.loadJobs();
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ class JobList extends Component {
|
|||||||
const {
|
const {
|
||||||
hasContentError,
|
hasContentError,
|
||||||
hasContentLoading,
|
hasContentLoading,
|
||||||
deletionError,
|
hasDeletionError,
|
||||||
jobs,
|
jobs,
|
||||||
itemCount,
|
itemCount,
|
||||||
selected,
|
selected,
|
||||||
@@ -166,7 +166,7 @@ class JobList extends Component {
|
|||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
<AlertModal
|
<AlertModal
|
||||||
isOpen={deletionError}
|
isOpen={hasDeletionError}
|
||||||
variant="danger"
|
variant="danger"
|
||||||
title={i18n._(t`Error!`)}
|
title={i18n._(t`Error!`)}
|
||||||
onClose={this.handleDeleteErrorClose}
|
onClose={this.handleDeleteErrorClose}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|
||||||
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
import JobsSettings from './JobsSettings';
|
import JobsSettings from './JobsSettings';
|
||||||
|
|
||||||
describe('<JobsSettings />', () => {
|
describe('<JobsSettings />', () => {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|
||||||
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
import License from './License';
|
import License from './License';
|
||||||
|
|
||||||
describe('<License />', () => {
|
describe('<License />', () => {
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ class AWXLogin extends Component {
|
|||||||
this.state = {
|
this.state = {
|
||||||
username: '',
|
username: '',
|
||||||
password: '',
|
password: '',
|
||||||
authenticationError: false,
|
hasAuthError: false,
|
||||||
validationError: false,
|
hasValidationError: false,
|
||||||
isAuthenticating: false,
|
isAuthenticating: false,
|
||||||
isLoading: true,
|
isLoading: true,
|
||||||
logo: null,
|
logo: null,
|
||||||
@@ -66,16 +66,16 @@ class AWXLogin extends Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({ authenticationError: false, isAuthenticating: true });
|
this.setState({ hasAuthError: false, isAuthenticating: true });
|
||||||
try {
|
try {
|
||||||
// note: if authentication is successful, the appropriate cookie will be set automatically
|
// note: if authentication is successful, the appropriate cookie will be set automatically
|
||||||
// and isAuthenticated() (the source of truth) will start returning true.
|
// and isAuthenticated() (the source of truth) will start returning true.
|
||||||
await RootAPI.login(username, password);
|
await RootAPI.login(username, password);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err && err.response && err.response.status === 401) {
|
if (err && err.response && err.response.status === 401) {
|
||||||
this.setState({ validationError: true });
|
this.setState({ hasValidationError: true });
|
||||||
} else {
|
} else {
|
||||||
this.setState({ authenticationError: true });
|
this.setState({ hasAuthError: true });
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
this.setState({ isAuthenticating: false });
|
this.setState({ isAuthenticating: false });
|
||||||
@@ -83,17 +83,17 @@ class AWXLogin extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleChangeUsername (value) {
|
handleChangeUsername (value) {
|
||||||
this.setState({ username: value, validationError: false });
|
this.setState({ username: value, hasValidationError: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
handleChangePassword (value) {
|
handleChangePassword (value) {
|
||||||
this.setState({ password: value, validationError: false });
|
this.setState({ password: value, hasValidationError: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const {
|
const {
|
||||||
authenticationError,
|
hasAuthError,
|
||||||
validationError,
|
hasValidationError,
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
isLoading,
|
isLoading,
|
||||||
@@ -115,7 +115,7 @@ class AWXLogin extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let helperText;
|
let helperText;
|
||||||
if (validationError) {
|
if (hasValidationError) {
|
||||||
helperText = i18n._(t`Invalid username or password. Please try again.`);
|
helperText = i18n._(t`Invalid username or password. Please try again.`);
|
||||||
} else {
|
} else {
|
||||||
helperText = i18n._(t`There was a problem signing in. Please try again.`);
|
helperText = i18n._(t`There was a problem signing in. Please try again.`);
|
||||||
@@ -129,15 +129,15 @@ class AWXLogin extends Component {
|
|||||||
textContent={loginInfo}
|
textContent={loginInfo}
|
||||||
>
|
>
|
||||||
<LoginForm
|
<LoginForm
|
||||||
className={(authenticationError || validationError) ? 'pf-m-error' : ''}
|
className={(hasAuthError || hasValidationError) ? 'pf-m-error' : ''}
|
||||||
usernameLabel={i18n._(t`Username`)}
|
usernameLabel={i18n._(t`Username`)}
|
||||||
passwordLabel={i18n._(t`Password`)}
|
passwordLabel={i18n._(t`Password`)}
|
||||||
showHelperText={(authenticationError || validationError)}
|
showHelperText={(hasAuthError || hasValidationError)}
|
||||||
helperText={helperText}
|
helperText={helperText}
|
||||||
usernameValue={username}
|
usernameValue={username}
|
||||||
passwordValue={password}
|
passwordValue={password}
|
||||||
isValidUsername={!validationError}
|
isValidUsername={!hasValidationError}
|
||||||
isValidPassword={!validationError}
|
isValidPassword={!hasValidationError}
|
||||||
onChangeUsername={this.handleChangeUsername}
|
onChangeUsername={this.handleChangeUsername}
|
||||||
onChangePassword={this.handleChangePassword}
|
onChangePassword={this.handleChangePassword}
|
||||||
onLoginButtonClick={this.handleLoginButtonClick}
|
onLoginButtonClick={this.handleLoginButtonClick}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts, waitForElement } from '../../../testUtils/enzymeHelpers';
|
|
||||||
import AWXLogin from './Login';
|
|
||||||
import { RootAPI } from '../../api';
|
|
||||||
|
|
||||||
jest.mock('../../api');
|
import { RootAPI } from '@api';
|
||||||
|
import { mountWithContexts, waitForElement } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
|
import AWXLogin from './Login';
|
||||||
|
|
||||||
|
jest.mock('@api');
|
||||||
|
|
||||||
describe('<Login />', () => {
|
describe('<Login />', () => {
|
||||||
async function findChildren (wrapper) {
|
async function findChildren (wrapper) {
|
||||||
@@ -60,7 +62,7 @@ describe('<Login />', () => {
|
|||||||
} = await findChildren(loginWrapper);
|
} = await findChildren(loginWrapper);
|
||||||
expect(usernameInput.props().value).toBe('');
|
expect(usernameInput.props().value).toBe('');
|
||||||
expect(passwordInput.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);
|
expect(submitButton.props().isDisabled).toBe(false);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@@ -126,14 +128,14 @@ describe('<Login />', () => {
|
|||||||
submitButton.simulate('click');
|
submitButton.simulate('click');
|
||||||
await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('username') === 'invalid');
|
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('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);
|
await waitForElement(loginWrapper, formError, (el) => el.length === 1);
|
||||||
|
|
||||||
usernameInput.props().onChange({ currentTarget: { value: 'dsarif' } });
|
usernameInput.props().onChange({ currentTarget: { value: 'dsarif' } });
|
||||||
passwordInput.props().onChange({ currentTarget: { value: 'freneticpny' } });
|
passwordInput.props().onChange({ currentTarget: { value: 'freneticpny' } });
|
||||||
await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('username') === 'dsarif');
|
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('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);
|
await waitForElement(loginWrapper, formError, (el) => el.length === 0);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
@@ -151,16 +153,16 @@ describe('<Login />', () => {
|
|||||||
|
|
||||||
RootAPI.login.mockRejectedValueOnce({ response: { status: 500 } });
|
RootAPI.login.mockRejectedValueOnce({ response: { status: 500 } });
|
||||||
submitButton.simulate('click');
|
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' } });
|
usernameInput.props().onChange({ currentTarget: { value: 'sgrimes' } });
|
||||||
passwordInput.props().onChange({ currentTarget: { value: 'ovid' } });
|
passwordInput.props().onChange({ currentTarget: { value: 'ovid' } });
|
||||||
await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('username') === 'sgrimes');
|
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('password') === 'ovid');
|
||||||
await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('authenticationError') === true);
|
await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('hasAuthError') === true);
|
||||||
|
|
||||||
submitButton.simulate('click');
|
submitButton.simulate('click');
|
||||||
await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('authenticationError') === false);
|
await waitForElement(loginWrapper, 'AWXLogin', (el) => el.state('hasAuthError') === false);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|
||||||
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
import ManagementJobs from './ManagementJobs';
|
import ManagementJobs from './ManagementJobs';
|
||||||
|
|
||||||
describe('<ManagementJobs />', () => {
|
describe('<ManagementJobs />', () => {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|
||||||
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
import NotificationTemplates from './NotificationTemplates';
|
import NotificationTemplates from './NotificationTemplates';
|
||||||
|
|
||||||
describe('<NotificationTemplates />', () => {
|
describe('<NotificationTemplates />', () => {
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ jest.mock('@api');
|
|||||||
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
||||||
|
|
||||||
describe('<OrganizationEdit />', () => {
|
describe('<OrganizationEdit />', () => {
|
||||||
let api;
|
|
||||||
|
|
||||||
const mockData = {
|
const mockData = {
|
||||||
name: 'Foo',
|
name: 'Foo',
|
||||||
description: 'Bar',
|
description: 'Bar',
|
||||||
@@ -22,23 +20,8 @@ describe('<OrganizationEdit />', () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
api = {
|
|
||||||
getInstanceGroups: jest.fn(),
|
|
||||||
updateOrganizationDetails: jest.fn(),
|
|
||||||
associateInstanceGroup: jest.fn(),
|
|
||||||
disassociate: jest.fn(),
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
test('handleSubmit should call api update', () => {
|
test('handleSubmit should call api update', () => {
|
||||||
const wrapper = mountWithContexts(
|
const wrapper = mountWithContexts(<OrganizationEdit organization={mockData} />);
|
||||||
<OrganizationEdit
|
|
||||||
organization={mockData}
|
|
||||||
/>, { context: { network: {
|
|
||||||
api,
|
|
||||||
} } }
|
|
||||||
);
|
|
||||||
|
|
||||||
const updatedOrgData = {
|
const updatedOrgData = {
|
||||||
name: 'new name',
|
name: 'new name',
|
||||||
@@ -51,13 +34,7 @@ describe('<OrganizationEdit />', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('handleSubmit associates and disassociates instance groups', async () => {
|
test('handleSubmit associates and disassociates instance groups', async () => {
|
||||||
const wrapper = mountWithContexts(
|
const wrapper = mountWithContexts(<OrganizationEdit organization={mockData} />);
|
||||||
<OrganizationEdit
|
|
||||||
organization={mockData}
|
|
||||||
/>, { context: { network: {
|
|
||||||
api,
|
|
||||||
} } }
|
|
||||||
);
|
|
||||||
|
|
||||||
const updatedOrgData = {
|
const updatedOrgData = {
|
||||||
name: 'new name',
|
name: 'new name',
|
||||||
@@ -77,14 +54,8 @@ describe('<OrganizationEdit />', () => {
|
|||||||
push: jest.fn(),
|
push: jest.fn(),
|
||||||
};
|
};
|
||||||
const wrapper = mountWithContexts(
|
const wrapper = mountWithContexts(
|
||||||
<OrganizationEdit
|
<OrganizationEdit organization={mockData} />,
|
||||||
organization={mockData}
|
{ context: { router: { history } } }
|
||||||
/>, { context: {
|
|
||||||
network: {
|
|
||||||
api: { api },
|
|
||||||
},
|
|
||||||
router: { history }
|
|
||||||
} }
|
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(history.push).not.toHaveBeenCalled();
|
expect(history.push).not.toHaveBeenCalled();
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|
||||||
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
import Portal from './Portal';
|
import Portal from './Portal';
|
||||||
|
|
||||||
describe('<Portal />', () => {
|
describe('<Portal />', () => {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|
||||||
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
import Projects from './Projects';
|
import Projects from './Projects';
|
||||||
|
|
||||||
describe('<Projects />', () => {
|
describe('<Projects />', () => {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|
||||||
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
import Schedules from './Schedules';
|
import Schedules from './Schedules';
|
||||||
|
|
||||||
describe('<Schedules />', () => {
|
describe('<Schedules />', () => {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|
||||||
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
import SystemSettings from './SystemSettings';
|
import SystemSettings from './SystemSettings';
|
||||||
|
|
||||||
describe('<SystemSettings />', () => {
|
describe('<SystemSettings />', () => {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|
||||||
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
import Teams from './Teams';
|
import Teams from './Teams';
|
||||||
|
|
||||||
describe('<Teams />', () => {
|
describe('<Teams />', () => {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|
||||||
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
import UISettings from './UISettings';
|
import UISettings from './UISettings';
|
||||||
|
|
||||||
describe('<UISettings />', () => {
|
describe('<UISettings />', () => {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
|
||||||
|
import { mountWithContexts } from '@testUtils/enzymeHelpers';
|
||||||
|
|
||||||
import Users from './Users';
|
import Users from './Users';
|
||||||
|
|
||||||
describe('<Users />', () => {
|
describe('<Users />', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user