From a6e9daaaefd935226f77d408ba21a96c57889778 Mon Sep 17 00:00:00 2001 From: William Valentin Date: Mon, 16 Feb 2026 22:20:54 -0800 Subject: [PATCH] test(companion): add non-finite waitForIdle validation coverage --- docs/plans/state.json | 11 +++++++++++ src/companion/runtimeClient.test.ts | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/docs/plans/state.json b/docs/plans/state.json index d57a20d..5f9af61 100644 --- a/docs/plans/state.json +++ b/docs/plans/state.json @@ -1092,6 +1092,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-nonfinite-validation-coverage": { + "status": "completed", + "date": "2026-02-17", + "updated": "2026-02-17", + "summary": "Extended `waitForIdle()` option-validation coverage to include non-finite `timeoutMs`/`pollIntervalMs` values (`NaN`, `Infinity`) for deterministic guardrail behavior.", + "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", diff --git a/src/companion/runtimeClient.test.ts b/src/companion/runtimeClient.test.ts index 79cddb7..9d4b7d3 100644 --- a/src/companion/runtimeClient.test.ts +++ b/src/companion/runtimeClient.test.ts @@ -719,6 +719,12 @@ describe('CompanionRuntimeClient', () => { expect(() => client.waitForIdle({ pollIntervalMs: 0 })).toThrow( 'pollIntervalMs must be a positive number', ); + expect(() => client.waitForIdle({ pollIntervalMs: Number.NaN })).toThrow( + 'pollIntervalMs must be a positive number', + ); + expect(() => client.waitForIdle({ pollIntervalMs: Number.POSITIVE_INFINITY })).toThrow( + 'pollIntervalMs must be a positive number', + ); }); it('waitForIdle validates timeoutMs option', () => { @@ -729,6 +735,12 @@ describe('CompanionRuntimeClient', () => { expect(() => client.waitForIdle({ timeoutMs: 0 })).toThrow( 'timeoutMs must be a positive number', ); + expect(() => client.waitForIdle({ timeoutMs: Number.NaN })).toThrow( + 'timeoutMs must be a positive number', + ); + expect(() => client.waitForIdle({ timeoutMs: Number.POSITIVE_INFINITY })).toThrow( + 'timeoutMs must be a positive number', + ); }); it('waitForIdle resolves after pending event waiters are cleared', async () => {