Confirm listen to a broadcast while recording (#9831)

This commit is contained in:
Michael Weimann
2023-01-02 12:21:33 +00:00
committed by GitHub
parent 91e078d96b
commit 0f7a2ce6df
20 changed files with 213 additions and 29 deletions
@@ -20,6 +20,7 @@ import {
VoiceBroadcastInfoState,
VoiceBroadcastPlayback,
VoiceBroadcastPlaybacksStore,
VoiceBroadcastRecordingsStore,
} from "../../../src/voice-broadcast";
import { pauseNonLiveBroadcastFromOtherRoom } from "../../../src/voice-broadcast/utils/pauseNonLiveBroadcastFromOtherRoom";
import { stubClient } from "../../test-utils";
@@ -32,6 +33,7 @@ describe("pauseNonLiveBroadcastFromOtherRoom", () => {
let client: MatrixClient;
let playback: VoiceBroadcastPlayback;
let playbacks: VoiceBroadcastPlaybacksStore;
let recordings: VoiceBroadcastRecordingsStore;
const mkPlayback = (infoState: VoiceBroadcastInfoState, roomId: string): VoiceBroadcastPlayback => {
const infoEvent = mkVoiceBroadcastInfoStateEvent(
@@ -40,7 +42,7 @@ describe("pauseNonLiveBroadcastFromOtherRoom", () => {
client.getSafeUserId(),
client.getDeviceId()!,
);
const playback = new VoiceBroadcastPlayback(infoEvent, client);
const playback = new VoiceBroadcastPlayback(infoEvent, client, recordings);
jest.spyOn(playback, "pause");
playbacks.setCurrent(playback);
return playback;
@@ -49,7 +51,8 @@ describe("pauseNonLiveBroadcastFromOtherRoom", () => {
beforeEach(() => {
client = stubClient();
room = new Room(roomId, client, client.getSafeUserId());
playbacks = new VoiceBroadcastPlaybacksStore();
recordings = new VoiceBroadcastRecordingsStore();
playbacks = new VoiceBroadcastPlaybacksStore(recordings);
jest.spyOn(playbacks, "clearCurrent");
});
@@ -80,10 +80,10 @@ describe("setUpVoiceBroadcastPreRecording", () => {
);
preRecording = null;
preRecordingStore = new VoiceBroadcastPreRecordingStore();
playback = new VoiceBroadcastPlayback(infoEvent, client);
jest.spyOn(playback, "pause");
playbacksStore = new VoiceBroadcastPlaybacksStore();
recordingsStore = new VoiceBroadcastRecordingsStore();
playback = new VoiceBroadcastPlayback(infoEvent, client, recordingsStore);
jest.spyOn(playback, "pause");
playbacksStore = new VoiceBroadcastPlaybacksStore(recordingsStore);
});
describe("when the preconditions fail", () => {
@@ -84,7 +84,7 @@ describe("startNewVoiceBroadcastRecording", () => {
skey: "",
});
playbacksStore = new VoiceBroadcastPlaybacksStore();
playbacksStore = new VoiceBroadcastPlaybacksStore(recordingsStore);
recordingsStore = {
setCurrent: jest.fn(),
getCurrent: jest.fn(),
@@ -112,7 +112,7 @@ describe("startNewVoiceBroadcastRecording", () => {
let playback: VoiceBroadcastPlayback;
beforeEach(() => {
playback = new VoiceBroadcastPlayback(infoEvent, client);
playback = new VoiceBroadcastPlayback(infoEvent, client, recordingsStore);
jest.spyOn(playback, "pause");
playbacksStore.setCurrent(playback);
});