Implement voice broadcast last_chunk_sequence
(#9513)
This commit is contained in:
parent
07003a5bc1
commit
c497046e39
3 changed files with 10 additions and 22 deletions
|
@ -92,20 +92,20 @@ describe("VoiceBroadcastRecording", () => {
|
|||
});
|
||||
};
|
||||
|
||||
const itShouldSendAnInfoEvent = (state: VoiceBroadcastInfoState) => {
|
||||
const itShouldSendAnInfoEvent = (state: VoiceBroadcastInfoState, lastChunkSequence: number) => {
|
||||
it(`should send a ${state} info event`, () => {
|
||||
expect(client.sendStateEvent).toHaveBeenCalledWith(
|
||||
roomId,
|
||||
VoiceBroadcastInfoEventType,
|
||||
{
|
||||
|
||||
device_id: client.getDeviceId(),
|
||||
state,
|
||||
last_chunk_sequence: lastChunkSequence,
|
||||
["m.relates_to"]: {
|
||||
rel_type: RelationType.Reference,
|
||||
event_id: infoEvent.getId(),
|
||||
},
|
||||
},
|
||||
} as VoiceBroadcastInfoEventContent,
|
||||
client.getUserId(),
|
||||
);
|
||||
});
|
||||
|
@ -203,22 +203,7 @@ describe("VoiceBroadcastRecording", () => {
|
|||
voiceBroadcastRecording.stop();
|
||||
});
|
||||
|
||||
it("should send a stopped Voice Broadcast Info event", () => {
|
||||
expect(mocked(client.sendStateEvent)).toHaveBeenCalledWith(
|
||||
roomId,
|
||||
VoiceBroadcastInfoEventType,
|
||||
{
|
||||
device_id: client.getDeviceId(),
|
||||
state: VoiceBroadcastInfoState.Stopped,
|
||||
["m.relates_to"]: {
|
||||
rel_type: RelationType.Reference,
|
||||
event_id: infoEvent.getId(),
|
||||
},
|
||||
},
|
||||
client.getUserId(),
|
||||
);
|
||||
});
|
||||
|
||||
itShouldSendAnInfoEvent(VoiceBroadcastInfoState.Stopped, 1);
|
||||
itShouldBeInState(VoiceBroadcastInfoState.Stopped);
|
||||
|
||||
it("should emit a stopped state changed event", () => {
|
||||
|
@ -383,7 +368,7 @@ describe("VoiceBroadcastRecording", () => {
|
|||
});
|
||||
|
||||
itShouldBeInState(VoiceBroadcastInfoState.Paused);
|
||||
itShouldSendAnInfoEvent(VoiceBroadcastInfoState.Paused);
|
||||
itShouldSendAnInfoEvent(VoiceBroadcastInfoState.Paused, 1);
|
||||
|
||||
it("should stop the recorder", () => {
|
||||
expect(mocked(voiceBroadcastRecorder.stop)).toHaveBeenCalled();
|
||||
|
@ -424,7 +409,7 @@ describe("VoiceBroadcastRecording", () => {
|
|||
});
|
||||
|
||||
itShouldBeInState(VoiceBroadcastInfoState.Resumed);
|
||||
itShouldSendAnInfoEvent(VoiceBroadcastInfoState.Resumed);
|
||||
itShouldSendAnInfoEvent(VoiceBroadcastInfoState.Resumed, 1);
|
||||
|
||||
it("should start the recorder", () => {
|
||||
expect(mocked(voiceBroadcastRecorder.start)).toHaveBeenCalled();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue