mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
Fix bug with infinite loader, when page refreshed on /login with oauth state restoration active
This commit is contained in:
@@ -58,7 +58,8 @@ describe('AuthFlow', () => {
|
||||
}));
|
||||
|
||||
sinon.stub(flow, 'run').named('flow.run');
|
||||
flow.run.returns({then: (fn) => fn()});
|
||||
const promiseLike = {then: (fn) => fn() || promiseLike};
|
||||
flow.run.returns(promiseLike);
|
||||
sinon.stub(flow, 'setState').named('flow.setState');
|
||||
});
|
||||
|
||||
@@ -96,6 +97,14 @@ describe('AuthFlow', () => {
|
||||
expect(flow.setState, 'was called once');
|
||||
});
|
||||
|
||||
it('should call onReady after state restoration', () => {
|
||||
const onReady = sinon.stub().named('onReady');
|
||||
|
||||
flow.handleRequest({path: '/login'}, null, onReady);
|
||||
|
||||
expect(onReady, 'was called');
|
||||
});
|
||||
|
||||
it('should not restore oauth state for /register route', () => {
|
||||
flow.handleRequest({path: '/register'});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user