WIP sign in failed

This commit is contained in:
Jovan Krunić
2026-10-13 15:18:24 +02:00
parent 29fdfec0fd
commit 388e65a2e5
2 changed files with 20 additions and 1 deletions
@@ -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: {