feat(companion): add AbortSignal support for waitForEvent
This commit is contained in:
@@ -260,6 +260,19 @@ describe('CompanionRuntimeClient', () => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it('waitForEvent supports AbortSignal cancellation', async () => {
|
||||
const client = new CompanionRuntimeClient({
|
||||
url: 'ws://127.0.0.1:1',
|
||||
});
|
||||
const controller = new AbortController();
|
||||
|
||||
const awaited = expect(
|
||||
client.waitForEvent('agent.stream', { signal: controller.signal, timeoutMs: 10_000 }),
|
||||
).rejects.toThrow('Aborted while waiting for event agent.stream');
|
||||
controller.abort();
|
||||
await awaited;
|
||||
});
|
||||
|
||||
it('connects and performs node registration + capability discovery', async () => {
|
||||
if (!LISTEN_ALLOWED) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user