mirror of
https://github.com/ansible/awx.git
synced 2026-03-19 09:57:33 -02:30
remove network context mock
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user