test(companion): cover waitForIdle abort cancellation
This commit is contained in:
@@ -927,6 +927,17 @@
|
||||
],
|
||||
"test_status": "pnpm test:run src/companion/platformClients.integration.test.ts src/companion/platformClients.test.ts src/companion/runtimeClient.test.ts src/companion/heartbeatLoop.test.ts + pnpm typecheck passing"
|
||||
},
|
||||
"companion-runtime-wait-for-idle-abort-coverage": {
|
||||
"status": "completed",
|
||||
"date": "2026-02-17",
|
||||
"updated": "2026-02-17",
|
||||
"summary": "Added abort-signal regression coverage for runtime `waitForIdle()` so pending idle waits cancel deterministically with explicit abort errors.",
|
||||
"files_modified": [
|
||||
"src/companion/runtimeClient.test.ts",
|
||||
"docs/plans/state.json"
|
||||
],
|
||||
"test_status": "pnpm test:run src/companion/runtimeClient.test.ts src/companion/platformClients.test.ts src/companion/heartbeatLoop.test.ts src/companion/platformClients.integration.test.ts + pnpm typecheck passing"
|
||||
},
|
||||
"browser-tools-activation-clarity": {
|
||||
"status": "completed",
|
||||
"date": "2026-02-17",
|
||||
|
||||
@@ -693,6 +693,23 @@ describe('CompanionRuntimeClient', () => {
|
||||
await pendingWait;
|
||||
});
|
||||
|
||||
it('waitForIdle supports AbortSignal cancellation', async () => {
|
||||
const client = new CompanionRuntimeClient({
|
||||
url: 'ws://127.0.0.1:1',
|
||||
});
|
||||
const pendingWait = client.waitForEvent('agent.stream', { timeoutMs: 10_000 }).catch(() => undefined);
|
||||
const controller = new AbortController();
|
||||
|
||||
const awaited = expect(
|
||||
client.waitForIdle({ timeoutMs: 10_000, signal: controller.signal }),
|
||||
).rejects.toThrow('Aborted while waiting for runtime idle state');
|
||||
controller.abort();
|
||||
await awaited;
|
||||
|
||||
client.clearEventSubscriptions();
|
||||
await pendingWait;
|
||||
});
|
||||
|
||||
it('connects and performs node registration + capability discovery', async () => {
|
||||
if (!LISTEN_ALLOWED) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user