Stop voice broadcast recording on redaction (#9455)

This commit is contained in:
Michael Weimann 2022-10-19 18:02:48 +02:00 committed by GitHub
parent d5a4718d46
commit 07a1e9a009
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 76 additions and 30 deletions

View file

@ -20,6 +20,7 @@ import {
EventType,
MatrixClient,
MatrixEvent,
MatrixEventEvent,
MsgType,
RelationType,
Room,
@ -81,6 +82,7 @@ describe("VoiceBroadcastRecording", () => {
const setUpVoiceBroadcastRecording = () => {
voiceBroadcastRecording = new VoiceBroadcastRecording(infoEvent, client);
voiceBroadcastRecording.on(VoiceBroadcastRecordingEvent.StateChanged, onStateChanged);
jest.spyOn(voiceBroadcastRecording, "destroy");
jest.spyOn(voiceBroadcastRecording, "removeAllListeners");
};
@ -214,6 +216,18 @@ describe("VoiceBroadcastRecording", () => {
expect(voiceBroadcastRecorder.start).toHaveBeenCalled();
});
describe("and the info event is redacted", () => {
beforeEach(() => {
infoEvent.emit(MatrixEventEvent.BeforeRedaction, null, null);
});
itShouldBeInState(VoiceBroadcastInfoState.Stopped);
it("should destroy the recording", () => {
expect(voiceBroadcastRecording.destroy).toHaveBeenCalled();
});
});
describe("and receiving a call action", () => {
beforeEach(() => {
dis.dispatch({