remove network context mock

This commit is contained in:
Jake McDermott 2019-06-21 12:15:59 -04:00
parent 657a6f3a93
commit cc36b46925

View File

@ -10,8 +10,6 @@ jest.mock('@api');
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
describe('<OrganizationEdit />', () => {
let api;
const mockData = {
name: 'Foo',
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', () => {
const wrapper = mountWithContexts(
<OrganizationEdit
organization={mockData}
/>, { context: { network: {
api,
} } }
);
const wrapper = mountWithContexts(<OrganizationEdit organization={mockData} />);
const updatedOrgData = {
name: 'new name',
@ -51,13 +34,7 @@ describe('<OrganizationEdit />', () => {
});
test('handleSubmit associates and disassociates instance groups', async () => {
const wrapper = mountWithContexts(
<OrganizationEdit
organization={mockData}
/>, { context: { network: {
api,
} } }
);
const wrapper = mountWithContexts(<OrganizationEdit organization={mockData} />);
const updatedOrgData = {
name: 'new name',
@ -77,14 +54,8 @@ describe('<OrganizationEdit />', () => {
push: jest.fn(),
};
const wrapper = mountWithContexts(
<OrganizationEdit
organization={mockData}
/>, { context: {
network: {
api: { api },
},
router: { history }
} }
<OrganizationEdit organization={mockData} />,
{ context: { router: { history } } }
);
expect(history.push).not.toHaveBeenCalled();