#303: do not logout if token refresh failed due to 5xx error

This commit is contained in:
SleepWalker
2017-02-26 11:58:33 +02:00
parent 4074a65329
commit 1c467bc7bd
2 changed files with 27 additions and 8 deletions

View File

@@ -110,7 +110,7 @@ describe('refreshTokenMiddleware', () => {
);
});
it('should if token can not be parsed', () => {
it('should logout if token can not be parsed', () => {
const account = {
token: 'realy bad token',
refreshToken
@@ -143,6 +143,22 @@ describe('refreshTokenMiddleware', () => {
])
);
});
it('should not logout if request failed with 5xx', () => {
const resp = {
originalResponse: {
status: 500
}
};
authentication.requestToken.returns(Promise.reject(resp));
return expect(middleware.before({url: 'foo', options: {}}), 'to be rejected with', resp).then(() =>
expect(dispatch, 'to have no calls satisfying', [
{payload: {isGuest: true}}
])
);
});
});
it('should not be applied if no token', () => {