test(companion): cover pending event wait count lifecycle
This commit is contained in:
@@ -131,6 +131,25 @@ describe('platform clients integration', () => {
|
||||
expect(client.eventSubscriptionCount).toBe(0);
|
||||
});
|
||||
|
||||
it('platform pendingEventWaitCount tracks waitForAnyEvent lifecycle', async () => {
|
||||
if (!LISTEN_ALLOWED) {
|
||||
return;
|
||||
}
|
||||
|
||||
const runtime = createRuntime();
|
||||
const client = new IOSCompanionClient({ runtime, nodeId: 'ios-wait-count-e2e' });
|
||||
|
||||
expect(client.pendingEventWaitCount).toBe(0);
|
||||
const awaited = expect(
|
||||
client.waitForAnyEvent(['agent.stream'], { timeoutMs: 10_000 }),
|
||||
).rejects.toThrow('Event subscriptions cleared');
|
||||
expect(client.pendingEventWaitCount).toBe(1);
|
||||
|
||||
client.clearEventSubscriptions();
|
||||
await awaited;
|
||||
expect(client.pendingEventWaitCount).toBe(0);
|
||||
});
|
||||
|
||||
it('platform connected reflects runtime connection lifecycle', async () => {
|
||||
if (!LISTEN_ALLOWED) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user