Use AutoDiscovery.getRawClientConfig() instead of MatrixClient.getClientWellKnown() (#2906)

I'm open to suggestions on what is sensible to test around this...
This commit is contained in:
Hugh Nimmo-Smith
2024-12-17 16:44:50 +00:00
committed by GitHub
parent 2b6acb9cce
commit 53fff37d5d
2 changed files with 35 additions and 14 deletions

View File

@@ -7,6 +7,7 @@ Please see LICENSE in the repository root for full details.
import { type MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession";
import { expect, test, vi } from "vitest";
import { AutoDiscovery } from "matrix-js-sdk/src/autodiscovery";
import { enterRTCSession } from "../src/rtcSessionHelpers";
import { mockConfig } from "./utils/test";
@@ -36,11 +37,21 @@ test("It joins the correct Session", async () => {
mockConfig({
livekit: { livekit_service_url: "http://my-default-service-url.com" },
});
vi.spyOn(AutoDiscovery, "getRawClientConfig").mockImplementation(
async (domain) => {
if (domain === "example.org") {
return Promise.resolve(clientWellKnown);
}
return Promise.resolve({});
},
);
const mockedSession = vi.mocked({
room: {
roomId: "roomId",
client: {
getClientWellKnown: vi.fn().mockReturnValue(clientWellKnown),
getDomain: vi.fn().mockReturnValue("example.org"),
},
},
memberships: [],