Fix unit test

This commit is contained in:
Hugh Nimmo-Smith 2024-11-18 17:29:41 +00:00
parent f6a641b478
commit 5cae84940e

View File

@ -356,29 +356,29 @@ test("screen sharing activates spotlight layout", () => {
}); });
test("participants stay in the same order unless to appear/disappear", () => { test("participants stay in the same order unless to appear/disappear", () => {
withTestScheduler(({ cold, schedule, expectObservable }) => { withTestScheduler(({ hot, schedule, expectObservable }) => {
const modeMarbles = " g"; const inputModeMarbles = " g";
// First Bob speaks, then Dave, then Alice // First Bob speaks, then Dave, then Alice
const aSpeakingMarbles = "n- 1998ms - 1999ms y"; const inputASpeakingMarbles = "n- 1998ms - 1999ms y";
const bSpeakingMarbles = "ny 1998ms n 1999ms -"; const inputBSpeakingMarbles = "ny 1998ms n 1999ms -";
const dSpeakingMarbles = "n- 1998ms y 1999ms n"; const inputDSpeakingMarbles = "n- 1998ms y 1999ms n";
// Nothing should change when Bob speaks, because Bob is already on screen. // Nothing should change when Bob speaks, because Bob is already on screen.
// When Dave speaks he should switch with Alice because she's the one who // When Dave speaks he should switch with Alice because she's the one who
// hasn't spoken at all. Then when Alice speaks, she should return to her // hasn't spoken at all. Then when Alice speaks, she should return to her
// place at the top. // place at the top.
const layoutMarbles = " a 1999ms b 1999ms a 57999ms c 1999ms a"; const expectedLayoutMarbles = "a 1999ms b 1999ms a 57999ms c 1999ms a";
withCallViewModel( withCallViewModel(
of([aliceParticipant, bobParticipant, daveParticipant]), of([aliceParticipant, bobParticipant, daveParticipant]),
of([aliceRtcMember, bobRtcMember, daveRtcMember]), of([aliceRtcMember, bobRtcMember, daveRtcMember]),
of(ConnectionState.Connected), of(ConnectionState.Connected),
new Map([ new Map([
[aliceParticipant, cold(aSpeakingMarbles, { y: true, n: false })], [aliceParticipant, hot(inputASpeakingMarbles, { y: true, n: false })],
[bobParticipant, cold(bSpeakingMarbles, { y: true, n: false })], [bobParticipant, hot(inputBSpeakingMarbles, { y: true, n: false })],
[daveParticipant, cold(dSpeakingMarbles, { y: true, n: false })], [daveParticipant, hot(inputDSpeakingMarbles, { y: true, n: false })],
]), ]),
(vm) => { (vm) => {
schedule(modeMarbles, { schedule(inputModeMarbles, {
g: () => { g: () => {
// We imagine that only three tiles (the first three) will be visible // We imagine that only three tiles (the first three) will be visible
// on screen at a time // on screen at a time
@ -391,23 +391,26 @@ test("participants stay in the same order unless to appear/disappear", () => {
}, },
}); });
expectObservable(summarizeLayout(vm.layout)).toBe(layoutMarbles, { expectObservable(summarizeLayout(vm.layout)).toBe(
a: { expectedLayoutMarbles,
type: "grid", {
spotlight: undefined, a: {
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`, `${daveId}:0`], type: "grid",
spotlight: undefined,
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`, `${daveId}:0`],
},
b: {
type: "grid",
spotlight: undefined,
grid: ["local:0", `${daveId}:0`, `${bobId}:0`, `${aliceId}:0`],
},
c: {
type: "grid",
spotlight: undefined,
grid: ["local:0", `${aliceId}:0`, `${daveId}:0`, `${bobId}:0`],
},
}, },
b: { );
type: "grid",
spotlight: undefined,
grid: ["local:0", `${daveId}:0`, `${bobId}:0`, `${aliceId}:0`],
},
c: {
type: "grid",
spotlight: undefined,
grid: ["local:0", `${aliceId}:0`, `${daveId}:0`, `${bobId}:0`],
},
});
}, },
); );
}); });