test(companion): verify clearEventSubscriptions count integration

This commit is contained in:
William Valentin
2026-02-16 22:26:54 -08:00
parent ffc7c4e9b3
commit 33812e3845
2 changed files with 33 additions and 0 deletions
@@ -299,6 +299,28 @@ describe('platform clients integration', () => {
unsubscribe();
});
it('platform clearEventSubscriptions returns cleared and cancelled counts', async () => {
if (!LISTEN_ALLOWED) {
return;
}
const runtime = createRuntime();
const client = new IOSCompanionClient({ runtime, nodeId: 'ios-clear-counts-e2e' });
const unsubscribe = client.subscribeEvents(() => undefined);
const pending = client.waitForAnyEvent(['agent.stream'], { timeoutMs: 10_000 }).catch(() => undefined);
const cleared = client.clearEventSubscriptions();
expect(cleared).toEqual({
clearedSubscriptions: 2,
cancelledWaits: 1,
});
await pending;
expect(client.eventSubscriptionCount).toBe(0);
unsubscribe();
});
it('platform connected reflects runtime connection lifecycle', async () => {
if (!LISTEN_ALLOWED) {
return;