diff --git a/src/button/ReactionToggleButton.test.tsx b/src/button/ReactionToggleButton.test.tsx index a2e74f56..3b941def 100644 --- a/src/button/ReactionToggleButton.test.tsx +++ b/src/button/ReactionToggleButton.test.tsx @@ -53,8 +53,11 @@ test("Can open menu", async () => { test("Can raise hand", async () => { const user = userEvent.setup(); - const { vm, rtcSession, handRaisedSubject } = - getBasicCallViewModelEnvironment([local, alice]); + const { + vm, + rtcSession, + handRaisedSubject$: handRaisedSubject, + } = getBasicCallViewModelEnvironment([local, alice]); const { getByLabelText, container } = render( , ); @@ -87,8 +90,11 @@ test("Can raise hand", async () => { test("Can lower hand", async () => { const reactionEventId = "$my-reaction-event:example.org"; const user = userEvent.setup(); - const { vm, rtcSession, handRaisedSubject } = - getBasicCallViewModelEnvironment([local, alice]); + const { + vm, + rtcSession, + handRaisedSubject$: handRaisedSubject, + } = getBasicCallViewModelEnvironment([local, alice]); const { getByLabelText, container } = render( , ); diff --git a/src/room/CallEventAudioRenderer.test.tsx b/src/room/CallEventAudioRenderer.test.tsx index 6237bcdf..16bf3b68 100644 --- a/src/room/CallEventAudioRenderer.test.tsx +++ b/src/room/CallEventAudioRenderer.test.tsx @@ -66,10 +66,8 @@ beforeEach(() => { * a noise every time. */ test("plays one sound when entering a call", () => { - const { vm, remoteRtcMemberships } = getBasicCallViewModelEnvironment([ - local, - alice, - ]); + const { vm, remoteRtcMemberships$: remoteRtcMemberships } = + getBasicCallViewModelEnvironment([local, alice]); render(); // Joining a call usually means remote participants are added later. @@ -80,10 +78,8 @@ test("plays one sound when entering a call", () => { }); test("plays a sound when a user joins", () => { - const { vm, remoteRtcMemberships } = getBasicCallViewModelEnvironment([ - local, - alice, - ]); + const { vm, remoteRtcMemberships$: remoteRtcMemberships } = + getBasicCallViewModelEnvironment([local, alice]); render(); act(() => { @@ -94,10 +90,8 @@ test("plays a sound when a user joins", () => { }); test("plays a sound when a user leaves", () => { - const { vm, remoteRtcMemberships } = getBasicCallViewModelEnvironment([ - local, - alice, - ]); + const { vm, remoteRtcMemberships$: remoteRtcMemberships } = + getBasicCallViewModelEnvironment([local, alice]); render(); act(() => { @@ -114,10 +108,8 @@ test("plays no sound when the participant list is more than the maximum size", ( ); } - const { vm, remoteRtcMemberships } = getBasicCallViewModelEnvironment( - [local, alice], - mockRtcMemberships, - ); + const { vm, remoteRtcMemberships$: remoteRtcMemberships } = + getBasicCallViewModelEnvironment([local, alice], mockRtcMemberships); render(); expect(playSound).not.toBeCalled(); @@ -130,10 +122,8 @@ test("plays no sound when the participant list is more than the maximum size", ( }); test("plays one sound when a hand is raised", () => { - const { vm, handRaisedSubject } = getBasicCallViewModelEnvironment([ - local, - alice, - ]); + const { vm, handRaisedSubject$: handRaisedSubject } = + getBasicCallViewModelEnvironment([local, alice]); render(); act(() => { @@ -149,10 +139,8 @@ test("plays one sound when a hand is raised", () => { }); test("should not play a sound when a hand raise is retracted", () => { - const { vm, handRaisedSubject } = getBasicCallViewModelEnvironment([ - local, - alice, - ]); + const { vm, handRaisedSubject$: handRaisedSubject } = + getBasicCallViewModelEnvironment([local, alice]); render(); act(() => { diff --git a/src/room/ReactionAudioRenderer.test.tsx b/src/room/ReactionAudioRenderer.test.tsx index e7ea018c..a9039211 100644 --- a/src/room/ReactionAudioRenderer.test.tsx +++ b/src/room/ReactionAudioRenderer.test.tsx @@ -80,10 +80,8 @@ test("preloads all audio elements", () => { }); test("will play an audio sound when there is a reaction", () => { - const { vm, reactionsSubject } = getBasicCallViewModelEnvironment([ - local, - alice, - ]); + const { vm, reactionsSubject$: reactionsSubject } = + getBasicCallViewModelEnvironment([local, alice]); playReactionsSound.setValue(true); render(); @@ -103,10 +101,8 @@ test("will play an audio sound when there is a reaction", () => { }); test("will play the generic audio sound when there is soundless reaction", () => { - const { vm, reactionsSubject } = getBasicCallViewModelEnvironment([ - local, - alice, - ]); + const { vm, reactionsSubject$: reactionsSubject } = + getBasicCallViewModelEnvironment([local, alice]); playReactionsSound.setValue(true); render(); @@ -126,10 +122,8 @@ test("will play the generic audio sound when there is soundless reaction", () => }); test("will play multiple audio sounds when there are multiple different reactions", () => { - const { vm, reactionsSubject } = getBasicCallViewModelEnvironment([ - local, - alice, - ]); + const { vm, reactionsSubject$: reactionsSubject } = + getBasicCallViewModelEnvironment([local, alice]); playReactionsSound.setValue(true); render(); diff --git a/src/room/ReactionsOverlay.test.tsx b/src/room/ReactionsOverlay.test.tsx index d0510744..f7866025 100644 --- a/src/room/ReactionsOverlay.test.tsx +++ b/src/room/ReactionsOverlay.test.tsx @@ -34,10 +34,8 @@ test("defaults to showing no reactions", () => { test("shows a reaction when sent", () => { showReactions.setValue(true); - const { vm, reactionsSubject } = getBasicCallViewModelEnvironment([ - local, - alice, - ]); + const { vm, reactionsSubject$: reactionsSubject } = + getBasicCallViewModelEnvironment([local, alice]); const { getByRole } = render(); const reaction = ReactionSet[0]; act(() => { @@ -53,10 +51,8 @@ test("shows a reaction when sent", () => { test("shows two of the same reaction when sent", () => { showReactions.setValue(true); const reaction = ReactionSet[0]; - const { vm, reactionsSubject } = getBasicCallViewModelEnvironment([ - local, - alice, - ]); + const { vm, reactionsSubject$: reactionsSubject } = + getBasicCallViewModelEnvironment([local, alice]); const { getAllByRole } = render(); act(() => { reactionsSubject.next({ @@ -70,10 +66,8 @@ test("shows two of the same reaction when sent", () => { test("shows two different reactions when sent", () => { showReactions.setValue(true); const [reactionA, reactionB] = ReactionSet; - const { vm, reactionsSubject } = getBasicCallViewModelEnvironment([ - local, - alice, - ]); + const { vm, reactionsSubject$: reactionsSubject } = + getBasicCallViewModelEnvironment([local, alice]); const { getAllByRole } = render(); act(() => { reactionsSubject.next({ @@ -89,10 +83,8 @@ test("shows two different reactions when sent", () => { test("hides reactions when reaction animations are disabled", () => { showReactions.setValue(false); const reaction = ReactionSet[0]; - const { vm, reactionsSubject } = getBasicCallViewModelEnvironment([ - local, - alice, - ]); + const { vm, reactionsSubject$: reactionsSubject } = + getBasicCallViewModelEnvironment([local, alice]); const { container } = render(); act(() => { reactionsSubject.next({ diff --git a/src/tile/GridTile.tsx b/src/tile/GridTile.tsx index 4e8e1fcf..b37bc85c 100644 --- a/src/tile/GridTile.tsx +++ b/src/tile/GridTile.tsx @@ -98,7 +98,7 @@ const UserMediaTile = forwardRef( [vm], ); const handRaised = useObservableState(vm.handRaised); - const reaction = useObservableState(vm.reactions); + const reaction = useObservableState(vm.reaction); const AudioIcon = locallyMuted ? VolumeOffSolidIcon diff --git a/src/utils/test-viewmodel.ts b/src/utils/test-viewmodel.ts index 761ce6c5..6f69cde6 100644 --- a/src/utils/test-viewmodel.ts +++ b/src/utils/test-viewmodel.ts @@ -38,17 +38,17 @@ export function getBasicCallViewModelEnvironment( initialRemoteRtcMemberships: CallMembership[] = [aliceRtcMember], ): { vm: CallViewModel; - remoteRtcMemberships: BehaviorSubject; + remoteRtcMemberships$: BehaviorSubject; rtcSession: MockRTCSession; - handRaisedSubject: BehaviorSubject>; - reactionsSubject: BehaviorSubject>; + handRaisedSubject$: BehaviorSubject>; + reactionsSubject$: BehaviorSubject>; } { const matrixRoomId = "!myRoomId:example.com"; const matrixRoomMembers = new Map(members.map((p) => [p.userId, p])); - const remoteParticipants = of([aliceParticipant]); + const remoteParticipants$ = of([aliceParticipant]); const liveKitRoom = mockLivekitRoom( { localParticipant }, - { remoteParticipants }, + { remoteParticipants$ }, ); const matrixRoom = mockMatrixRoom({ relations: { @@ -90,9 +90,9 @@ export function getBasicCallViewModelEnvironment( ); return { vm, - remoteRtcMemberships, + remoteRtcMemberships$: remoteRtcMemberships, rtcSession, - handRaisedSubject, - reactionsSubject, + handRaisedSubject$: handRaisedSubject, + reactionsSubject$: reactionsSubject, }; }