test(companion): cover pending event wait count lifecycle
This commit is contained in:
@@ -528,10 +528,12 @@ describe('CompanionRuntimeClient', () => {
|
||||
const client = new CompanionRuntimeClient({
|
||||
url: 'ws://127.0.0.1:1',
|
||||
});
|
||||
expect(client.pendingEventWaitCount).toBe(0);
|
||||
const awaited = client.waitForAnyEvent<{ active?: boolean; token?: string }>(
|
||||
['agent.typing', 'agent.stream'],
|
||||
{ timeoutMs: 2000 },
|
||||
);
|
||||
expect(client.pendingEventWaitCount).toBe(1);
|
||||
|
||||
(client as unknown as { handleMessage: (raw: string) => void }).handleMessage(
|
||||
JSON.stringify({
|
||||
@@ -545,6 +547,7 @@ describe('CompanionRuntimeClient', () => {
|
||||
event: 'agent.typing',
|
||||
data: { active: true },
|
||||
});
|
||||
expect(client.pendingEventWaitCount).toBe(0);
|
||||
});
|
||||
|
||||
it('waitForAnyEvent supports per-event predicate filtering', async () => {
|
||||
|
||||
Reference in New Issue
Block a user