test(companion): add pending work snapshot integration coverage
This commit is contained in:
@@ -171,6 +171,36 @@ describe('platform clients integration', () => {
|
||||
expect(client.hasPendingWork).toBe(false);
|
||||
});
|
||||
|
||||
it('platform getPendingWorkSnapshot reflects waiter lifecycle', async () => {
|
||||
if (!LISTEN_ALLOWED) {
|
||||
return;
|
||||
}
|
||||
|
||||
const runtime = createRuntime();
|
||||
const client = new IOSCompanionClient({ runtime, nodeId: 'ios-snapshot-e2e' });
|
||||
|
||||
expect(client.getPendingWorkSnapshot()).toEqual({
|
||||
pendingRequestCount: 0,
|
||||
pendingEventWaitCount: 0,
|
||||
hasPendingWork: false,
|
||||
});
|
||||
|
||||
const pending = client.waitForAnyEvent(['agent.stream'], { timeoutMs: 10_000 }).catch(() => undefined);
|
||||
expect(client.getPendingWorkSnapshot()).toEqual({
|
||||
pendingRequestCount: 0,
|
||||
pendingEventWaitCount: 1,
|
||||
hasPendingWork: true,
|
||||
});
|
||||
|
||||
client.clearEventSubscriptions();
|
||||
await pending;
|
||||
expect(client.getPendingWorkSnapshot()).toEqual({
|
||||
pendingRequestCount: 0,
|
||||
pendingEventWaitCount: 0,
|
||||
hasPendingWork: false,
|
||||
});
|
||||
});
|
||||
|
||||
it('platform connected reflects runtime connection lifecycle', async () => {
|
||||
if (!LISTEN_ALLOWED) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user