2026-07-06 07:33:23 +11:00
|
|
|
import { describe, expect, test } from 'bun:test';
|
|
|
|
|
|
2026-07-30 12:20:54 +03:00
|
|
|
import { resolveStatusCheckFailureState, runtimeIdentityMatches } from './sessionAuthGateState';
|
2026-07-06 07:33:23 +11:00
|
|
|
|
|
|
|
|
describe('resolveStatusCheckFailureState', () => {
|
|
|
|
|
test('keeps the desktop-shell password login fallback intact', () => {
|
|
|
|
|
expect(resolveStatusCheckFailureState({ shouldUseDesktopShellPasswordLogin: true })).toBe('locked');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('uses the network error screen for non-desktop status-check failures', () => {
|
|
|
|
|
expect(resolveStatusCheckFailureState({})).toBe('error');
|
|
|
|
|
});
|
2026-07-30 12:20:54 +03:00
|
|
|
|
|
|
|
|
test('rejects async auth results after switching hosts', () => {
|
|
|
|
|
expect(runtimeIdentityMatches(
|
|
|
|
|
{ apiBaseUrl: 'https://host-a.example', runtimeKey: 'host:a' },
|
|
|
|
|
{ apiBaseUrl: 'https://host-b.example', runtimeKey: 'host:b' },
|
|
|
|
|
)).toBe(false);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('accepts a credential refresh for the same host', () => {
|
|
|
|
|
expect(runtimeIdentityMatches(
|
|
|
|
|
{ apiBaseUrl: 'https://host-a.example', runtimeKey: 'host:a' },
|
|
|
|
|
{ apiBaseUrl: 'https://host-a.example', runtimeKey: 'host:a' },
|
|
|
|
|
)).toBe(true);
|
|
|
|
|
});
|
2026-07-06 07:33:23 +11:00
|
|
|
});
|