mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-29 00:10:54 +05:30
Fix bsod tests
This commit is contained in:
parent
bd77abcdd8
commit
dae803abfd
@ -4,7 +4,7 @@ import sinon from 'sinon';
|
|||||||
import BsodMiddleware from 'components/ui/bsod/BsodMiddleware';
|
import BsodMiddleware from 'components/ui/bsod/BsodMiddleware';
|
||||||
|
|
||||||
describe('BsodMiddleware', () => {
|
describe('BsodMiddleware', () => {
|
||||||
[404, 500, 503, 555].forEach((code) =>
|
[500, 503, 555].forEach((code) =>
|
||||||
it(`should dispatch for ${code}`, () => {
|
it(`should dispatch for ${code}`, () => {
|
||||||
const resp = {
|
const resp = {
|
||||||
originalResponse: {status: code}
|
originalResponse: {status: code}
|
||||||
@ -26,20 +26,22 @@ describe('BsodMiddleware', () => {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
it('should not dispatch for 200', () => {
|
[200, 404].forEach((code) =>
|
||||||
const resp = {
|
it(`should not dispatch for ${code}`, () => {
|
||||||
originalResponse: {status: 200}
|
const resp = {
|
||||||
};
|
originalResponse: {status: code}
|
||||||
|
};
|
||||||
|
|
||||||
const dispatch = sinon.spy();
|
const dispatch = sinon.spy();
|
||||||
const logger = {warn: sinon.spy()};
|
const logger = {warn: sinon.spy()};
|
||||||
|
|
||||||
const middleware = new BsodMiddleware(dispatch, logger);
|
const middleware = new BsodMiddleware(dispatch, logger);
|
||||||
|
|
||||||
return expect(middleware.catch(resp), 'to be rejected with', resp)
|
return expect(middleware.catch(resp), 'to be rejected with', resp)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(dispatch, 'was not called');
|
expect(dispatch, 'was not called');
|
||||||
expect(logger.warn, 'was not called');
|
expect(logger.warn, 'was not called');
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user