Fix incoming call toast crash due to audio refactor (#12737)
* Fix incoming call toast crash due to audio refactor Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
466f37a83d
commit
8679ace2b2
4 changed files with 20 additions and 14 deletions
|
@ -18,6 +18,7 @@ export const mocks = {
|
|||
AudioBufferSourceNode: {
|
||||
connect: jest.fn(),
|
||||
start: jest.fn(),
|
||||
stop: jest.fn(),
|
||||
} as unknown as AudioBufferSourceNode,
|
||||
AudioContext: {
|
||||
close: jest.fn(),
|
||||
|
|
|
@ -39,11 +39,10 @@ import { WidgetMessagingStore } from "../../src/stores/widgets/WidgetMessagingSt
|
|||
import DMRoomMap from "../../src/utils/DMRoomMap";
|
||||
import ToastStore from "../../src/stores/ToastStore";
|
||||
import { getIncomingCallToastKey, IncomingCallToast } from "../../src/toasts/IncomingCallToast";
|
||||
import { AudioID } from "../../src/LegacyCallHandler";
|
||||
import LegacyCallHandler, { AudioID } from "../../src/LegacyCallHandler";
|
||||
|
||||
describe("IncomingCallEvent", () => {
|
||||
describe("IncomingCallToast", () => {
|
||||
useMockedCalls();
|
||||
jest.spyOn(HTMLMediaElement.prototype, "play").mockImplementation(async () => {});
|
||||
|
||||
let client: Mocked<MatrixClient>;
|
||||
let room: Room;
|
||||
|
@ -133,10 +132,8 @@ describe("IncomingCallEvent", () => {
|
|||
...notifyContent,
|
||||
notify_type: "ring",
|
||||
}) as any;
|
||||
const playMock = jest.fn();
|
||||
const audio = { play: playMock, paused: true };
|
||||
|
||||
jest.spyOn(document, "getElementById").mockReturnValue(audio as any);
|
||||
const playMock = jest.spyOn(LegacyCallHandler.instance, "play");
|
||||
render(<IncomingCallToast notifyEvent={call.event} />);
|
||||
expect(playMock).toHaveBeenCalled();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue