feat(companion): validate event wait helper input names

This commit is contained in:
William Valentin
2026-02-16 19:43:32 -08:00
parent 4f6904c395
commit 490ca7def9
4 changed files with 32 additions and 1 deletions
+12
View File
@@ -343,6 +343,15 @@ describe('CompanionRuntimeClient', () => {
vi.useRealTimers();
});
it('waitForEvent validates eventName input', () => {
const client = new CompanionRuntimeClient({
url: 'ws://127.0.0.1:1',
});
expect(() => client.waitForEvent('')).toThrow('eventName must be a non-empty string');
expect(() => client.waitForEvent(' ')).toThrow('eventName must be a non-empty string');
});
it('waitForEvent supports AbortSignal cancellation', async () => {
const client = new CompanionRuntimeClient({
url: 'ws://127.0.0.1:1',
@@ -573,6 +582,9 @@ describe('CompanionRuntimeClient', () => {
expect(() => client.waitForAnyEvent([])).toThrow(
'eventNames must contain at least one event name',
);
expect(() => client.waitForAnyEvent(['agent.stream', ' '])).toThrow(
'eventNames must not contain empty values',
);
});
it('connects and performs node registration + capability discovery', async () => {