Skip to content

Commit b292450

Browse files
committed
get rid of more memberhsip manager usage in tests
1 parent e9c23e2 commit b292450

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

spec/unit/matrixrtc/MatrixRTCSession.spec.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,6 @@ describe("MatrixRTCSession", () => {
426426
type: "livekit",
427427
},
428428
},
429-
430429
"_@alice:example.org_AAAAAAA",
431430
);
432431
await Promise.race([sentDelayedState, new Promise((resolve) => realSetTimeout(resolve, 500))]);
@@ -458,6 +457,7 @@ describe("MatrixRTCSession", () => {
458457
});
459458
});
460459

460+
const userStateKey = `${!useOwnedStateEvents ? "_" : ""}@alice:example.org_AAAAAAA`;
461461
// preparing the delayed disconnect should handle ratelimiting
462462
const sendDelayedStateAttempt = new Promise<void>((resolve) => {
463463
const error = new MatrixError({ errcode: "M_LIMIT_EXCEEDED" });
@@ -481,16 +481,19 @@ describe("MatrixRTCSession", () => {
481481
return Promise.reject(error);
482482
});
483483
});
484-
// needed to join so that myMembershipManager gets created
484+
485485
sess!.joinRoomSession([activeFocusConfig], activeFocus, {
486486
membershipServerSideExpiryTimeout: 9000,
487487
});
488488

489-
expect((sess as any).membershipManager).toHaveProperty("membershipServerSideExpiryTimeout", 9000);
490489
await sendDelayedStateExceedAttempt.then(); // needed to resolve after the send attempt catches
491-
expect((sess as any).membershipManager).toHaveProperty("membershipServerSideExpiryTimeout", 7500);
492-
493490
await sendDelayedStateAttempt;
491+
const callProps = (d: number) => {
492+
return [mockRoom!.roomId, { delay: d }, "org.matrix.msc3401.call.member", {}, userStateKey];
493+
};
494+
expect(client._unstable_sendDelayedStateEvent).toHaveBeenNthCalledWith(1, ...callProps(9000));
495+
expect(client._unstable_sendDelayedStateEvent).toHaveBeenNthCalledWith(2, ...callProps(7500));
496+
494497
jest.advanceTimersByTime(5000);
495498

496499
await sendStateEventAttempt.then(); // needed to resolve after resendIfRateLimited catches
@@ -509,7 +512,7 @@ describe("MatrixRTCSession", () => {
509512
foci_preferred: [activeFocusConfig],
510513
focus_active: activeFocus,
511514
} satisfies SessionMembershipData,
512-
`${!useOwnedStateEvents ? "_" : ""}@alice:example.org_AAAAAAA`,
515+
userStateKey,
513516
);
514517
await sentDelayedState;
515518

0 commit comments

Comments
 (0)