mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
#303: do not logout if token refresh failed due to 5xx error
This commit is contained in:
@@ -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', () => {
|
||||
|
Reference in New Issue
Block a user