test(companion): add event surface snapshot integration coverage
This commit is contained in:
@@ -228,6 +228,34 @@ describe('platform clients integration', () => {
|
||||
expect(client.eventSubscriptionCount).toBe(0);
|
||||
});
|
||||
|
||||
it('platform getEventSurfaceSnapshot reflects subscription and waiter lifecycle', async () => {
|
||||
if (!LISTEN_ALLOWED) {
|
||||
return;
|
||||
}
|
||||
|
||||
const runtime = createRuntime();
|
||||
const client = new IOSCompanionClient({ runtime, nodeId: 'ios-event-snapshot-e2e' });
|
||||
|
||||
const unsubscribe = client.subscribeEvents(() => undefined);
|
||||
const pending = client.waitForAnyEvent(['agent.stream'], { timeoutMs: 10_000 }).catch(() => undefined);
|
||||
|
||||
expect(client.getEventSurfaceSnapshot()).toEqual({
|
||||
knownEventNames: ['agent.stream', 'agent.typing', 'context_warning'],
|
||||
eventSubscriptionCount: 2,
|
||||
pendingEventWaitCount: 1,
|
||||
});
|
||||
|
||||
client.clearEventSubscriptions();
|
||||
await pending;
|
||||
expect(client.getEventSurfaceSnapshot()).toEqual({
|
||||
knownEventNames: ['agent.stream', 'agent.typing', 'context_warning'],
|
||||
eventSubscriptionCount: 0,
|
||||
pendingEventWaitCount: 0,
|
||||
});
|
||||
|
||||
unsubscribe();
|
||||
});
|
||||
|
||||
it('platform connected reflects runtime connection lifecycle', async () => {
|
||||
if (!LISTEN_ALLOWED) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user