test(companion): cover cancel wait snapshot updates
This commit is contained in:
@@ -1173,6 +1173,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"
|
"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-cancel-waits-snapshot-coverage": {
|
||||||
|
"status": "completed",
|
||||||
|
"date": "2026-02-17",
|
||||||
|
"updated": "2026-02-17",
|
||||||
|
"summary": "Added runtime regression coverage proving `cancelPendingEventWaits()` immediately updates pending-work snapshots (`pendingEventWaitCount`, `hasPendingWork`).",
|
||||||
|
"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"
|
||||||
|
},
|
||||||
"companion-runtime-wait-for-idle-nonfinite-validation-coverage": {
|
"companion-runtime-wait-for-idle-nonfinite-validation-coverage": {
|
||||||
"status": "completed",
|
"status": "completed",
|
||||||
"date": "2026-02-17",
|
"date": "2026-02-17",
|
||||||
|
|||||||
@@ -420,6 +420,27 @@ describe('CompanionRuntimeClient', () => {
|
|||||||
expect(client.cancelPendingEventWaits()).toBe(0);
|
expect(client.cancelPendingEventWaits()).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('cancelPendingEventWaits updates pending work snapshot immediately', async () => {
|
||||||
|
const client = new CompanionRuntimeClient({
|
||||||
|
url: 'ws://127.0.0.1:1',
|
||||||
|
});
|
||||||
|
const pendingWait = client.waitForEvent('agent.stream', { timeoutMs: 10_000 }).catch(() => undefined);
|
||||||
|
|
||||||
|
expect(client.getPendingWorkSnapshot()).toEqual({
|
||||||
|
pendingRequestCount: 0,
|
||||||
|
pendingEventWaitCount: 1,
|
||||||
|
hasPendingWork: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(client.cancelPendingEventWaits('snapshot cancel')).toBe(1);
|
||||||
|
expect(client.getPendingWorkSnapshot()).toEqual({
|
||||||
|
pendingRequestCount: 0,
|
||||||
|
pendingEventWaitCount: 0,
|
||||||
|
hasPendingWork: false,
|
||||||
|
});
|
||||||
|
await pendingWait;
|
||||||
|
});
|
||||||
|
|
||||||
it('waitForEvent rejects immediately on disconnect', async () => {
|
it('waitForEvent rejects immediately on disconnect', async () => {
|
||||||
const client = new CompanionRuntimeClient({
|
const client = new CompanionRuntimeClient({
|
||||||
url: 'ws://127.0.0.1:1',
|
url: 'ws://127.0.0.1:1',
|
||||||
|
|||||||
Reference in New Issue
Block a user