fix(oauth): persist successful login status across navigation
This commit is contained in:
1 parent
7b192cc6a4
commit
be08a4bfdf
3 files changed
+58
-45
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import { describe, expect, test } from 'bun:test';
|
||||
import {
|
||||
createOAuthLoginSuccessCache,
|
||||
shouldShowOAuthLoginStatus,
|
||||
} from '../src/services/oauthLoginState';
|
||||
|
||||
describe('OAuth login display state', () => {
|
||||
test('only successful login states display a status badge', () => {
|
||||
expect(shouldShowOAuthLoginStatus('idle')).toBeFalse();
|
||||
expect(shouldShowOAuthLoginStatus('waiting')).toBeFalse();
|
||||
expect(shouldShowOAuthLoginStatus('error')).toBeFalse();
|
||||
expect(shouldShowOAuthLoginStatus('success')).toBeTrue();
|
||||
});
|
||||
|
||||
test('successful providers remain cached across page remounts', () => {
|
||||
const cache = createOAuthLoginSuccessCache<'codex' | 'claude'>();
|
||||
cache.mark('codex');
|
||||
|
||||
expect(cache.snapshot()).toEqual(['codex']);
|
||||
expect(cache.snapshot()).toEqual(['codex']);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user