feat(companion): return cancelPendingEventWaits count

This commit is contained in:
William Valentin
2026-02-16 22:19:50 -08:00
parent a4e9828592
commit 83236a4ba3
6 changed files with 32 additions and 13 deletions
+2 -1
View File
@@ -399,7 +399,7 @@ describe('CompanionRuntimeClient', () => {
const awaited = expect(
client.waitForEvent('agent.stream', { timeoutMs: 10_000 }),
).rejects.toThrow('manually cancelled');
client.cancelPendingEventWaits('manually cancelled');
expect(client.cancelPendingEventWaits('manually cancelled')).toBe(1);
await awaited;
(client as unknown as { handleMessage: (raw: string) => void }).handleMessage(
@@ -410,6 +410,7 @@ describe('CompanionRuntimeClient', () => {
}),
);
expect(handler).toHaveBeenCalledWith('agent.stream', { token: 'still-subscribed' });
expect(client.cancelPendingEventWaits()).toBe(0);
});
it('waitForEvent rejects immediately on disconnect', async () => {