mirror of
https://github.com/vector-im/element-call.git
synced 2026-07-30 19:39:22 +00:00
Fix test
This commit is contained in:
@@ -32,7 +32,8 @@ describe("LocalTransport", () => {
|
|||||||
memberships$: constant(new Epoch<CallMembership[]>([])),
|
memberships$: constant(new Epoch<CallMembership[]>([])),
|
||||||
client: {
|
client: {
|
||||||
getDomain: () => "",
|
getDomain: () => "",
|
||||||
_unstable_getRTCTransports: async () => [],
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
|
_unstable_getRTCTransports: async () => Promise.resolve([]),
|
||||||
// These won't be called in this error path but satisfy the type
|
// These won't be called in this error path but satisfy the type
|
||||||
getOpenIdToken: vi.fn(),
|
getOpenIdToken: vi.fn(),
|
||||||
getDeviceId: vi.fn(),
|
getDeviceId: vi.fn(),
|
||||||
@@ -68,7 +69,8 @@ describe("LocalTransport", () => {
|
|||||||
client: {
|
client: {
|
||||||
// Use empty domain to skip .well-known and use config directly
|
// Use empty domain to skip .well-known and use config directly
|
||||||
getDomain: () => "",
|
getDomain: () => "",
|
||||||
_unstable_getRTCTransports: async () => [],
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
|
_unstable_getRTCTransports: async () => Promise.resolve([]),
|
||||||
getOpenIdToken: vi.fn(),
|
getOpenIdToken: vi.fn(),
|
||||||
getDeviceId: vi.fn(),
|
getDeviceId: vi.fn(),
|
||||||
},
|
},
|
||||||
@@ -105,7 +107,8 @@ describe("LocalTransport", () => {
|
|||||||
memberships$: constant(new Epoch<CallMembership[]>([])),
|
memberships$: constant(new Epoch<CallMembership[]>([])),
|
||||||
client: {
|
client: {
|
||||||
getDomain: () => "",
|
getDomain: () => "",
|
||||||
_unstable_getRTCTransports: async () => [],
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
|
_unstable_getRTCTransports: async () => Promise.resolve([]),
|
||||||
getOpenIdToken: vi.fn(),
|
getOpenIdToken: vi.fn(),
|
||||||
getDeviceId: vi.fn(),
|
getDeviceId: vi.fn(),
|
||||||
},
|
},
|
||||||
@@ -141,7 +144,8 @@ describe("LocalTransport", () => {
|
|||||||
memberships$,
|
memberships$,
|
||||||
client: {
|
client: {
|
||||||
getDomain: () => "",
|
getDomain: () => "",
|
||||||
_unstable_getRTCTransports: async () => [],
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
|
_unstable_getRTCTransports: async () => Promise.resolve([]),
|
||||||
getOpenIdToken: vi.fn(),
|
getOpenIdToken: vi.fn(),
|
||||||
getDeviceId: vi.fn(),
|
getDeviceId: vi.fn(),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -27,7 +27,10 @@ import { AutoDiscovery } from "matrix-js-sdk/lib/autodiscovery";
|
|||||||
import { type Behavior } from "../../Behavior.ts";
|
import { type Behavior } from "../../Behavior.ts";
|
||||||
import { type Epoch, type ObservableScope } from "../../ObservableScope.ts";
|
import { type Epoch, type ObservableScope } from "../../ObservableScope.ts";
|
||||||
import { Config } from "../../../config/Config.ts";
|
import { Config } from "../../../config/Config.ts";
|
||||||
import { MatrixRTCTransportMissingError } from "../../../utils/errors.ts";
|
import {
|
||||||
|
FailToGetOpenIdToken,
|
||||||
|
MatrixRTCTransportMissingError,
|
||||||
|
} from "../../../utils/errors.ts";
|
||||||
import {
|
import {
|
||||||
getSFUConfigWithOpenID,
|
getSFUConfigWithOpenID,
|
||||||
type OpenIDClientParts,
|
type OpenIDClientParts,
|
||||||
@@ -169,6 +172,10 @@ async function makeTransport(
|
|||||||
livekit_alias: livekitAlias,
|
livekit_alias: livekitAlias,
|
||||||
};
|
};
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
if (ex instanceof FailToGetOpenIdToken) {
|
||||||
|
// Explictly throw these
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
logger.debug(
|
logger.debug(
|
||||||
`Could not use SFU service "${potentialTransport.livekit_service_url}" as SFU`,
|
`Could not use SFU service "${potentialTransport.livekit_service_url}" as SFU`,
|
||||||
ex,
|
ex,
|
||||||
@@ -193,6 +200,8 @@ async function makeTransport(
|
|||||||
if (ex instanceof MatrixError && ex.httpStatus === 404) {
|
if (ex instanceof MatrixError && ex.httpStatus === 404) {
|
||||||
// Expected, this is an unstable endpoint and it's not required.
|
// Expected, this is an unstable endpoint and it's not required.
|
||||||
logger.debug("Backend does not provide any RTC transports", ex);
|
logger.debug("Backend does not provide any RTC transports", ex);
|
||||||
|
} else if (ex instanceof FailToGetOpenIdToken) {
|
||||||
|
throw ex;
|
||||||
} else {
|
} else {
|
||||||
// We got an error that wasn't just missing support for the feature, so log it loudly.
|
// We got an error that wasn't just missing support for the feature, so log it loudly.
|
||||||
logger.error(
|
logger.error(
|
||||||
@@ -233,6 +242,9 @@ async function makeTransport(
|
|||||||
logger.info("Using config SFU", selectedTransport);
|
logger.info("Using config SFU", selectedTransport);
|
||||||
return selectedTransport;
|
return selectedTransport;
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
if (ex instanceof FailToGetOpenIdToken) {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
logger.error("Failed to validate config SFU", ex);
|
logger.error("Failed to validate config SFU", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user