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
@@ -57,6 +57,24 @@ describe('dashboard realtime client', () => {
|
||||
expect(client.getSnapshot()).toMatchObject({ status: 'closed', isStale: true });
|
||||
});
|
||||
|
||||
it('requests an authoritative repair on initial connection and every reconnect', () => {
|
||||
const source = new FakeEventSource();
|
||||
const connected = vi.fn();
|
||||
const client = createDashboardRealtimeClient({
|
||||
sourceFactory: () => source,
|
||||
onEvent: vi.fn(),
|
||||
onConnected: connected,
|
||||
});
|
||||
|
||||
client.start();
|
||||
source.emit('open');
|
||||
source.emit('error');
|
||||
source.emit('open');
|
||||
|
||||
expect(connected).toHaveBeenNthCalledWith(1, { isReconnect: false });
|
||||
expect(connected).toHaveBeenNthCalledWith(2, { isReconnect: true });
|
||||
});
|
||||
|
||||
it('maps events to the queries whose authoritative snapshots need refresh', () => {
|
||||
expect(
|
||||
queryKeysForDashboardEvent({
|
||||
|
||||
Reference in new issue
Block a user