mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-20 20:49:20 +00:00
Fix tests and lint
This commit is contained in:
@@ -125,9 +125,7 @@ describe("UrlParams", () => {
|
|||||||
|
|
||||||
describe("enableClientWellKnownLookups", () => {
|
describe("enableClientWellKnownLookups", () => {
|
||||||
it("is undefined when not set (so the config value applies)", () => {
|
it("is undefined when not set (so the config value applies)", () => {
|
||||||
expect(
|
expect(computeUrlParams().enableClientWellKnownLookups).toBeUndefined();
|
||||||
computeUrlParams().enableClientWellKnownLookups,
|
|
||||||
).toBeUndefined();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("is false when set to false", () => {
|
it("is false when set to false", () => {
|
||||||
|
|||||||
@@ -480,7 +480,9 @@ export const computeUrlParams = (search = "", hash = ""): UrlParams => {
|
|||||||
showControls: parser.getFlag("showControls"),
|
showControls: parser.getFlag("showControls"),
|
||||||
hideScreensharing: parser.getFlag("hideScreensharing"),
|
hideScreensharing: parser.getFlag("hideScreensharing"),
|
||||||
allowIceFallback: parser.getFlag("allowIceFallback"),
|
allowIceFallback: parser.getFlag("allowIceFallback"),
|
||||||
enableClientWellKnownLookups: parser.getFlag("enableClientWellKnownLookups"),
|
enableClientWellKnownLookups: parser.getFlag(
|
||||||
|
"enableClientWellKnownLookups",
|
||||||
|
),
|
||||||
perParticipantE2EE: parser.getFlag("perParticipantE2EE"),
|
perParticipantE2EE: parser.getFlag("perParticipantE2EE"),
|
||||||
controlledAudioDevices: parser.getFlag("controlledAudioDevices"),
|
controlledAudioDevices: parser.getFlag("controlledAudioDevices"),
|
||||||
skipLobby: isWidget ? parser.getFlag("skipLobby") : false,
|
skipLobby: isWidget ? parser.getFlag("skipLobby") : false,
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
type CallMembership,
|
type CallMembership,
|
||||||
type LivekitTransportConfig,
|
type LivekitTransportConfig,
|
||||||
} from "matrix-js-sdk/lib/matrixrtc";
|
} from "matrix-js-sdk/lib/matrixrtc";
|
||||||
|
import { MatrixError } from "matrix-js-sdk";
|
||||||
import { BehaviorSubject, filter, lastValueFrom } from "rxjs";
|
import { BehaviorSubject, filter, lastValueFrom } from "rxjs";
|
||||||
import fetchMock from "fetch-mock";
|
import fetchMock from "fetch-mock";
|
||||||
|
|
||||||
@@ -471,6 +472,11 @@ describe("LocalTransport", () => {
|
|||||||
|
|
||||||
it("supports getting transport via well-known", async () => {
|
it("supports getting transport via well-known", async () => {
|
||||||
localTransportOpts.client.getDomain.mockReturnValue("example.org");
|
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", {
|
fetchMock.getOnce("https://example.org/.well-known/matrix/client", {
|
||||||
"org.matrix.msc4143.rtc_foci": [
|
"org.matrix.msc4143.rtc_foci": [
|
||||||
{ type: "livekit", livekit_service_url: "https://lk.example.org" },
|
{ 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 () => {
|
it("fails fast if the openId request fails for the well-known config", async () => {
|
||||||
localTransportOpts.client.getDomain.mockReturnValue("example.org");
|
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", {
|
fetchMock.getOnce("https://example.org/.well-known/matrix/client", {
|
||||||
"org.matrix.msc4143.rtc_foci": [
|
"org.matrix.msc4143.rtc_foci": [
|
||||||
{ type: "livekit", livekit_service_url: "https://lk.example.org" },
|
{ type: "livekit", livekit_service_url: "https://lk.example.org" },
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ const createRoomWidgetClientSpy = vi.mocked(createRoomWidgetClient);
|
|||||||
vi.mock("./config/Config", () => ({
|
vi.mock("./config/Config", () => ({
|
||||||
Config: {
|
Config: {
|
||||||
init: vi.fn().mockImplementation(async () => Promise.resolve()),
|
init: vi.fn().mockImplementation(async () => Promise.resolve()),
|
||||||
|
clientWellKnownLookupsEnabled: vi.fn().mockReturnValue(true),
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
const configInitSpy = vi.mocked(Config.init);
|
const configInitSpy = vi.mocked(Config.init);
|
||||||
|
|||||||
Reference in New Issue
Block a user