From 93dc3d08f547e24441a1b3d5ae8f9d037d0bd94a Mon Sep 17 00:00:00 2001 From: Priya Date: Fri, 6 Dec 2024 10:05:09 +0530 Subject: [PATCH] feat(plugin-cc): updated logs --- .../plugin-cc/src/services/WebCallingService.ts | 16 ++++++++-------- .../@webex/plugin-cc/src/services/task/types.ts | 2 +- .../test/unit/spec/services/WebCallingService.ts | 16 ++++++++-------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/@webex/plugin-cc/src/services/WebCallingService.ts b/packages/@webex/plugin-cc/src/services/WebCallingService.ts index a137436232f..da361627c5b 100644 --- a/packages/@webex/plugin-cc/src/services/WebCallingService.ts +++ b/packages/@webex/plugin-cc/src/services/WebCallingService.ts @@ -82,25 +82,25 @@ export default class WebCallingService extends EventEmitter { public answerCall(localAudioStream: LocalMicrophoneStream, taskId: string) { if (this.call) { try { - this.webex.logger.info(`[WebRtc]: Call answered: ${taskId}`); + this.webex.logger.info(`Call answered: ${taskId}`); this.call.answer(localAudioStream); this.registerCallListeners(); } catch (error) { - this.webex.logger.error(`[WebRtc]: Failed to answer call for ${taskId}. Error: ${error}`); + this.webex.logger.error(`Failed to answer call for ${taskId}. Error: ${error}`); // Optionally, throw the error to allow the invoker to handle it throw error; } } else { - this.webex.logger.log(`[WebRtc]: Cannot answer a non WebRtc Call: ${taskId}`); + this.webex.logger.log(`Cannot answer a non WebRtc Call: ${taskId}`); } } public muteCall(localAudioStream: LocalMicrophoneStream) { if (this.call) { - this.webex.logger.info('[WebRtc]: Call mute|unmute requesting!'); + this.webex.logger.info('Call mute|unmute requesting!'); this.call.mute(localAudioStream); } else { - this.webex.logger.log(`[WebRtc]: Cannot mute a non WebRtc Call`); + this.webex.logger.log(`Cannot mute a non WebRtc Call`); } } @@ -115,16 +115,16 @@ export default class WebCallingService extends EventEmitter { public declineCall(taskId: string) { if (this.call) { try { - this.webex.logger.info(`[WebRtc]: Call end requested: ${taskId}`); + this.webex.logger.info(`Call end requested: ${taskId}`); this.call.end(); this.unregisterCallListeners(); } catch (error) { - this.webex.logger.error(`[WebRtc]: Failed to end call: ${taskId}. Error: ${error}`); + this.webex.logger.error(`Failed to end call: ${taskId}. Error: ${error}`); // Optionally, throw the error to allow the invoker to handle it throw error; } } else { - this.webex.logger.log(`[WebRtc]: Cannot end a non WebRtc Call: ${taskId}`); + this.webex.logger.log(`Cannot end a non WebRtc Call: ${taskId}`); } } } diff --git a/packages/@webex/plugin-cc/src/services/task/types.ts b/packages/@webex/plugin-cc/src/services/task/types.ts index ce205a8667d..a731403c204 100644 --- a/packages/@webex/plugin-cc/src/services/task/types.ts +++ b/packages/@webex/plugin-cc/src/services/task/types.ts @@ -41,7 +41,7 @@ export const TASK_EVENTS = { export type TASK_EVENTS = Enum; -type Interaction = { +export type Interaction = { isFcManaged: boolean; isTerminated: boolean; mediaType: MEDIA_CHANNEL; diff --git a/packages/@webex/plugin-cc/test/unit/spec/services/WebCallingService.ts b/packages/@webex/plugin-cc/test/unit/spec/services/WebCallingService.ts index 589432cf008..4bf3f152139 100644 --- a/packages/@webex/plugin-cc/test/unit/spec/services/WebCallingService.ts +++ b/packages/@webex/plugin-cc/test/unit/spec/services/WebCallingService.ts @@ -177,7 +177,7 @@ describe('WebCallingService', () => { it('should answer the call and log info when call exists', () => { webRTCCalling.answerCall(localAudioStream, 'task-id'); - expect(webex.logger.info).toHaveBeenCalledWith('[WebRtc]: Call answered: task-id'); + expect(webex.logger.info).toHaveBeenCalledWith('Call answered: task-id'); expect(mockCall.answer).toHaveBeenCalledWith(localAudioStream); }); @@ -186,14 +186,14 @@ describe('WebCallingService', () => { mockCall.answer.mockImplementation(() => { throw error; }); expect(() => webRTCCalling.answerCall(localAudioStream, 'task-id')).toThrow(error); - expect(webex.logger.error).toHaveBeenCalledWith(`[WebRtc]: Failed to answer call for task-id. Error: ${error}`); + expect(webex.logger.error).toHaveBeenCalledWith(`Failed to answer call for task-id. Error: ${error}`); }); it('should log when there is no call to answer', () => { webRTCCalling.call = null; webRTCCalling.answerCall(localAudioStream, 'task-id'); - expect(webex.logger.log).toHaveBeenCalledWith('[WebRtc]: Cannot answer a non WebRtc Call: task-id'); + expect(webex.logger.log).toHaveBeenCalledWith('Cannot answer a non WebRtc Call: task-id'); }); }); @@ -209,7 +209,7 @@ describe('WebCallingService', () => { it('should mute the call and log info when call exists', () => { webRTCCalling.muteCall(localAudioStream); - expect(webex.logger.info).toHaveBeenCalledWith('[WebRtc]: Call mute|unmute requesting!'); + expect(webex.logger.info).toHaveBeenCalledWith('Call mute|unmute requesting!'); expect(mockCall.mute).toHaveBeenCalledWith(localAudioStream); }); @@ -217,7 +217,7 @@ describe('WebCallingService', () => { webRTCCalling.call = null; webRTCCalling.muteCall(localAudioStream); - expect(webex.logger.log).toHaveBeenCalledWith('[WebRtc]: Cannot mute a non WebRtc Call'); + expect(webex.logger.log).toHaveBeenCalledWith('Cannot mute a non WebRtc Call'); }); }); @@ -225,7 +225,7 @@ describe('WebCallingService', () => { it('should end the call and log info when call exists', () => { webRTCCalling.declineCall('task-id'); - expect(webex.logger.info).toHaveBeenCalledWith('[WebRtc]: Call end requested: task-id'); + expect(webex.logger.info).toHaveBeenCalledWith('Call end requested: task-id'); expect(mockCall.end).toHaveBeenCalled(); }); @@ -234,14 +234,14 @@ describe('WebCallingService', () => { mockCall.end.mockImplementation(() => { throw error; }); expect(() => webRTCCalling.declineCall('task-id')).toThrow(error); - expect(webex.logger.error).toHaveBeenCalledWith(`[WebRtc]: Failed to end call: task-id. Error: ${error}`); + expect(webex.logger.error).toHaveBeenCalledWith(`Failed to end call: task-id. Error: ${error}`); }); it('should log when there is no call to end', () => { webRTCCalling.call = null; webRTCCalling.declineCall('task-id'); - expect(webex.logger.log).toHaveBeenCalledWith('[WebRtc]: Cannot end a non WebRtc Call: task-id'); + expect(webex.logger.log).toHaveBeenCalledWith('Cannot end a non WebRtc Call: task-id'); }); }); });