feat(companion): expose pending event wait observability
This commit is contained in:
@@ -305,11 +305,13 @@ describe('CompanionRuntimeClient', () => {
|
||||
const client = new CompanionRuntimeClient({
|
||||
url: 'ws://127.0.0.1:1',
|
||||
});
|
||||
expect(client.pendingEventWaitCount).toBe(0);
|
||||
|
||||
const awaited = client.waitForEvent<{ seq: number }>('agent.stream', {
|
||||
timeoutMs: 2000,
|
||||
predicate: (data) => data.seq === 2,
|
||||
});
|
||||
expect(client.pendingEventWaitCount).toBe(1);
|
||||
|
||||
(client as unknown as { handleMessage: (raw: string) => void }).handleMessage(
|
||||
JSON.stringify({
|
||||
@@ -327,6 +329,7 @@ describe('CompanionRuntimeClient', () => {
|
||||
);
|
||||
|
||||
await expect(awaited).resolves.toEqual({ seq: 2 });
|
||||
expect(client.pendingEventWaitCount).toBe(0);
|
||||
});
|
||||
|
||||
it('waitForEvent rejects on timeout', async () => {
|
||||
|
||||
Reference in New Issue
Block a user