fix(companion): validate event wait timeout options

This commit is contained in:
William Valentin
2026-02-16 22:17:14 -08:00
parent 45ea084cf0
commit c41332a643
4 changed files with 26 additions and 1 deletions
+6
View File
@@ -359,6 +359,9 @@ describe('CompanionRuntimeClient', () => {
expect(() => client.waitForEvent(123 as unknown as string)).toThrow(
'eventName must be a non-empty string',
);
expect(() => client.waitForEvent('agent.stream', { timeoutMs: 0 })).toThrow(
'timeoutMs must be a positive number',
);
});
it('waitForEvent supports AbortSignal cancellation', async () => {
@@ -600,6 +603,9 @@ describe('CompanionRuntimeClient', () => {
expect(() => client.waitForAnyEvent(['agent.stream', 123 as unknown as string])).toThrow(
'eventNames must not contain empty values',
);
expect(() => client.waitForAnyEvent(['agent.stream'], { timeoutMs: 0 })).toThrow(
'timeoutMs must be a positive number',
);
});
it('tracks pendingRequestCount for in-flight RPCs', async () => {