-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Expand file tree
/
Copy pathentry-rail-account-state.test.ts
More file actions
61 lines (53 loc) · 1.81 KB
/
Copy pathentry-rail-account-state.test.ts
File metadata and controls
61 lines (53 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { describe, expect, it } from 'vitest';
import {
resolveEntryRailAccountFooterState,
} from '../../src/components/entry-rail-account-state';
import type { WorkspaceContextState } from '../../src/collab/useWorkspaceContext';
const SIGNED_IN_CONTEXT = {
workspaceId: 'workspace-1',
} as WorkspaceContextState['context'];
describe('resolveEntryRailAccountFooterState', () => {
it('keeps the resolved account row when a workspace context exists', () => {
expect(resolveEntryRailAccountFooterState({
context: SIGNED_IN_CONTEXT,
loading: false,
failure: 'unavailable',
}, true)).toBe('hidden');
});
it('shows the neutral syncing state while the workspace identity is loading', () => {
expect(resolveEntryRailAccountFooterState({
context: null,
loading: true,
}, null)).toBe('syncing');
});
it.each([true, null] as const)(
'does not claim sign-out during an outage when local login is %s',
(amrLoggedIn) => {
expect(resolveEntryRailAccountFooterState({
context: null,
loading: false,
failure: 'unavailable',
}, amrLoggedIn)).toBe('syncing');
},
);
it('still offers sign-in during an outage after an explicit local logout', () => {
expect(resolveEntryRailAccountFooterState({
context: null,
loading: false,
failure: 'unavailable',
}, false)).toBe('sign-in');
});
it('accepts the next successful null response as authoritative sign-out', () => {
expect(resolveEntryRailAccountFooterState({
context: null,
loading: false,
}, true)).toBe('sign-in');
});
it('preserves the legacy unsupported-daemon behavior', () => {
expect(resolveEntryRailAccountFooterState({
context: null,
loading: false,
failure: 'unsupported',
}, true)).toBe('sign-in');
});
});