Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core/test: revert occupancy test changes #383

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions test/core/occupancy.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});

Expand All @@ -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,
});
});
Expand Down Expand Up @@ -141,7 +140,7 @@ describe('occupancy', () => {
await waitForExpectedInbandOccupancy(
occupancyUpdates,
{
connections: 3,
connections: 2,
presenceMembers: 1,
},
TEST_TIMEOUT,
Expand Down
6 changes: 3 additions & 3 deletions test/react/hooks/use-occupancy.integration.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ describe('useOccupancy', () => {
render(<TestProvider />);

// 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);
});
});
Loading