test(companion): add platform waitForIdle integration coverage
This commit is contained in:
@@ -916,6 +916,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"
|
||||
},
|
||||
"companion-platform-wait-for-idle-integration-coverage": {
|
||||
"status": "completed",
|
||||
"date": "2026-02-17",
|
||||
"updated": "2026-02-17",
|
||||
"summary": "Added platform integration coverage for `waitForIdle()` to verify idle-drain synchronization resolves after pending event waiters are cleared via platform wrapper APIs.",
|
||||
"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": {
|
||||
"status": "completed",
|
||||
"date": "2026-02-17",
|
||||
|
||||
@@ -150,6 +150,27 @@ describe('platform clients integration', () => {
|
||||
expect(client.pendingEventWaitCount).toBe(0);
|
||||
});
|
||||
|
||||
it('platform waitForIdle resolves after pending waiters are cleared', async () => {
|
||||
if (!LISTEN_ALLOWED) {
|
||||
return;
|
||||
}
|
||||
|
||||
const runtime = createRuntime();
|
||||
const client = new IOSCompanionClient({ runtime, nodeId: 'ios-wait-idle-e2e' });
|
||||
|
||||
const pending = client.waitForAnyEvent(['agent.stream'], { timeoutMs: 10_000 }).catch(() => undefined);
|
||||
expect(client.hasPendingWork).toBe(true);
|
||||
|
||||
const idle = client.waitForIdle({ timeoutMs: 1_000, pollIntervalMs: 5 });
|
||||
setTimeout(() => {
|
||||
client.clearEventSubscriptions();
|
||||
}, 20);
|
||||
|
||||
await expect(idle).resolves.toBeUndefined();
|
||||
await pending;
|
||||
expect(client.hasPendingWork).toBe(false);
|
||||
});
|
||||
|
||||
it('platform connected reflects runtime connection lifecycle', async () => {
|
||||
if (!LISTEN_ALLOWED) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user