Align widget_build_url_ignore_dm with call behaviour switch between 1:1 and Widget (#12760)

* Align `widget_build_url_ignore_dm` with call behaviour switch between 1:1 and Widget

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Add tests

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Improve coverage

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2024-07-15 09:08:34 +00:00
committed by GitHub
parent 44454618d8
commit 3221f7cade
5 changed files with 103 additions and 46 deletions
+9
View File
@@ -52,6 +52,7 @@ import { mkVoiceBroadcastInfoStateEvent } from "./voice-broadcast/utils/test-uti
import { SdkContextClass } from "../src/contexts/SDKContext";
import Modal from "../src/Modal";
import { createAudioContext } from "../src/audio/compat";
import * as ManagedHybrid from "../src/widgets/ManagedHybrid";
jest.mock("../src/Modal");
@@ -315,6 +316,7 @@ describe("LegacyCallHandler", () => {
document.body.removeChild(audioElement);
SdkConfig.reset();
jest.restoreAllMocks();
});
it("should look up the correct user and start a call in the room when a phone number is dialled", async () => {
@@ -403,6 +405,13 @@ describe("LegacyCallHandler", () => {
expect(callHandler.getCallForRoom(NATIVE_ROOM_CHARLIE)).toBe(fakeCall);
});
it("should place calls using managed hybrid widget if enabled", async () => {
const spy = jest.spyOn(ManagedHybrid, "addManagedHybridWidget");
jest.spyOn(ManagedHybrid, "isManagedHybridWidgetEnabled").mockReturnValue(true);
await callHandler.placeCall(NATIVE_ROOM_ALICE, CallType.Voice);
expect(spy).toHaveBeenCalledWith(MatrixClientPeg.safeGet().getRoom(NATIVE_ROOM_ALICE));
});
describe("when listening to a voice broadcast", () => {
let voiceBroadcastPlayback: VoiceBroadcastPlayback;