diff --git a/src/state/CallViewModel.test.ts b/src/state/CallViewModel.test.ts index 65449bf9..8d4904e6 100644 --- a/src/state/CallViewModel.test.ts +++ b/src/state/CallViewModel.test.ts @@ -984,7 +984,7 @@ test("should strip RTL characters from displayname", () => { }); it("should rank raised hands above video feeds and below speakers and presenters", () => { - withTestScheduler(({ schedule, expectObservable }) => { + withTestScheduler(({ schedule, expectObservable, behavior }) => { // There should always be one tile for each MatrixRTCSession const expectedLayoutMarbles = "ab"; @@ -1083,11 +1083,11 @@ function rtcMemberJoinLeave$( } test("allOthersLeft$ emits only when someone joined and then all others left", () => { - withTestScheduler(({ hot, expectObservable }) => { + withTestScheduler(({ hot, expectObservable, scope }) => { // Test scenario 1: No one ever joins - should only emit initial false and never emit again withCallViewModel( - nooneEverThere$(hot), - nooneEverThere$(hot), + scope.behavior(nooneEverThere$(hot), []), + scope.behavior(nooneEverThere$(hot), []), of(ConnectionState.Connected), new Map(), mockMediaDevices({}), @@ -1099,10 +1099,10 @@ test("allOthersLeft$ emits only when someone joined and then all others left", ( }); test("allOthersLeft$ emits true when someone joined and then all others left", () => { - withTestScheduler(({ hot, expectObservable }) => { + withTestScheduler(({ hot, expectObservable, scope }) => { withCallViewModel( - participantJoinLeave$(hot), - rtcMemberJoinLeave$(hot), + scope.behavior(participantJoinLeave$(hot), []), + scope.behavior(rtcMemberJoinLeave$(hot), []), of(ConnectionState.Connected), new Map(), mockMediaDevices({}), @@ -1117,10 +1117,10 @@ test("allOthersLeft$ emits true when someone joined and then all others left", ( }); test("autoLeaveWhenOthersLeft$ emits only when autoLeaveWhenOthersLeft option is enabled", () => { - withTestScheduler(({ hot, expectObservable }) => { + withTestScheduler(({ hot, expectObservable, scope }) => { withCallViewModel( - participantJoinLeave$(hot), - rtcMemberJoinLeave$(hot), + scope.behavior(participantJoinLeave$(hot), []), + scope.behavior(rtcMemberJoinLeave$(hot), []), of(ConnectionState.Connected), new Map(), mockMediaDevices({}), @@ -1139,10 +1139,10 @@ test("autoLeaveWhenOthersLeft$ emits only when autoLeaveWhenOthersLeft option is }); test("autoLeaveWhenOthersLeft$ never emits autoLeaveWhenOthersLeft option is enabled but noone is there", () => { - withTestScheduler(({ hot, expectObservable }) => { + withTestScheduler(({ hot, expectObservable, scope }) => { withCallViewModel( - nooneEverThere$(hot), - nooneEverThere$(hot), + scope.behavior(nooneEverThere$(hot), []), + scope.behavior(nooneEverThere$(hot), []), of(ConnectionState.Connected), new Map(), mockMediaDevices({}), @@ -1160,10 +1160,10 @@ test("autoLeaveWhenOthersLeft$ never emits autoLeaveWhenOthersLeft option is ena }); test("autoLeaveWhenOthersLeft$ emits when autoLeaveWhenOthersLeft option is enabled and all others left", () => { - withTestScheduler(({ hot, expectObservable }) => { + withTestScheduler(({ hot, expectObservable, scope }) => { withCallViewModel( - participantJoinLeave$(hot), - rtcMemberJoinLeave$(hot), + scope.behavior(participantJoinLeave$(hot), []), + scope.behavior(rtcMemberJoinLeave$(hot), []), of(ConnectionState.Connected), new Map(), mockMediaDevices({}), diff --git a/src/utils/test.ts b/src/utils/test.ts index cad2b521..ce964ee8 100644 --- a/src/utils/test.ts +++ b/src/utils/test.ts @@ -74,6 +74,7 @@ export interface OurRunHelpers extends RunHelpers { values?: { [marble: string]: T }, error?: unknown, ): Behavior; + scope: ObservableScope; } interface TestRunnerGlobal { @@ -96,6 +97,7 @@ export function withTestScheduler( scheduler.run((helpers) => continuation({ ...helpers, + scope, schedule(marbles, actions) { const actionsObservable$ = helpers .cold(marbles)