createSchema thunk throws an error for unsuccesfull response
This commit is contained in:
parent
e02dd84491
commit
203f4be015
2 changed files with 12 additions and 7 deletions
|
@ -124,13 +124,17 @@ describe('Thunks', () => {
|
||||||
|
|
||||||
it('creates POST_SCHEMA__FAILURE when posting new schema', async () => {
|
it('creates POST_SCHEMA__FAILURE when posting new schema', async () => {
|
||||||
fetchMock.postOnce(`/api/clusters/${clusterName}/schemas`, 404);
|
fetchMock.postOnce(`/api/clusters/${clusterName}/schemas`, 404);
|
||||||
|
try {
|
||||||
await store.dispatch(
|
await store.dispatch(
|
||||||
thunks.createSchema(clusterName, fixtures.schemaPayload)
|
thunks.createSchema(clusterName, fixtures.schemaPayload)
|
||||||
);
|
);
|
||||||
|
} catch (error) {
|
||||||
|
expect(error.status).toEqual(404);
|
||||||
expect(store.getActions()).toEqual([
|
expect(store.getActions()).toEqual([
|
||||||
actions.createSchemaAction.request(),
|
actions.createSchemaAction.request(),
|
||||||
actions.createSchemaAction.failure(),
|
actions.createSchemaAction.failure(),
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -296,5 +296,6 @@ export const createSchema = (
|
||||||
dispatch(actions.createSchemaAction.success(schema));
|
dispatch(actions.createSchemaAction.success(schema));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
dispatch(actions.createSchemaAction.failure());
|
dispatch(actions.createSchemaAction.failure());
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue