test(companion): add cancelPendingEventWaits integration coverage
This commit is contained in:
@@ -1055,6 +1055,17 @@
|
|||||||
],
|
],
|
||||||
"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"
|
"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-platform-cancel-pending-waits-integration-coverage": {
|
||||||
|
"status": "completed",
|
||||||
|
"date": "2026-02-17",
|
||||||
|
"updated": "2026-02-17",
|
||||||
|
"summary": "Added platform integration coverage for `cancelPendingEventWaits()` to verify pending wait cancellation with custom reasons while preserving existing event subscriptions.",
|
||||||
|
"files_modified": [
|
||||||
|
"src/companion/platformClients.integration.test.ts",
|
||||||
|
"docs/plans/state.json"
|
||||||
|
],
|
||||||
|
"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"
|
||||||
|
},
|
||||||
"browser-tools-activation-clarity": {
|
"browser-tools-activation-clarity": {
|
||||||
"status": "completed",
|
"status": "completed",
|
||||||
"date": "2026-02-17",
|
"date": "2026-02-17",
|
||||||
|
|||||||
@@ -201,6 +201,31 @@ describe('platform clients integration', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('platform cancelPendingEventWaits cancels waits without clearing subscriptions', async () => {
|
||||||
|
if (!LISTEN_ALLOWED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const runtime = createRuntime();
|
||||||
|
const client = new IOSCompanionClient({ runtime, nodeId: 'ios-cancel-waits-e2e' });
|
||||||
|
|
||||||
|
const unsubscribe = client.subscribeEvents(() => undefined);
|
||||||
|
expect(client.eventSubscriptionCount).toBe(1);
|
||||||
|
|
||||||
|
const awaited = expect(
|
||||||
|
client.waitForAnyEvent(['agent.stream'], { timeoutMs: 10_000 }),
|
||||||
|
).rejects.toThrow('manual cancel');
|
||||||
|
expect(client.pendingEventWaitCount).toBe(1);
|
||||||
|
|
||||||
|
client.cancelPendingEventWaits('manual cancel');
|
||||||
|
await awaited;
|
||||||
|
expect(client.pendingEventWaitCount).toBe(0);
|
||||||
|
expect(client.eventSubscriptionCount).toBe(1);
|
||||||
|
|
||||||
|
unsubscribe();
|
||||||
|
expect(client.eventSubscriptionCount).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
it('platform connected reflects runtime connection lifecycle', async () => {
|
it('platform connected reflects runtime connection lifecycle', async () => {
|
||||||
if (!LISTEN_ALLOWED) {
|
if (!LISTEN_ALLOWED) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user