From 2a7c6c3c06f6b50fe5d521e01bea0b21ebcd26fe Mon Sep 17 00:00:00 2001 From: "Timo K." Date: Fri, 28 Aug 2026 16:22:08 +0200 Subject: [PATCH] Oh dear test coverage... --- src/room/InCallView.test.tsx | 64 ++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 14 deletions(-) diff --git a/src/room/InCallView.test.tsx b/src/room/InCallView.test.tsx index eafb54c55..3113c0727 100644 --- a/src/room/InCallView.test.tsx +++ b/src/room/InCallView.test.tsx @@ -22,7 +22,7 @@ import { TooltipProvider } from "@vector-im/compound-web"; import { RoomContext, useLocalParticipant } from "@livekit/components-react"; import userEvent from "@testing-library/user-event"; -import { InCallView } from "./InCallView"; +import { ActiveCall, InCallView } from "./InCallView"; import { mockLivekitRoom, mockLocalParticipant, @@ -33,7 +33,10 @@ import { type MockRTCSession, } from "../utils/test"; import { E2eeType } from "../e2ee/e2eeType"; -import { getBasicCallViewModelEnvironment } from "../utils/test-viewmodel"; +import { + getBasicCallViewModelEnvironment, + getBasicRTCSession, +} from "../utils/test-viewmodel"; import { type CallViewModel, type CallViewModelOptions, @@ -45,6 +48,8 @@ import { LivekitRoomAudioRenderer } from "../livekit/MatrixAudioRenderer"; import { MediaDevicesContext } from "../MediaDevicesContext"; import { type MediaDevices as ECMediaDevices } from "../state/MediaDevices"; import { AppBar } from "../AppBar"; +import { type MatrixInfo } from "./VideoPreview"; +import { ProcessorProvider } from "../livekit/TrackProcessorContext"; import { initializeWidget } from "../widget"; initializeWidget(); @@ -78,6 +83,17 @@ const remoteParticipant = mockRemoteParticipant({ identity: "@alice:example.org:AAAAAA", }); +const matrixInfo = { + userId: "", + displayName: "", + avatarUrl: "", + roomId: "", + roomName: "", + roomAlias: null, + roomAvatar: null, + e2eeSystem: { kind: E2eeType.NONE }, +} satisfies MatrixInfo; + let useRoomEncryptionSystemMock: MockedFunction; beforeEach(() => { @@ -142,18 +158,7 @@ function createInCallView(args: CreateInCallViewArgs = {}): RenderResult & { vm={vm} footerVm={footerVm} developerSettingsVm={developerSettingsVm} - matrixInfo={{ - userId: "", - displayName: "", - avatarUrl: "", - roomId: "", - roomName: "", - roomAlias: null, - roomAvatar: null, - e2eeSystem: { - kind: E2eeType.NONE, - }, - }} + matrixInfo={matrixInfo} matrixRoom={room} onShareClick={null} /> @@ -228,3 +233,34 @@ describe("InCallView", () => { }); }); }); + +describe("ActiveCall", () => { + it("creates the view models and renders the call", async () => { + const mediaDevices = mockMediaDevices({}); + const { rtcSession, matrixRoom } = getBasicRTCSession([local, alice]); + const { findByTestId } = render( + + + + + + {}} + /> + + + + + , + ); + // Rendering at all proves ActiveCall created all of its view models + expect(await findByTestId("incall_leave")).toBeVisible(); + }); +});