From ecb6c034e4f4527923a2f773722378bcf6c7625a Mon Sep 17 00:00:00 2001 From: Andy Ford Date: Wed, 30 Oct 2024 17:02:38 +0000 Subject: [PATCH] core/test: revert occupancy test changes Now that underlying changes have been effected on the server, we no longer need to account for the +1 in occupancy, so these tests can be revereted to their previous state. --- test/core/occupancy.integration.test.ts | 9 ++++----- test/react/hooks/use-occupancy.integration.test.tsx | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/test/core/occupancy.integration.test.ts b/test/core/occupancy.integration.test.ts index bdf3a666..c4fb0f75 100644 --- a/test/core/occupancy.integration.test.ts +++ b/test/core/occupancy.integration.test.ts @@ -86,9 +86,8 @@ describe('occupancy', () => { await subscriberRealtimeChannel.presence.enter({ foo: 'bar' }); // Wait for the occupancy to reach the expected occupancy - // We get an extra 1 from inside Realtime, so expect 3 await waitForExpectedInstantaneousOccupancy(room, { - connections: 3, + connections: 2, presenceMembers: 1, }); @@ -99,9 +98,9 @@ describe('occupancy', () => { await subscriberRealtimeChannel.detach(); await realtimeChannel.detach(); - // We'll get 1 connection from the channel until resources clean up in realtime, so expect that and end here + // Everything should be back to 0 await waitForExpectedInstantaneousOccupancy(room, { - connections: 1, + connections: 0, presenceMembers: 0, }); }); @@ -141,7 +140,7 @@ describe('occupancy', () => { await waitForExpectedInbandOccupancy( occupancyUpdates, { - connections: 3, + connections: 2, presenceMembers: 1, }, TEST_TIMEOUT, diff --git a/test/react/hooks/use-occupancy.integration.test.tsx b/test/react/hooks/use-occupancy.integration.test.tsx index a408ad2e..dfea9264 100644 --- a/test/react/hooks/use-occupancy.integration.test.tsx +++ b/test/react/hooks/use-occupancy.integration.test.tsx @@ -61,16 +61,16 @@ describe('useOccupancy', () => { render(); // if we already have expected occupancy, then we don't need to wait for the event - const expectedOccupancy = { connections: 4, presenceMembers: 2 }; + const expectedOccupancy = { connections: 3, presenceMembers: 2 }; if (dequal(expectedOccupancy, occupancyState)) { return; } // we don't have the requested occupancy yet, so wait for the occupancy events to be received - await waitForExpectedInbandOccupancy(occupancyEvents, { connections: 4, presenceMembers: 2 }, 20000); + await waitForExpectedInbandOccupancy(occupancyEvents, { connections: 3, presenceMembers: 2 }, 20000); // check the occupancy metrics - expect(occupancyState.connections).toBe(4); + expect(occupancyState.connections).toBe(3); expect(occupancyState.presenceMembers).toBe(2); }); });