feat(companion): return cancelPendingEventWaits count
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user