mirror of
https://github.com/vector-im/element-call.git
synced 2026-07-18 18:59:23 +00:00
fix scope in CallViewModel tests
Signed-off-by: Timo K <toger5@hotmail.de>
This commit is contained in:
@@ -984,7 +984,7 @@ test("should strip RTL characters from displayname", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should rank raised hands above video feeds and below speakers and presenters", () => {
|
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
|
// There should always be one tile for each MatrixRTCSession
|
||||||
const expectedLayoutMarbles = "ab";
|
const expectedLayoutMarbles = "ab";
|
||||||
|
|
||||||
@@ -1083,11 +1083,11 @@ function rtcMemberJoinLeave$(
|
|||||||
}
|
}
|
||||||
|
|
||||||
test("allOthersLeft$ emits only when someone joined and then all others left", () => {
|
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
|
// Test scenario 1: No one ever joins - should only emit initial false and never emit again
|
||||||
withCallViewModel(
|
withCallViewModel(
|
||||||
nooneEverThere$(hot),
|
scope.behavior(nooneEverThere$(hot), []),
|
||||||
nooneEverThere$(hot),
|
scope.behavior(nooneEverThere$(hot), []),
|
||||||
of(ConnectionState.Connected),
|
of(ConnectionState.Connected),
|
||||||
new Map(),
|
new Map(),
|
||||||
mockMediaDevices({}),
|
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", () => {
|
test("allOthersLeft$ emits true when someone joined and then all others left", () => {
|
||||||
withTestScheduler(({ hot, expectObservable }) => {
|
withTestScheduler(({ hot, expectObservable, scope }) => {
|
||||||
withCallViewModel(
|
withCallViewModel(
|
||||||
participantJoinLeave$(hot),
|
scope.behavior(participantJoinLeave$(hot), []),
|
||||||
rtcMemberJoinLeave$(hot),
|
scope.behavior(rtcMemberJoinLeave$(hot), []),
|
||||||
of(ConnectionState.Connected),
|
of(ConnectionState.Connected),
|
||||||
new Map(),
|
new Map(),
|
||||||
mockMediaDevices({}),
|
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", () => {
|
test("autoLeaveWhenOthersLeft$ emits only when autoLeaveWhenOthersLeft option is enabled", () => {
|
||||||
withTestScheduler(({ hot, expectObservable }) => {
|
withTestScheduler(({ hot, expectObservable, scope }) => {
|
||||||
withCallViewModel(
|
withCallViewModel(
|
||||||
participantJoinLeave$(hot),
|
scope.behavior(participantJoinLeave$(hot), []),
|
||||||
rtcMemberJoinLeave$(hot),
|
scope.behavior(rtcMemberJoinLeave$(hot), []),
|
||||||
of(ConnectionState.Connected),
|
of(ConnectionState.Connected),
|
||||||
new Map(),
|
new Map(),
|
||||||
mockMediaDevices({}),
|
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", () => {
|
test("autoLeaveWhenOthersLeft$ never emits autoLeaveWhenOthersLeft option is enabled but noone is there", () => {
|
||||||
withTestScheduler(({ hot, expectObservable }) => {
|
withTestScheduler(({ hot, expectObservable, scope }) => {
|
||||||
withCallViewModel(
|
withCallViewModel(
|
||||||
nooneEverThere$(hot),
|
scope.behavior(nooneEverThere$(hot), []),
|
||||||
nooneEverThere$(hot),
|
scope.behavior(nooneEverThere$(hot), []),
|
||||||
of(ConnectionState.Connected),
|
of(ConnectionState.Connected),
|
||||||
new Map(),
|
new Map(),
|
||||||
mockMediaDevices({}),
|
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", () => {
|
test("autoLeaveWhenOthersLeft$ emits when autoLeaveWhenOthersLeft option is enabled and all others left", () => {
|
||||||
withTestScheduler(({ hot, expectObservable }) => {
|
withTestScheduler(({ hot, expectObservable, scope }) => {
|
||||||
withCallViewModel(
|
withCallViewModel(
|
||||||
participantJoinLeave$(hot),
|
scope.behavior(participantJoinLeave$(hot), []),
|
||||||
rtcMemberJoinLeave$(hot),
|
scope.behavior(rtcMemberJoinLeave$(hot), []),
|
||||||
of(ConnectionState.Connected),
|
of(ConnectionState.Connected),
|
||||||
new Map(),
|
new Map(),
|
||||||
mockMediaDevices({}),
|
mockMediaDevices({}),
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ export interface OurRunHelpers extends RunHelpers {
|
|||||||
values?: { [marble: string]: T },
|
values?: { [marble: string]: T },
|
||||||
error?: unknown,
|
error?: unknown,
|
||||||
): Behavior<T>;
|
): Behavior<T>;
|
||||||
|
scope: ObservableScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TestRunnerGlobal {
|
interface TestRunnerGlobal {
|
||||||
@@ -96,6 +97,7 @@ export function withTestScheduler(
|
|||||||
scheduler.run((helpers) =>
|
scheduler.run((helpers) =>
|
||||||
continuation({
|
continuation({
|
||||||
...helpers,
|
...helpers,
|
||||||
|
scope,
|
||||||
schedule(marbles, actions) {
|
schedule(marbles, actions) {
|
||||||
const actionsObservable$ = helpers
|
const actionsObservable$ = helpers
|
||||||
.cold(marbles)
|
.cold(marbles)
|
||||||
|
|||||||
Reference in New Issue
Block a user