Commit 95196bad authored by Yoann HOUPERT's avatar Yoann HOUPERT
Browse files

clean code from PR comment

parent 22e41c18
Pipeline #4169 passed with stage
in 37 seconds
......@@ -140,12 +140,10 @@ robot = {
const keyMap = Object.keys(robot.recordedParticipantsWS);
if (keyMap) {
for (let i = 0; i < keyMap.length; i++) {
if (keyMap[i]) {
try {
robot.stopRecordParticipant(keyMap[i]);
} catch (err) {
console.log('This user is innactive');
}
try {
robot.stopRecordParticipant(keyMap[i]);
} catch (err) {
console.log('This user is inactive');
}
}
}
......
......@@ -188,10 +188,6 @@ describe('client/robot', () => {
/* eslint-enable */
});
test('should set a interval for disconnection', () => {
expect.arrayContaining([[global.robot.checkDisconnect, 300000]]);
});
test('should not record itself', () => {
expect(global.MediaRecorder.instances)
.not.toHaveProperty(global.robotController.getMyId());
......@@ -216,9 +212,12 @@ describe('client/robot', () => {
expect(sttMock.sttDataSent[sttMock.sttDataSent.length - 1]).toBe(e.data);
});
test('should participant be on', () => {
expect(global.robot.participantsMediaRecorders.someid1.stopped).toBe(false);
expect(global.robot.recordedParticipantsWS.someid1.status).toBe('open');
test('should record and transcribe active participants', () => {
const keyMap = Object.keys(global.robot.participantsMediaRecorders);
for (let i = 0; i < keyMap.length; i++) {
expect(global.robot.participantsMediaRecorders[keyMap[i]].stopped).toBeFalsy();
expect(global.robot.recordedParticipantsWS[keyMap[i]].status).toBe('open');
}
});
test('should stop transcribing stream on user disconnect', () => {
......@@ -256,8 +255,11 @@ describe('client/robot', () => {
test('should clear the connection', () => {
global.robot.clearConnection();
expect(global.robot.participantsMediaRecorders.someid1.stopped).toBe(true);
expect(global.robot.recordedParticipantsWS.someid1.status).toBe('closed');
const keyMap = Object.keys(global.robot.participantsMediaRecorders);
for (let i = 0; i < keyMap.length; i++) {
expect(global.robot.participantsMediaRecorders[keyMap[i]].stopped).toBeTruthy();
expect(global.robot.recordedParticipantsWS[keyMap[i]].status).toBe('closed');
}
expect(global.robot.intervalList.length).toBe(0);
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment