Fix tests and lint

This commit is contained in:
Johannes Marbach
2026-07-20 15:14:29 +02:00
parent a75eeaeda1
commit 3dbef7a552
4 changed files with 16 additions and 4 deletions

View File

@@ -125,9 +125,7 @@ describe("UrlParams", () => {
describe("enableClientWellKnownLookups", () => {
it("is undefined when not set (so the config value applies)", () => {
expect(
computeUrlParams().enableClientWellKnownLookups,
).toBeUndefined();
expect(computeUrlParams().enableClientWellKnownLookups).toBeUndefined();
});
it("is false when set to false", () => {

View File

@@ -480,7 +480,9 @@ export const computeUrlParams = (search = "", hash = ""): UrlParams => {
showControls: parser.getFlag("showControls"),
hideScreensharing: parser.getFlag("hideScreensharing"),
allowIceFallback: parser.getFlag("allowIceFallback"),
enableClientWellKnownLookups: parser.getFlag("enableClientWellKnownLookups"),
enableClientWellKnownLookups: parser.getFlag(
"enableClientWellKnownLookups",
),
perParticipantE2EE: parser.getFlag("perParticipantE2EE"),
controlledAudioDevices: parser.getFlag("controlledAudioDevices"),
skipLobby: isWidget ? parser.getFlag("skipLobby") : false,

View File

@@ -19,6 +19,7 @@ import {
type CallMembership,
type LivekitTransportConfig,
} from "matrix-js-sdk/lib/matrixrtc";
import { MatrixError } from "matrix-js-sdk";
import { BehaviorSubject, filter, lastValueFrom } from "rxjs";
import fetchMock from "fetch-mock";
@@ -471,6 +472,11 @@ describe("LocalTransport", () => {
it("supports getting transport via well-known", async () => {
localTransportOpts.client.getDomain.mockReturnValue("example.org");
// Pretend the server doesn't implement the transports endpoint to trigger
// the .well-known fallback.
localTransportOpts.client._unstable_getRTCTransports.mockRejectedValue(
new MatrixError({ errcode: "M_UNRECOGNIZED" }, 404),
);
fetchMock.getOnce("https://example.org/.well-known/matrix/client", {
"org.matrix.msc4143.rtc_foci": [
{ type: "livekit", livekit_service_url: "https://lk.example.org" },
@@ -501,6 +507,11 @@ describe("LocalTransport", () => {
it("fails fast if the openId request fails for the well-known config", async () => {
localTransportOpts.client.getDomain.mockReturnValue("example.org");
// Pretend the server doesn't implement the transports endpoint to trigger
// the .well-known fallback.
localTransportOpts.client._unstable_getRTCTransports.mockRejectedValue(
new MatrixError({ errcode: "M_UNRECOGNIZED" }, 404),
);
fetchMock.getOnce("https://example.org/.well-known/matrix/client", {
"org.matrix.msc4143.rtc_foci": [
{ type: "livekit", livekit_service_url: "https://lk.example.org" },

View File

@@ -19,6 +19,7 @@ const createRoomWidgetClientSpy = vi.mocked(createRoomWidgetClient);
vi.mock("./config/Config", () => ({
Config: {
init: vi.fn().mockImplementation(async () => Promise.resolve()),
clientWellKnownLookupsEnabled: vi.fn().mockReturnValue(true),
},
}));
const configInitSpy = vi.mocked(Config.init);