test(companion): add platform event subscription lifecycle integration
This commit is contained in:
@@ -772,6 +772,17 @@
|
||||
],
|
||||
"test_status": "pnpm test:run src/companion/heartbeatLoop.test.ts src/companion/platformClients.test.ts src/companion/runtimeClient.test.ts src/companion/platformClients.integration.test.ts + pnpm typecheck passing"
|
||||
},
|
||||
"companion-platform-event-subscription-observability-integration": {
|
||||
"status": "completed",
|
||||
"date": "2026-02-17",
|
||||
"updated": "2026-02-17",
|
||||
"summary": "Added integration coverage for platform event subscription observability lifecycle, verifying `eventSubscriptionCount` behavior across subscribe, unsubscribe, and `clearEventSubscriptions()` operations.",
|
||||
"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"
|
||||
},
|
||||
"companion-runtime-socket-close-waiter-rejection": {
|
||||
"status": "completed",
|
||||
"date": "2026-02-17",
|
||||
|
||||
@@ -108,6 +108,29 @@ function createRuntime(): CompanionRuntimeClient {
|
||||
}
|
||||
|
||||
describe('platform clients integration', () => {
|
||||
it('platform event subscription helpers track subscription count lifecycle', async () => {
|
||||
if (!LISTEN_ALLOWED) {
|
||||
return;
|
||||
}
|
||||
|
||||
const runtime = createRuntime();
|
||||
const client = new MacOSCompanionClient({ runtime, nodeId: 'macos-events-e2e' });
|
||||
|
||||
expect(client.eventSubscriptionCount).toBe(0);
|
||||
const unsubscribeA = client.subscribeEvents(() => undefined);
|
||||
const unsubscribeB = client.subscribeEvent('agent.stream', () => undefined);
|
||||
expect(client.eventSubscriptionCount).toBe(2);
|
||||
|
||||
unsubscribeA();
|
||||
expect(client.eventSubscriptionCount).toBe(1);
|
||||
|
||||
client.clearEventSubscriptions();
|
||||
expect(client.eventSubscriptionCount).toBe(0);
|
||||
|
||||
unsubscribeB();
|
||||
expect(client.eventSubscriptionCount).toBe(0);
|
||||
});
|
||||
|
||||
it('platform connected reflects runtime connection lifecycle', async () => {
|
||||
if (!LISTEN_ALLOWED) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user