diff --git a/src/state/CallViewModel.test.ts b/src/state/CallViewModel.test.ts index e738a279..bfc6e0c3 100644 --- a/src/state/CallViewModel.test.ts +++ b/src/state/CallViewModel.test.ts @@ -49,21 +49,24 @@ import { MockRoom, MockRTCSession } from "../useReactions.test"; vi.mock("@livekit/components-core"); +const local = mockRoomMember({ userId: "@local:example.org" }); const alice = mockRoomMember({ userId: "@alice:example.org" }); const bob = mockRoomMember({ userId: "@bob:example.org" }); const carol = mockRoomMember({ userId: "@carol:example.org" }); const dave = mockRoomMember({ userId: "@dave:example.org" }); +const localDev = "LLLL"; const aliceDev = "AAAA"; const bobDev = "BBBB"; const carolDev = "CCCC"; const daveDev = "DDDD"; +const localId = `${local.userId}:${localDev}`; const aliceId = `${alice.userId}:${aliceDev}`; const bobId = `${bob.userId}:${bobDev}`; const carolId = `${carol.userId}:${carolDev}`; const daveId = `${dave.userId}:${daveDev}`; -const localParticipant = mockLocalParticipant({ identity: "" }); +const localParticipant = mockLocalParticipant({ identity: localId }); const aliceParticipant = mockRemoteParticipant({ identity: aliceId }); const aliceSharingScreen = mockRemoteParticipant({ @@ -79,6 +82,7 @@ const daveParticipant = mockRemoteParticipant({ identity: daveId }); const members = new Map([alice, bob, carol, dave].map((p) => [p.userId, p])); +const localRtcMember = mockMembership(local, localDev); const aliceRtcMember = mockMembership(alice, aliceDev); const bobRtcMember = mockMembership(bob, bobDev); // const carolRtcMember = mockMembership(carol, carolDev); @@ -268,7 +272,7 @@ test("participants are retained during a focus switch", () => { a: [aliceParticipant, bobParticipant], b: [], }), - of([aliceRtcMember, bobRtcMember]), + of([localRtcMember, aliceRtcMember, bobRtcMember]), cold(connectionMarbles, { c: ConnectionState.Connected, s: ECAddonConnectionState.ECSwitchingFocus, @@ -279,7 +283,7 @@ test("participants are retained during a focus switch", () => { a: { type: "grid", spotlight: undefined, - grid: ["local:0", `${aliceId}:0`, `${bobId}:0`], + grid: [`${localId}:0`, `${aliceId}:0`, `${bobId}:0`], }, }); }, @@ -307,7 +311,7 @@ test("screen sharing activates spotlight layout", () => { c: [aliceSharingScreen, bobSharingScreen], d: [aliceParticipant, bobSharingScreen], }), - of([aliceRtcMember, bobRtcMember]), + of([localRtcMember, aliceRtcMember, bobRtcMember]), of(ConnectionState.Connected), new Map(), (vm) => { @@ -320,37 +324,37 @@ test("screen sharing activates spotlight layout", () => { a: { type: "grid", spotlight: undefined, - grid: ["local:0", `${aliceId}:0`, `${bobId}:0`], + grid: [`${localId}:0`, `${aliceId}:0`, `${bobId}:0`], }, b: { type: "spotlight-landscape", spotlight: [`${aliceId}:0:screen-share`], - grid: ["local:0", `${aliceId}:0`, `${bobId}:0`], + grid: [`${localId}:0`, `${aliceId}:0`, `${bobId}:0`], }, c: { type: "spotlight-landscape", spotlight: [`${aliceId}:0:screen-share`, `${bobId}:0:screen-share`], - grid: ["local:0", `${aliceId}:0`, `${bobId}:0`], + grid: [`${localId}:0`, `${aliceId}:0`, `${bobId}:0`], }, d: { type: "spotlight-landscape", spotlight: [`${bobId}:0:screen-share`], - grid: ["local:0", `${aliceId}:0`, `${bobId}:0`], + grid: [`${localId}:0`, `${aliceId}:0`, `${bobId}:0`], }, e: { type: "spotlight-landscape", spotlight: [`${aliceId}:0`], - grid: ["local:0", `${bobId}:0`], + grid: [`${localId}:0`, `${bobId}:0`], }, f: { type: "spotlight-landscape", spotlight: [`${aliceId}:0:screen-share`], - grid: ["local:0", `${bobId}:0`, `${aliceId}:0`], + grid: [`${localId}:0`, `${bobId}:0`, `${aliceId}:0`], }, g: { type: "grid", spotlight: undefined, - grid: ["local:0", `${bobId}:0`, `${aliceId}:0`], + grid: [`${localId}:0`, `${bobId}:0`, `${aliceId}:0`], }, }); expectObservable(vm.showSpeakingIndicators).toBe(showSpeakingMarbles, { @@ -377,7 +381,7 @@ test("participants stay in the same order unless to appear/disappear", () => { withCallViewModel( of([aliceParticipant, bobParticipant, daveParticipant]), - of([aliceRtcMember, bobRtcMember, daveRtcMember]), + of([localRtcMember, aliceRtcMember, bobRtcMember, daveRtcMember]), of(ConnectionState.Connected), new Map([ [aliceParticipant, cold(aSpeakingMarbles, { y: true, n: false })], @@ -402,17 +406,17 @@ test("participants stay in the same order unless to appear/disappear", () => { a: { type: "grid", spotlight: undefined, - grid: ["local:0", `${aliceId}:0`, `${bobId}:0`, `${daveId}:0`], + grid: [`${localId}:0`, `${aliceId}:0`, `${bobId}:0`, `${daveId}:0`], }, b: { type: "grid", spotlight: undefined, - grid: ["local:0", `${daveId}:0`, `${bobId}:0`, `${aliceId}:0`], + grid: [`${localId}:0`, `${daveId}:0`, `${bobId}:0`, `${aliceId}:0`], }, c: { type: "grid", spotlight: undefined, - grid: ["local:0", `${aliceId}:0`, `${daveId}:0`, `${bobId}:0`], + grid: [`${localId}:0`, `${aliceId}:0`, `${daveId}:0`, `${bobId}:0`], }, }); }, @@ -436,7 +440,7 @@ test("spotlight speakers swap places", () => { withCallViewModel( of([aliceParticipant, bobParticipant, daveParticipant]), - of([aliceRtcMember, bobRtcMember, daveRtcMember]), + of([localRtcMember, aliceRtcMember, bobRtcMember, daveRtcMember]), of(ConnectionState.Connected), new Map([ [aliceParticipant, cold(aSpeakingMarbles, { y: true, n: false })], @@ -450,22 +454,22 @@ test("spotlight speakers swap places", () => { a: { type: "spotlight-landscape", spotlight: [`${aliceId}:0`], - grid: ["local:0", `${bobId}:0`, `${daveId}:0`], + grid: [`${localId}:0`, `${bobId}:0`, `${daveId}:0`], }, b: { type: "spotlight-landscape", spotlight: [`${bobId}:0`], - grid: ["local:0", `${aliceId}:0`, `${daveId}:0`], + grid: [`${localId}:0`, `${aliceId}:0`, `${daveId}:0`], }, c: { type: "spotlight-landscape", spotlight: [`${daveId}:0`], - grid: ["local:0", `${aliceId}:0`, `${bobId}:0`], + grid: [`${localId}:0`, `${aliceId}:0`, `${bobId}:0`], }, d: { type: "spotlight-landscape", spotlight: [`${aliceId}:0`], - grid: ["local:0", `${daveId}:0`, `${bobId}:0`], + grid: [`${localId}:0`, `${daveId}:0`, `${bobId}:0`], }, }); }, @@ -482,7 +486,7 @@ test("layout enters picture-in-picture mode when requested", () => { withCallViewModel( of([aliceParticipant, bobParticipant]), - of([aliceRtcMember, bobRtcMember]), + of([localRtcMember, aliceRtcMember, bobRtcMember]), of(ConnectionState.Connected), new Map(), (vm) => { @@ -495,7 +499,7 @@ test("layout enters picture-in-picture mode when requested", () => { a: { type: "grid", spotlight: undefined, - grid: ["local:0", `${aliceId}:0`, `${bobId}:0`], + grid: [`${localId}:0`, `${aliceId}:0`, `${bobId}:0`], }, b: { type: "pip", @@ -520,7 +524,7 @@ test("spotlight remembers whether it's expanded", () => { withCallViewModel( of([aliceParticipant, bobParticipant]), - of([aliceRtcMember, bobRtcMember]), + of([localRtcMember, aliceRtcMember, bobRtcMember]), of(ConnectionState.Connected), new Map(), (vm) => { @@ -540,22 +544,22 @@ test("spotlight remembers whether it's expanded", () => { a: { type: "spotlight-landscape", spotlight: [`${aliceId}:0`], - grid: ["local:0", `${bobId}:0`], + grid: [`${localId}:0`, `${bobId}:0`], }, b: { type: "spotlight-expanded", spotlight: [`${aliceId}:0`], - pip: "local:0", + pip: `${localId}:0`, }, c: { type: "grid", spotlight: undefined, - grid: ["local:0", `${aliceId}:0`, `${bobId}:0`], + grid: [`${localId}:0`, `${aliceId}:0`, `${bobId}:0`], }, d: { type: "grid", spotlight: undefined, - grid: ["local:0", `${bobId}:0`, `${aliceId}:0`], + grid: [`${localId}:0`, `${bobId}:0`, `${aliceId}:0`], }, }); },