mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-29 21:15:19 +00:00
Oh dear test coverage...
This commit is contained in:
@@ -22,7 +22,7 @@ import { TooltipProvider } from "@vector-im/compound-web";
|
|||||||
import { RoomContext, useLocalParticipant } from "@livekit/components-react";
|
import { RoomContext, useLocalParticipant } from "@livekit/components-react";
|
||||||
import userEvent from "@testing-library/user-event";
|
import userEvent from "@testing-library/user-event";
|
||||||
|
|
||||||
import { InCallView } from "./InCallView";
|
import { ActiveCall, InCallView } from "./InCallView";
|
||||||
import {
|
import {
|
||||||
mockLivekitRoom,
|
mockLivekitRoom,
|
||||||
mockLocalParticipant,
|
mockLocalParticipant,
|
||||||
@@ -33,7 +33,10 @@ import {
|
|||||||
type MockRTCSession,
|
type MockRTCSession,
|
||||||
} from "../utils/test";
|
} from "../utils/test";
|
||||||
import { E2eeType } from "../e2ee/e2eeType";
|
import { E2eeType } from "../e2ee/e2eeType";
|
||||||
import { getBasicCallViewModelEnvironment } from "../utils/test-viewmodel";
|
import {
|
||||||
|
getBasicCallViewModelEnvironment,
|
||||||
|
getBasicRTCSession,
|
||||||
|
} from "../utils/test-viewmodel";
|
||||||
import {
|
import {
|
||||||
type CallViewModel,
|
type CallViewModel,
|
||||||
type CallViewModelOptions,
|
type CallViewModelOptions,
|
||||||
@@ -45,6 +48,8 @@ import { LivekitRoomAudioRenderer } from "../livekit/MatrixAudioRenderer";
|
|||||||
import { MediaDevicesContext } from "../MediaDevicesContext";
|
import { MediaDevicesContext } from "../MediaDevicesContext";
|
||||||
import { type MediaDevices as ECMediaDevices } from "../state/MediaDevices";
|
import { type MediaDevices as ECMediaDevices } from "../state/MediaDevices";
|
||||||
import { AppBar } from "../AppBar";
|
import { AppBar } from "../AppBar";
|
||||||
|
import { type MatrixInfo } from "./VideoPreview";
|
||||||
|
import { ProcessorProvider } from "../livekit/TrackProcessorContext";
|
||||||
import { initializeWidget } from "../widget";
|
import { initializeWidget } from "../widget";
|
||||||
|
|
||||||
initializeWidget();
|
initializeWidget();
|
||||||
@@ -78,6 +83,17 @@ const remoteParticipant = mockRemoteParticipant({
|
|||||||
identity: "@alice:example.org:AAAAAA",
|
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<typeof useRoomEncryptionSystem>;
|
let useRoomEncryptionSystemMock: MockedFunction<typeof useRoomEncryptionSystem>;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -142,18 +158,7 @@ function createInCallView(args: CreateInCallViewArgs = {}): RenderResult & {
|
|||||||
vm={vm}
|
vm={vm}
|
||||||
footerVm={footerVm}
|
footerVm={footerVm}
|
||||||
developerSettingsVm={developerSettingsVm}
|
developerSettingsVm={developerSettingsVm}
|
||||||
matrixInfo={{
|
matrixInfo={matrixInfo}
|
||||||
userId: "",
|
|
||||||
displayName: "",
|
|
||||||
avatarUrl: "",
|
|
||||||
roomId: "",
|
|
||||||
roomName: "",
|
|
||||||
roomAlias: null,
|
|
||||||
roomAvatar: null,
|
|
||||||
e2eeSystem: {
|
|
||||||
kind: E2eeType.NONE,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
matrixRoom={room}
|
matrixRoom={room}
|
||||||
onShareClick={null}
|
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(
|
||||||
|
<BrowserRouter>
|
||||||
|
<MediaDevicesContext value={mediaDevices}>
|
||||||
|
<ProcessorProvider>
|
||||||
|
<TooltipProvider>
|
||||||
|
<RoomContext value={mockLivekitRoom({ localParticipant })}>
|
||||||
|
<ActiveCall
|
||||||
|
client={matrixRoom.client}
|
||||||
|
rtcSession={rtcSession.asMockedSession()}
|
||||||
|
matrixRoom={matrixRoom}
|
||||||
|
muteStates={mockMuteStates()}
|
||||||
|
matrixInfo={matrixInfo}
|
||||||
|
onShareClick={null}
|
||||||
|
e2eeSystem={{ kind: E2eeType.NONE }}
|
||||||
|
onLeft={(): void => {}}
|
||||||
|
/>
|
||||||
|
</RoomContext>
|
||||||
|
</TooltipProvider>
|
||||||
|
</ProcessorProvider>
|
||||||
|
</MediaDevicesContext>
|
||||||
|
</BrowserRouter>,
|
||||||
|
);
|
||||||
|
// Rendering at all proves ActiveCall created all of its view models
|
||||||
|
expect(await findByTestId("incall_leave")).toBeVisible();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user