Prevent starting another voice broadcast (#9457)

This commit is contained in:
Michael Weimann 2022-10-19 16:22:07 +02:00 committed by GitHub
parent 13fbd096b0
commit 8066b9ffbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 2 deletions

View file

@ -67,6 +67,7 @@ describe("startNewVoiceBroadcastRecording", () => {
recordingsStore = {
setCurrent: jest.fn(),
getCurrent: jest.fn(),
} as unknown as VoiceBroadcastRecordingsStore;
infoEvent = mkVoiceBroadcastInfoStateEvent(roomId, VoiceBroadcastInfoState.Started, client.getUserId());
@ -132,7 +133,25 @@ describe("startNewVoiceBroadcastRecording", () => {
});
});
describe("when there already is a live broadcast of the current user", () => {
describe("when there is already a current voice broadcast", () => {
beforeEach(async () => {
mocked(recordingsStore.getCurrent).mockReturnValue(
new VoiceBroadcastRecording(infoEvent, client),
);
result = await startNewVoiceBroadcastRecording(room, client, recordingsStore);
});
it("should not start a voice broadcast", () => {
expect(result).toBeNull();
});
it("should show an info dialog", () => {
expect(Modal.createDialog).toMatchSnapshot();
});
});
describe("when there already is a live broadcast of the current user in the room", () => {
beforeEach(async () => {
room.currentState.setStateEvents([
mkVoiceBroadcastInfoStateEvent(roomId, VoiceBroadcastInfoState.Running, client.getUserId()),