mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-10-14 21:42:51 +00:00
WIP sign in failed
This commit is contained in:
@@ -440,6 +440,26 @@ describe('AuthProvider', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('failed sign-in', () => {
|
||||
it('keeps an existing session', async () => {
|
||||
await givenLoadedToken(makeToken({accessToken: 'still-valid'}));
|
||||
|
||||
internals.notify({action: AuthActions.SignInFailed, error: new Error('state mismatch')});
|
||||
|
||||
expect(await isLoggedIn()).toBeTrue();
|
||||
expect(internals.tokenSubject.value?.accessToken).toBe('still-valid');
|
||||
expect(storageRemoveItem).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('stays logged out without a session', async () => {
|
||||
await givenLoadedToken(null);
|
||||
|
||||
internals.notify({action: AuthActions.SignInFailed, error: new Error('access_denied')});
|
||||
|
||||
expect(await isLoggedIn()).toBeFalse();
|
||||
});
|
||||
});
|
||||
|
||||
describe('signOut', () => {
|
||||
/** The [token, token_type_hint, client_id] of each revoke request, in order. */
|
||||
const revokedTokens = () =>
|
||||
|
||||
@@ -1304,7 +1304,6 @@ export class AuthProvider {
|
||||
action: IAuthAction,
|
||||
): void {
|
||||
switch (action.action) {
|
||||
case AuthActions.SignInFailed:
|
||||
case AuthActions.SignOutSuccess:
|
||||
case AuthActions.SignOutFailed:
|
||||
case AuthActions.SessionExpired: {
|
||||
|
||||
Reference in New Issue
Block a user