test(companion): add platform waitForIdle integration coverage
This commit is contained in:
@@ -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