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)); 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();