feat(companion): add event surface snapshot helper
This commit is contained in:
@@ -703,6 +703,24 @@ describe('CompanionRuntimeClient', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('returns event surface snapshot', async () => {
|
||||
const client = new CompanionRuntimeClient({
|
||||
url: 'ws://127.0.0.1:1',
|
||||
});
|
||||
const pendingWait = client.waitForEvent('agent.stream', { timeoutMs: 10_000 }).catch(() => undefined);
|
||||
const unsubscribe = client.subscribeEvents(() => undefined);
|
||||
|
||||
expect(client.getEventSurfaceSnapshot()).toEqual({
|
||||
knownEventNames: ['agent.stream', 'agent.typing', 'context_warning'],
|
||||
eventSubscriptionCount: 2,
|
||||
pendingEventWaitCount: 1,
|
||||
});
|
||||
|
||||
unsubscribe();
|
||||
client.clearEventSubscriptions();
|
||||
await pendingWait;
|
||||
});
|
||||
|
||||
it('waitForIdle resolves immediately when no work is pending', async () => {
|
||||
const client = new CompanionRuntimeClient({
|
||||
url: 'ws://127.0.0.1:1',
|
||||
|
||||
Reference in New Issue
Block a user