This commit is contained in:
Timo
2025-05-13 21:19:21 +02:00
parent 06077170db
commit 19228544a9
3 changed files with 17 additions and 11 deletions

View File

@@ -5,8 +5,15 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details. Please see LICENSE in the repository root for full details.
*/ */
import { beforeEach, expect, it, type MockedFunction, test, vi } from "vitest"; import {
import { act, render, RenderResult } from "@testing-library/react"; beforeEach,
describe,
expect,
it,
type MockedFunction,
vi,
} from "vitest";
import { act, render, type RenderResult } from "@testing-library/react";
import { type MatrixClient, JoinRule, type RoomState } from "matrix-js-sdk"; import { type MatrixClient, JoinRule, type RoomState } from "matrix-js-sdk";
import { type MatrixRTCSession } from "matrix-js-sdk/lib/matrixrtc"; import { type MatrixRTCSession } from "matrix-js-sdk/lib/matrixrtc";
import { type RelationsContainer } from "matrix-js-sdk/lib/models/relations-container"; import { type RelationsContainer } from "matrix-js-sdk/lib/models/relations-container";
@@ -38,7 +45,6 @@ import { alice, local } from "../utils/test-fixtures";
import { useExperimentalToDeviceTransportSetting } from "../settings/settings"; import { useExperimentalToDeviceTransportSetting } from "../settings/settings";
import { ReactionsSenderProvider } from "../reactions/useReactionsSender"; import { ReactionsSenderProvider } from "../reactions/useReactionsSender";
import { useRoomEncryptionSystem } from "../e2ee/sharedKeyManagement"; import { useRoomEncryptionSystem } from "../e2ee/sharedKeyManagement";
import { describe } from "node:test";
// vi.hoisted(() => { // vi.hoisted(() => {
// localStorage = {} as unknown as Storage; // localStorage = {} as unknown as Storage;
@@ -182,14 +188,14 @@ function createInCallView(): RenderResult & {
}; };
} }
void describe("InCallView", async () => { describe("InCallView", () => {
await describe("rendering", () => { describe("rendering", () => {
it("renders", () => { it("renders", () => {
const { container } = createInCallView(); const { container } = createInCallView();
expect(container).toMatchSnapshot(); expect(container).toMatchSnapshot();
}); });
}); });
await describe("toDevice label", () => { describe("toDevice label", () => {
it("is shown if setting activated and room encrypted", () => { it("is shown if setting activated and room encrypted", () => {
useRoomEncryptionSystemMock.mockReturnValue({ useRoomEncryptionSystemMock.mockReturnValue({
kind: E2eeType.PER_PARTICIPANT, kind: E2eeType.PER_PARTICIPANT,

View File

@@ -1,6 +1,6 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`renders 1`] = ` exports[`InCallView > rendering > renders 1`] = `
<div> <div>
<div <div
class="inRoom" class="inRoom"

View File

@@ -29,6 +29,10 @@ import {
type Room as LivekitRoom, type Room as LivekitRoom,
} from "livekit-client"; } from "livekit-client";
import { randomUUID } from "crypto"; import { randomUUID } from "crypto";
import {
type RoomAndToDeviceEvents,
type RoomAndToDeviceEventsHandlerMap,
} from "matrix-js-sdk/lib/matrixrtc/RoomAndToDeviceKeyTransport";
import { import {
LocalUserMediaViewModel, LocalUserMediaViewModel,
@@ -40,10 +44,6 @@ import {
type ResolvedConfigOptions, type ResolvedConfigOptions,
} from "../config/ConfigOptions"; } from "../config/ConfigOptions";
import { Config } from "../config/Config"; import { Config } from "../config/Config";
import {
RoomAndToDeviceEvents,
RoomAndToDeviceEventsHandlerMap,
} from "matrix-js-sdk/lib/matrixrtc/RoomAndToDeviceKeyTransport";
export function withFakeTimers(continuation: () => void): void { export function withFakeTimers(continuation: () => void): void {
vi.useFakeTimers(); vi.useFakeTimers();