Harden dashboard realtime state and controls
This commit is contained in:
1 parent
4b3f00729f
commit
d108903174
21 files changed
+422
-29
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { deriveShellStatus } from '../../apps/dashboard/src/app/shell-status.js';
|
||||
|
||||
describe('global shell status', () => {
|
||||
it('derives safety-critical labels from authoritative snapshots', () => {
|
||||
expect(deriveShellStatus({
|
||||
stats: { isRunning: true, dryRunMode: true, invitationCooldown: { reason: 'Reddit cooldown' } },
|
||||
reddit: { ready: true, loggedIn: true, status: 'authenticated' },
|
||||
realtime: { status: 'reconnecting', isStale: true },
|
||||
sync: { syncing: true, syncingKind: 'full' },
|
||||
})).toEqual({
|
||||
bot: 'Running (dry run)', reddit: 'Reddit authenticated', realtime: 'Realtime reconnecting (stale)',
|
||||
cooldown: 'Reddit cooldown', sync: 'Full sync active', controlAction: 'stop', controlDisabled: false,
|
||||
});
|
||||
});
|
||||
|
||||
it('guards bot controls until the authoritative bot state is available', () => {
|
||||
expect(deriveShellStatus({ realtime: { status: 'idle', isStale: true } })).toMatchObject({
|
||||
bot: 'Bot state unavailable', controlDisabled: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user