1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-28 15:22:05 +03:00

Make group calls respect the ICE fallback setting (#11047)

This commit is contained in:
Robin
2023-06-07 09:29:39 -04:00
committed by GitHub
parent 1091e14a3d
commit ac2c9cef8d
2 changed files with 32 additions and 0 deletions

View File

@ -625,6 +625,36 @@ describe("ElementCall", () => {
SettingsStore.getValue = originalGetValue;
});
it("passes ICE fallback preference through widget URL", async () => {
// Test with the preference set to false
await ElementCall.create(room);
const call1 = Call.get(room);
if (!(call1 instanceof ElementCall)) throw new Error("Failed to create call");
const urlParams1 = new URLSearchParams(new URL(call1.widget.url).hash.slice(1));
expect(urlParams1.has("allowIceFallback")).toBe(false);
// Now test with the preference set to true
const originalGetValue = SettingsStore.getValue;
SettingsStore.getValue = <T>(name: string, roomId?: string, excludeDefault?: boolean) => {
switch (name) {
case "fallbackICEServerAllowed":
return true as T;
default:
return originalGetValue<T>(name, roomId, excludeDefault);
}
};
await ElementCall.create(room);
const call2 = Call.get(room);
if (!(call2 instanceof ElementCall)) throw new Error("Failed to create call");
const urlParams2 = new URLSearchParams(new URL(call2.widget.url).hash.slice(1));
expect(urlParams2.has("allowIceFallback")).toBe(true);
SettingsStore.getValue = originalGetValue;
});
it("passes analyticsID through widget URL", async () => {
client.getAccountData.mockImplementation((eventType: string) => {
if (eventType === PosthogAnalytics.ANALYTICS_EVENT_TYPE) {