You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-31 13:44:28 +03:00
Move mediaDevices
mock out of setupManualMocks
(#11413)
* Move `mediaDevices` mock out of `setupManualMocks` This doesn't work well in test suites with multiple tests, because the `mockReturnValue` is reset for subsequent tests. In any case, having it mocked out automagically is *magical*. Let's make it opt-in. * clarify ts-ignore
This commit is contained in:
committed by
GitHub
parent
d569ba0cfe
commit
3fda0299a5
@ -21,6 +21,7 @@ import Recorder from "opus-recorder/dist/recorder.min.js";
|
||||
import { VoiceRecording, voiceRecorderOptions, highQualityRecorderOptions } from "../../src/audio/VoiceRecording";
|
||||
import { createAudioContext } from "../..//src/audio/compat";
|
||||
import MediaDeviceHandler from "../../src/MediaDeviceHandler";
|
||||
import { useMockMediaDevices } from "../test-utils";
|
||||
|
||||
jest.mock("opus-recorder/dist/recorder.min.js");
|
||||
const RecorderMock = mocked(Recorder);
|
||||
@ -56,6 +57,7 @@ describe("VoiceRecording", () => {
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
useMockMediaDevices();
|
||||
recording = new VoiceRecording();
|
||||
// @ts-ignore
|
||||
recording.observable = {
|
||||
|
Reference in New Issue
Block a user