mv element.io @types __mocks__/ debian docker module_system/ playwright res src test webapp Dockerfile .dockerignore .eslintignore .stylelintrc.cjs babel.config.cjs recorder-worklet-loader.cjs .modernizr.json components.json config.json config.sample.json package.json project.json tsconfig.json tsconfig.module_system.json jest.config.ts playwright.config.ts webpack.config.ts build_config.sample.yaml apps/web/

mkdir apps/web/scripts
mv scripts/{cleanup.sh,ci_package.sh,copy-res.ts,deploy.py,package.sh} apps/web/scripts

And a couple of gitignore tweaks

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2026-02-24 15:43:58 +00:00
parent e7509c92a1
commit 91a3cb03c1
3408 changed files with 28 additions and 32 deletions
@@ -0,0 +1,69 @@
/*
* Copyright 2025 New Vector Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
* Please see LICENSE files in the repository root for full details.
*/
import { type CallMembership, MatrixRTCSessionManagerEvents } from "matrix-js-sdk/src/matrixrtc";
import { type MatrixClient, type Room } from "matrix-js-sdk/src/matrix";
import { type MockedObject } from "jest-mock";
import { ElementCall } from "../../../src/models/Call";
import { CallStore } from "../../../src/stores/CallStore";
import {
setUpClientRoomAndStores,
cleanUpClientRoomAndStores,
setupAsyncStoreWithClient,
enableCalls,
} from "../../test-utils";
describe("CallStore", () => {
let client: MockedObject<MatrixClient>;
let room: Room;
beforeEach(() => {
enableCalls();
const res = setUpClientRoomAndStores();
client = res.client;
room = res.room;
});
afterEach(() => {
cleanUpClientRoomAndStores(client, room);
jest.restoreAllMocks();
});
it("constructs one call for one MatrixRTC session", () => {
setupAsyncStoreWithClient(CallStore.instance, client);
const getSpy = jest.spyOn(ElementCall, "get");
// Simulate another user starting a new MatrixRTC session
const session = client.matrixRTC.getRoomSession(room);
session.memberships.push({} as CallMembership);
client.matrixRTC.emit(MatrixRTCSessionManagerEvents.SessionStarted, room.roomId, session);
expect(getSpy).toHaveBeenCalledTimes(1);
expect(getSpy).toHaveReturnedWith(expect.any(ElementCall));
expect(CallStore.instance.getCall(room.roomId)).not.toBe(null);
expect(CallStore.instance.getConfiguredRTCTransports()).toHaveLength(0);
});
it("calculates RTC transports with both modern and legacy endpoints", async () => {
client._unstable_getRTCTransports.mockResolvedValue([
{ type: "type-a", some_data: "value" },
{ type: "type-b", some_data: "foo" },
]);
client.getClientWellKnown.mockReturnValue({
"org.matrix.msc4143.rtc_foci": [
{ type: "type-c", other_data: "bar" },
{ type: "type-d", other_data: "baz" },
],
});
await setupAsyncStoreWithClient(CallStore.instance, client);
expect(CallStore.instance.getConfiguredRTCTransports()).toEqual([
{ type: "type-a", some_data: "value" },
{ type: "type-b", some_data: "foo" },
{ type: "type-c", other_data: "bar" },
{ type: "type-d", other_data: "baz" },
]);
});
});