@webex/contact-center 3.12.0-webex-services-ready.4 → 3.13.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.sdd/manifest.json +24 -13
- package/ai-docs/ARCHITECTURE.md +1 -1
- package/ai-docs/CONTRACTS.md +21 -3
- package/ai-docs/SECURITY.md +1 -1
- package/ai-docs/SERVICE_STATE.md +4 -0
- package/ai-docs/contact-center-spec.md +53 -6
- package/ai-docs/features/consult-transfer-list-policy/spec/feature-spec.md +362 -0
- package/ai-docs/features/contact-owner-change-refactor.md +78 -0
- package/dist/cc.js +816 -26
- package/dist/cc.js.map +1 -1
- package/dist/config.js +7 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.js +29 -2
- package/dist/constants.js.map +1 -1
- package/dist/index.js +66 -12
- package/dist/index.js.map +1 -1
- package/dist/metrics/MetricsManager.js +16 -0
- package/dist/metrics/MetricsManager.js.map +1 -1
- package/dist/metrics/behavioral-events.js +110 -0
- package/dist/metrics/behavioral-events.js.map +1 -1
- package/dist/metrics/constants.js +33 -0
- package/dist/metrics/constants.js.map +1 -1
- package/dist/services/AddressBook.js +18 -15
- package/dist/services/AddressBook.js.map +1 -1
- package/dist/services/AnswerCallOnWebexService.js +202 -0
- package/dist/services/AnswerCallOnWebexService.js.map +1 -0
- package/dist/services/ApiAiAssistant.js +221 -11
- package/dist/services/ApiAiAssistant.js.map +1 -1
- package/dist/services/EntryPoint.js +46 -68
- package/dist/services/EntryPoint.js.map +1 -1
- package/dist/services/Queue.js +27 -22
- package/dist/services/Queue.js.map +1 -1
- package/dist/services/WebCallingService.js +287 -37
- package/dist/services/WebCallingService.js.map +1 -1
- package/dist/services/WebexCrossClientService.js +225 -0
- package/dist/services/WebexCrossClientService.js.map +1 -0
- package/dist/services/WxAppTelephonyMercurySync.js +111 -0
- package/dist/services/WxAppTelephonyMercurySync.js.map +1 -0
- package/dist/services/config/Util.js +46 -46
- package/dist/services/config/Util.js.map +1 -1
- package/dist/services/config/constants.js +34 -77
- package/dist/services/config/constants.js.map +1 -1
- package/dist/services/config/index.js +100 -226
- package/dist/services/config/index.js.map +1 -1
- package/dist/services/config/types.js +55 -35
- package/dist/services/config/types.js.map +1 -1
- package/dist/services/constants.js +11 -1
- package/dist/services/constants.js.map +1 -1
- package/dist/services/core/Err.js.map +1 -1
- package/dist/services/core/Utils.js +25 -1
- package/dist/services/core/Utils.js.map +1 -1
- package/dist/services/core/WebexRequest.js +6 -2
- package/dist/services/core/WebexRequest.js.map +1 -1
- package/dist/services/core/aqm-reqs.js +17 -11
- package/dist/services/core/aqm-reqs.js.map +1 -1
- package/dist/services/core/constants.js +9 -1
- package/dist/services/core/constants.js.map +1 -1
- package/dist/services/core/types.js.map +1 -1
- package/dist/services/core/websocket/WebSocketManager.js +17 -1
- package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
- package/dist/services/task/Task.js +275 -8
- package/dist/services/task/Task.js.map +1 -1
- package/dist/services/task/TaskFactory.js +11 -6
- package/dist/services/task/TaskFactory.js.map +1 -1
- package/dist/services/task/TaskManager.js +590 -42
- package/dist/services/task/TaskManager.js.map +1 -1
- package/dist/services/task/TaskUtils.js +11 -1
- package/dist/services/task/TaskUtils.js.map +1 -1
- package/dist/services/task/WebexCallingUtils.js +70 -0
- package/dist/services/task/WebexCallingUtils.js.map +1 -0
- package/dist/services/task/constants.js +14 -2
- package/dist/services/task/constants.js.map +1 -1
- package/dist/services/task/contact.js +29 -0
- package/dist/services/task/contact.js.map +1 -1
- package/dist/services/task/digital/Digital.js +4 -3
- package/dist/services/task/digital/Digital.js.map +1 -1
- package/dist/services/task/state-machine/TaskStateMachine.js +162 -53
- package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -1
- package/dist/services/task/state-machine/actions.js +6 -1
- package/dist/services/task/state-machine/actions.js.map +1 -1
- package/dist/services/task/state-machine/guards.js +7 -10
- package/dist/services/task/state-machine/guards.js.map +1 -1
- package/dist/services/task/state-machine/types.js.map +1 -1
- package/dist/services/task/state-machine/uiControlsComputer.js +118 -18
- package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -1
- package/dist/services/task/types.js +47 -1
- package/dist/services/task/types.js.map +1 -1
- package/dist/services/task/voice/Voice.js +477 -17
- package/dist/services/task/voice/Voice.js.map +1 -1
- package/dist/services/task/voice/WebRTC.js +6 -3
- package/dist/services/task/voice/WebRTC.js.map +1 -1
- package/dist/services/task/voice/wxAppOfferObservability.js +145 -0
- package/dist/services/task/voice/wxAppOfferObservability.js.map +1 -0
- package/dist/services/task/voice/wxAppVoiceMethods.js +395 -0
- package/dist/services/task/voice/wxAppVoiceMethods.js.map +1 -0
- package/dist/services/wxAppDiagnosticLogging.js +159 -0
- package/dist/services/wxAppDiagnosticLogging.js.map +1 -0
- package/dist/services/wxAppTelephonyUtils.js +19 -0
- package/dist/services/wxAppTelephonyUtils.js.map +1 -0
- package/dist/types/cc.d.ts +127 -9
- package/dist/types/config.d.ts +7 -0
- package/dist/types/constants.d.ts +23 -0
- package/dist/types/index.d.ts +38 -17
- package/dist/types/metrics/MetricsManager.d.ts +6 -0
- package/dist/types/metrics/constants.d.ts +31 -0
- package/dist/types/services/AddressBook.d.ts +2 -1
- package/dist/types/services/AnswerCallOnWebexService.d.ts +38 -0
- package/dist/types/services/ApiAiAssistant.d.ts +48 -4
- package/dist/types/services/EntryPoint.d.ts +7 -5
- package/dist/types/services/Queue.d.ts +5 -3
- package/dist/types/services/WebexCrossClientService.d.ts +32 -0
- package/dist/types/services/WxAppTelephonyMercurySync.d.ts +28 -0
- package/dist/types/services/config/Util.d.ts +4 -8
- package/dist/types/services/config/constants.d.ts +28 -76
- package/dist/types/services/config/index.d.ts +16 -64
- package/dist/types/services/config/types.d.ts +150 -173
- package/dist/types/services/constants.d.ts +9 -0
- package/dist/types/services/core/Err.d.ts +2 -0
- package/dist/types/services/core/Utils.d.ts +10 -0
- package/dist/types/services/core/WebexRequest.d.ts +1 -0
- package/dist/types/services/core/constants.d.ts +7 -0
- package/dist/types/services/core/types.d.ts +2 -0
- package/dist/types/services/task/Task.d.ts +34 -5
- package/dist/types/services/task/TaskFactory.d.ts +4 -2
- package/dist/types/services/task/TaskUtils.d.ts +6 -0
- package/dist/types/services/task/WebexCallingUtils.d.ts +11 -0
- package/dist/types/services/task/constants.d.ts +12 -0
- package/dist/types/services/task/contact.d.ts +4 -0
- package/dist/types/services/task/digital/Digital.d.ts +4 -3
- package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +304 -56
- package/dist/types/services/task/state-machine/guards.d.ts +6 -5
- package/dist/types/services/task/state-machine/types.d.ts +9 -1
- package/dist/types/services/task/types.d.ts +192 -5
- package/dist/types/services/task/voice/Voice.d.ts +68 -11
- package/dist/types/services/task/voice/WebRTC.d.ts +5 -4
- package/dist/types/services/task/voice/wxAppOfferObservability.d.ts +39 -0
- package/dist/types/services/task/voice/wxAppVoiceMethods.d.ts +68 -0
- package/dist/types/services/wxAppDiagnosticLogging.d.ts +63 -0
- package/dist/types/services/wxAppTelephonyUtils.d.ts +5 -0
- package/dist/types/types.d.ts +125 -13
- package/dist/types/utils/PageCache.d.ts +20 -3
- package/dist/types.js +90 -8
- package/dist/types.js.map +1 -1
- package/dist/utils/PageCache.js +19 -5
- package/dist/utils/PageCache.js.map +1 -1
- package/dist/webex.js +9 -1
- package/dist/webex.js.map +1 -1
- package/package.json +10 -9
- package/src/cc.ts +1047 -48
- package/src/config.ts +7 -0
- package/src/constants.ts +36 -0
- package/src/index.ts +49 -11
- package/src/metrics/MetricsManager.ts +16 -0
- package/src/metrics/ai-docs/metrics-spec.md +138 -21
- package/src/metrics/behavioral-events.ts +112 -0
- package/src/metrics/constants.ts +36 -0
- package/src/services/AddressBook.ts +17 -6
- package/src/services/AnswerCallOnWebexService.ts +239 -0
- package/src/services/ApiAiAssistant.ts +297 -13
- package/src/services/EntryPoint.ts +59 -60
- package/src/services/Queue.ts +29 -12
- package/src/services/WebCallingService.ts +362 -40
- package/src/services/WebexCrossClientService.ts +298 -0
- package/src/services/WxAppTelephonyMercurySync.ts +142 -0
- package/src/services/agent/ai-docs/AGENTS.md +1 -1
- package/src/services/agent/ai-docs/agent-spec.md +1 -0
- package/src/services/ai-docs/AGENTS.md +11 -11
- package/src/services/ai-docs/services-spec.md +25 -5
- package/src/services/config/Util.ts +52 -82
- package/src/services/config/ai-docs/AGENTS.md +35 -40
- package/src/services/config/ai-docs/ARCHITECTURE.md +90 -103
- package/src/services/config/ai-docs/config-spec.md +132 -132
- package/src/services/config/constants.ts +39 -85
- package/src/services/config/index.ts +116 -277
- package/src/services/config/types.ts +145 -195
- package/src/services/constants.ts +10 -0
- package/src/services/core/Err.ts +1 -0
- package/src/services/core/Utils.ts +28 -0
- package/src/services/core/WebexRequest.ts +3 -1
- package/src/services/core/ai-docs/core-spec.md +25 -11
- package/src/services/core/aqm-reqs.ts +18 -12
- package/src/services/core/constants.ts +8 -0
- package/src/services/core/types.ts +33 -1
- package/src/services/core/websocket/WebSocketManager.ts +26 -2
- package/src/services/task/Task.ts +386 -12
- package/src/services/task/TaskFactory.ts +33 -6
- package/src/services/task/TaskManager.ts +857 -41
- package/src/services/task/TaskUtils.ts +13 -0
- package/src/services/task/WebexCallingUtils.ts +136 -0
- package/src/services/task/ai-docs/ARCHITECTURE.md +1 -0
- package/src/services/task/ai-docs/task-spec.md +190 -8
- package/src/services/task/constants.ts +13 -0
- package/src/services/task/contact.ts +30 -0
- package/src/services/task/digital/Digital.ts +11 -4
- package/src/services/task/state-machine/TaskStateMachine.ts +235 -81
- package/src/services/task/state-machine/actions.ts +5 -2
- package/src/services/task/state-machine/ai-docs/AGENTS.md +6 -4
- package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +35 -16
- package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +103 -33
- package/src/services/task/state-machine/guards.ts +7 -10
- package/src/services/task/state-machine/types.ts +16 -1
- package/src/services/task/state-machine/uiControlsComputer.ts +206 -32
- package/src/services/task/types.ts +269 -4
- package/src/services/task/voice/Voice.ts +625 -17
- package/src/services/task/voice/WebRTC.ts +11 -4
- package/src/services/task/voice/wxAppOfferObservability.ts +204 -0
- package/src/services/task/voice/wxAppVoiceMethods.ts +575 -0
- package/src/services/wxAppDiagnosticLogging.ts +286 -0
- package/src/services/wxAppTelephonyUtils.ts +14 -0
- package/src/types.ts +159 -13
- package/src/utils/AGENTS.md +21 -10
- package/src/utils/PageCache.ts +38 -5
- package/src/utils/ai-docs/utils-spec.md +21 -11
- package/src/webex.js +8 -0
- package/test/unit/fixtures/aiSummaryTestUtils.ts +40 -0
- package/test/unit/spec/cc.ts +3595 -120
- package/test/unit/spec/index.ts +891 -0
- package/test/unit/spec/metrics/MetricsManager.ts +25 -0
- package/test/unit/spec/metrics/behavioral-events.ts +60 -0
- package/test/unit/spec/services/AddressBook.ts +37 -6
- package/test/unit/spec/services/AnswerCallOnWebexService.ts +264 -0
- package/test/unit/spec/services/ApiAiAssistant.ts +269 -8
- package/test/unit/spec/services/EntryPoint.ts +87 -40
- package/test/unit/spec/services/Queue.ts +123 -12
- package/test/unit/spec/services/WebCallingService.ts +483 -54
- package/test/unit/spec/services/WebexCrossClientService.ts +509 -0
- package/test/unit/spec/services/WxAppTelephonyMercurySync.ts +136 -0
- package/test/unit/spec/services/config/Util.ts +501 -0
- package/test/unit/spec/services/config/index.ts +313 -543
- package/test/unit/spec/services/core/Utils.ts +22 -0
- package/test/unit/spec/services/core/WebexRequest.ts +8 -7
- package/test/unit/spec/services/core/aqm-reqs.ts +142 -1
- package/test/unit/spec/services/core/websocket/WebSocketManager.ts +64 -14
- package/test/unit/spec/services/task/Task.ts +2257 -11
- package/test/unit/spec/services/task/TaskFactory.ts +56 -2
- package/test/unit/spec/services/task/TaskManager.ts +5559 -1493
- package/test/unit/spec/services/task/TaskUtils.ts +72 -0
- package/test/unit/spec/services/task/WebexCallingUtils.ts +153 -0
- package/test/unit/spec/services/task/contact.ts +33 -0
- package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +1501 -92
- package/test/unit/spec/services/task/state-machine/guards.ts +210 -8
- package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +445 -7
- package/test/unit/spec/services/task/voice/Voice.ts +1710 -4
- package/test/unit/spec/services/task/voice/wxAppOfferObservability.ts +361 -0
- package/test/unit/spec/services/task/voice/wxAppVoiceMethods.ts +719 -0
- package/test/unit/spec/services/wxAppDiagnosticLogging.ts +179 -0
- package/test/unit/spec/wellnessSampleUtils.ts +288 -0
- package/typedoc.md +1 -1
- package/umd/contact-center.min.js +2 -2
- package/umd/contact-center.min.js.map +1 -1
|
@@ -6,6 +6,7 @@ import {CONFIG_FILE_NAME} from '../../../../../src/constants';
|
|
|
6
6
|
import MockWebex from '@webex/test-helper-mock-webex';
|
|
7
7
|
import LoggerProxy from '../../../../../src/logger-proxy';
|
|
8
8
|
import * as util from '../../../../../src/services/config/Util';
|
|
9
|
+
import {DEFAULT_AUXCODE_ATTRIBUTES} from '../../../../../src/services/config/constants';
|
|
9
10
|
|
|
10
11
|
jest.mock('../../../../../src/logger-proxy', () => ({
|
|
11
12
|
__esModule: true,
|
|
@@ -44,35 +45,38 @@ describe('AgentConfigService', () => {
|
|
|
44
45
|
jest.clearAllMocks();
|
|
45
46
|
});
|
|
46
47
|
|
|
47
|
-
describe('
|
|
48
|
-
it('should return
|
|
48
|
+
describe('getOrgDesktopLoginConfig', () => {
|
|
49
|
+
it('should return OrgDesktopLoginResponse on success', async () => {
|
|
49
50
|
const mockResponse = {
|
|
50
51
|
statusCode: 200,
|
|
51
52
|
body: {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
organization: {tenantId: 'tenant123', timezone: 'America/New_York'},
|
|
54
|
+
organizationSetting: {webRtcEnabled: true},
|
|
55
|
+
tenantConfiguration: {forceDefaultDn: false},
|
|
56
|
+
urlMappings: {},
|
|
57
|
+
aiFeature: {realtimeTranscripts: {enable: false}},
|
|
57
58
|
},
|
|
58
59
|
};
|
|
59
60
|
(mockWebexRequest.request as jest.Mock).mockResolvedValue(mockResponse);
|
|
60
61
|
|
|
61
|
-
const result = await agentConfigService.
|
|
62
|
+
const result = await agentConfigService.getOrgDesktopLoginConfig(mockOrgId);
|
|
62
63
|
|
|
63
64
|
expect(mockWebexRequest.request).toHaveBeenCalledWith({
|
|
64
65
|
service: mockWccAPIURL,
|
|
65
|
-
resource: `organization/${mockOrgId}/
|
|
66
|
+
resource: `organization/${mockOrgId}/desktop-login`,
|
|
66
67
|
method: 'GET',
|
|
67
68
|
});
|
|
68
69
|
expect(result).toEqual(mockResponse.body);
|
|
69
|
-
expect(LoggerProxy.info).toHaveBeenCalledWith(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
expect(LoggerProxy.info).toHaveBeenCalledWith(
|
|
71
|
+
'Fetching organization desktop-login configuration',
|
|
72
|
+
{
|
|
73
|
+
module: CONFIG_FILE_NAME,
|
|
74
|
+
method: 'getOrgDesktopLoginConfig',
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
expect(LoggerProxy.log).toHaveBeenCalledWith('getOrgDesktopLoginConfig api success.', {
|
|
74
78
|
module: CONFIG_FILE_NAME,
|
|
75
|
-
method: '
|
|
79
|
+
method: 'getOrgDesktopLoginConfig',
|
|
76
80
|
});
|
|
77
81
|
});
|
|
78
82
|
|
|
@@ -80,56 +84,58 @@ describe('AgentConfigService', () => {
|
|
|
80
84
|
const mockError = new Error('API call failed');
|
|
81
85
|
(mockWebexRequest.request as jest.Mock).mockRejectedValue(mockError);
|
|
82
86
|
|
|
83
|
-
await expect(agentConfigService.
|
|
87
|
+
await expect(agentConfigService.getOrgDesktopLoginConfig(mockOrgId)).rejects.toThrow(
|
|
84
88
|
'API call failed'
|
|
85
89
|
);
|
|
90
|
+
expect(LoggerProxy.error).toHaveBeenCalledWith(
|
|
91
|
+
'getOrgDesktopLoginConfig API call failed with Error: API call failed',
|
|
92
|
+
{module: CONFIG_FILE_NAME, method: 'getOrgDesktopLoginConfig'}
|
|
93
|
+
);
|
|
86
94
|
});
|
|
87
95
|
|
|
88
|
-
it('should throw an error if the
|
|
89
|
-
|
|
90
|
-
statusCode: 400,
|
|
91
|
-
};
|
|
92
|
-
(mockWebexRequest.request as jest.Mock).mockResolvedValue(mockResponse);
|
|
96
|
+
it('should throw an error if the call fails with other than 200', async () => {
|
|
97
|
+
(mockWebexRequest.request as jest.Mock).mockResolvedValue({statusCode: 403});
|
|
93
98
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
expect(error).toEqual(new Error(`API call failed with ${mockResponse.statusCode}`));
|
|
98
|
-
}
|
|
99
|
+
await expect(agentConfigService.getOrgDesktopLoginConfig(mockOrgId)).rejects.toThrow(
|
|
100
|
+
'API call failed with 403'
|
|
101
|
+
);
|
|
99
102
|
});
|
|
100
103
|
});
|
|
101
104
|
|
|
102
|
-
describe('
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
it('should return DesktopProfileResponse on success', async () => {
|
|
105
|
+
describe('getUserDesktopLoginConfig', () => {
|
|
106
|
+
it('should return UserDesktopLoginResponse on success', async () => {
|
|
106
107
|
const mockResponse = {
|
|
107
108
|
statusCode: 200,
|
|
108
109
|
body: {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
user: {
|
|
111
|
+
ciUserId: mockAgentId,
|
|
112
|
+
dbId: 'db123',
|
|
113
|
+
firstName: 'John',
|
|
114
|
+
lastName: 'Doe',
|
|
115
|
+
agentProfileId: 'profile123',
|
|
116
|
+
email: 'john.doe@example.com',
|
|
117
|
+
siteId: 'site123',
|
|
118
|
+
},
|
|
119
|
+
agentProfile: {accessIdleCode: 'ALL', dialPlanEnabled: true},
|
|
114
120
|
},
|
|
115
121
|
};
|
|
116
122
|
(mockWebexRequest.request as jest.Mock).mockResolvedValue(mockResponse);
|
|
117
123
|
|
|
118
|
-
const result = await agentConfigService.
|
|
124
|
+
const result = await agentConfigService.getUserDesktopLoginConfig(mockOrgId, mockAgentId);
|
|
119
125
|
|
|
120
126
|
expect(mockWebexRequest.request).toHaveBeenCalledWith({
|
|
121
127
|
service: mockWccAPIURL,
|
|
122
|
-
resource: `organization/${mockOrgId}/
|
|
128
|
+
resource: `organization/${mockOrgId}/v2/user/by-ci-user-id/${mockAgentId}/desktop-login`,
|
|
123
129
|
method: 'GET',
|
|
124
130
|
});
|
|
125
131
|
expect(result).toEqual(mockResponse.body);
|
|
126
|
-
expect(LoggerProxy.info).toHaveBeenCalledWith('Fetching desktop
|
|
132
|
+
expect(LoggerProxy.info).toHaveBeenCalledWith('Fetching user desktop-login configuration', {
|
|
127
133
|
module: CONFIG_FILE_NAME,
|
|
128
|
-
method: '
|
|
134
|
+
method: 'getUserDesktopLoginConfig',
|
|
129
135
|
});
|
|
130
|
-
expect(LoggerProxy.log).toHaveBeenCalledWith('
|
|
136
|
+
expect(LoggerProxy.log).toHaveBeenCalledWith('getUserDesktopLoginConfig api success.', {
|
|
131
137
|
module: CONFIG_FILE_NAME,
|
|
132
|
-
method: '
|
|
138
|
+
method: 'getUserDesktopLoginConfig',
|
|
133
139
|
});
|
|
134
140
|
});
|
|
135
141
|
|
|
@@ -137,47 +143,44 @@ describe('AgentConfigService', () => {
|
|
|
137
143
|
const mockError = new Error('API call failed');
|
|
138
144
|
(mockWebexRequest.request as jest.Mock).mockRejectedValue(mockError);
|
|
139
145
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
146
|
+
await expect(
|
|
147
|
+
agentConfigService.getUserDesktopLoginConfig(mockOrgId, mockAgentId)
|
|
148
|
+
).rejects.toThrow('API call failed');
|
|
149
|
+
expect(LoggerProxy.error).toHaveBeenCalledWith(
|
|
150
|
+
'getUserDesktopLoginConfig API call failed with Error: API call failed',
|
|
151
|
+
{module: CONFIG_FILE_NAME, method: 'getUserDesktopLoginConfig'}
|
|
152
|
+
);
|
|
145
153
|
});
|
|
146
154
|
|
|
147
|
-
it('should throw an error if the
|
|
148
|
-
|
|
149
|
-
statusCode: 400,
|
|
150
|
-
};
|
|
151
|
-
(mockWebexRequest.request as jest.Mock).mockResolvedValue(mockResponse);
|
|
155
|
+
it.each([403, 404])('should throw an error if the call fails with %i', async (statusCode) => {
|
|
156
|
+
(mockWebexRequest.request as jest.Mock).mockResolvedValue({statusCode});
|
|
152
157
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
expect(error).toEqual(new Error(`API call failed with ${mockResponse.statusCode}`));
|
|
157
|
-
}
|
|
158
|
+
await expect(
|
|
159
|
+
agentConfigService.getUserDesktopLoginConfig(mockOrgId, mockAgentId)
|
|
160
|
+
).rejects.toThrow(`API call failed with ${statusCode}`);
|
|
158
161
|
});
|
|
159
162
|
});
|
|
160
163
|
|
|
161
164
|
describe('getListOfTeams', () => {
|
|
162
165
|
const page = 0;
|
|
163
166
|
const pageSize = 10;
|
|
164
|
-
const
|
|
167
|
+
const userDbId = 'db123';
|
|
165
168
|
|
|
166
|
-
it('should return
|
|
169
|
+
it('should filter by unquoted userId and return teams on success', async () => {
|
|
167
170
|
const mockResponse = {
|
|
168
171
|
statusCode: 200,
|
|
169
|
-
body:
|
|
170
|
-
{id: '123', name: 'Team 1'},
|
|
171
|
-
|
|
172
|
-
|
|
172
|
+
body: {
|
|
173
|
+
data: [{id: '123', name: 'Team 1', multiMediaProfileId: 'mm1', siteName: 'Site 1'}],
|
|
174
|
+
meta: {totalPages: 1},
|
|
175
|
+
},
|
|
173
176
|
};
|
|
174
177
|
(mockWebexRequest.request as jest.Mock).mockResolvedValue(mockResponse);
|
|
175
178
|
|
|
176
|
-
const result = await agentConfigService.getListOfTeams(mockOrgId, page, pageSize,
|
|
179
|
+
const result = await agentConfigService.getListOfTeams(mockOrgId, page, pageSize, userDbId);
|
|
177
180
|
|
|
178
181
|
expect(mockWebexRequest.request).toHaveBeenCalledWith({
|
|
179
182
|
service: mockWccAPIURL,
|
|
180
|
-
resource: `organization/${mockOrgId}/v2/team?page=${page}&pageSize=${pageSize}&filter=
|
|
183
|
+
resource: `organization/${mockOrgId}/v2/team?page=${page}&pageSize=${pageSize}&agentView=true&filter=userId==${userDbId}`,
|
|
181
184
|
method: 'GET',
|
|
182
185
|
});
|
|
183
186
|
expect(result).toEqual(mockResponse.body);
|
|
@@ -196,7 +199,7 @@ describe('AgentConfigService', () => {
|
|
|
196
199
|
(mockWebexRequest.request as jest.Mock).mockRejectedValue(mockError);
|
|
197
200
|
|
|
198
201
|
try {
|
|
199
|
-
await agentConfigService.getListOfTeams(mockOrgId, page, pageSize,
|
|
202
|
+
await agentConfigService.getListOfTeams(mockOrgId, page, pageSize, userDbId);
|
|
200
203
|
} catch (error) {
|
|
201
204
|
expect(error).toEqual(mockError);
|
|
202
205
|
}
|
|
@@ -209,7 +212,7 @@ describe('AgentConfigService', () => {
|
|
|
209
212
|
(mockWebexRequest.request as jest.Mock).mockResolvedValue(mockResponse);
|
|
210
213
|
|
|
211
214
|
try {
|
|
212
|
-
await agentConfigService.getListOfTeams(mockOrgId, page, pageSize,
|
|
215
|
+
await agentConfigService.getListOfTeams(mockOrgId, page, pageSize, userDbId);
|
|
213
216
|
} catch (error) {
|
|
214
217
|
expect(error).toEqual(new Error(`API call failed with ${mockResponse.statusCode}`));
|
|
215
218
|
}
|
|
@@ -298,237 +301,6 @@ describe('AgentConfigService', () => {
|
|
|
298
301
|
});
|
|
299
302
|
});
|
|
300
303
|
|
|
301
|
-
describe('getOrgInfo', () => {
|
|
302
|
-
it('should return organization info successfully', async () => {
|
|
303
|
-
const mockResponse = {
|
|
304
|
-
statusCode: 200,
|
|
305
|
-
body: {
|
|
306
|
-
id: 'org123',
|
|
307
|
-
name: 'Organization 123',
|
|
308
|
-
description: 'Description',
|
|
309
|
-
type: 'type',
|
|
310
|
-
status: 'status',
|
|
311
|
-
created: '2021-01-01',
|
|
312
|
-
},
|
|
313
|
-
};
|
|
314
|
-
mockWebexRequest.request.mockResolvedValue(mockResponse);
|
|
315
|
-
|
|
316
|
-
const result = await agentConfigService.getOrgInfo(mockOrgId);
|
|
317
|
-
expect(result).toEqual(mockResponse.body);
|
|
318
|
-
expect(LoggerProxy.log).toHaveBeenCalledWith('getOrgInfo api success.', {
|
|
319
|
-
module: CONFIG_FILE_NAME,
|
|
320
|
-
method: 'getOrgInfo',
|
|
321
|
-
});
|
|
322
|
-
});
|
|
323
|
-
|
|
324
|
-
it('should throw an error if API call returns non-200 status code', async () => {
|
|
325
|
-
const mockError = {statusCode: 500};
|
|
326
|
-
mockWebexRequest.request.mockResolvedValue(mockError);
|
|
327
|
-
|
|
328
|
-
await expect(agentConfigService.getOrgInfo(mockOrgId)).rejects.toThrow(
|
|
329
|
-
'API call failed with 500'
|
|
330
|
-
);
|
|
331
|
-
expect(LoggerProxy.error).toHaveBeenCalledWith(
|
|
332
|
-
'getOrgInfo API call failed with Error: API call failed with 500',
|
|
333
|
-
{module: CONFIG_FILE_NAME, method: 'getOrgInfo'}
|
|
334
|
-
);
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
it('should handle network errors gracefully', async () => {
|
|
338
|
-
const networkError = new Error('Network Error');
|
|
339
|
-
mockWebexRequest.request.mockRejectedValue(networkError);
|
|
340
|
-
|
|
341
|
-
await expect(agentConfigService.getOrgInfo(mockOrgId)).rejects.toThrow('Network Error');
|
|
342
|
-
expect(LoggerProxy.error).toHaveBeenCalledWith(
|
|
343
|
-
'getOrgInfo API call failed with Error: Network Error',
|
|
344
|
-
{module: CONFIG_FILE_NAME, method: 'getOrgInfo'}
|
|
345
|
-
);
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
it('should handle timeout errors gracefully', async () => {
|
|
349
|
-
const timeoutError = new Error('Timeout Error');
|
|
350
|
-
mockWebexRequest.request.mockRejectedValue(timeoutError);
|
|
351
|
-
|
|
352
|
-
await expect(agentConfigService.getOrgInfo(mockOrgId)).rejects.toThrow('Timeout Error');
|
|
353
|
-
expect(LoggerProxy.error).toHaveBeenCalledWith(
|
|
354
|
-
'getOrgInfo API call failed with Error: Timeout Error',
|
|
355
|
-
{module: CONFIG_FILE_NAME, method: 'getOrgInfo'}
|
|
356
|
-
);
|
|
357
|
-
});
|
|
358
|
-
});
|
|
359
|
-
|
|
360
|
-
describe('getOrganizationSetting', () => {
|
|
361
|
-
it('should return organization settings successfully', async () => {
|
|
362
|
-
const mockResponse = {statusCode: 200, body: {data: [{}]}}; // Adjust data accordingly
|
|
363
|
-
mockWebexRequest.request.mockResolvedValue(mockResponse);
|
|
364
|
-
|
|
365
|
-
const result = await agentConfigService.getOrganizationSetting();
|
|
366
|
-
expect(result).toEqual(mockResponse.body.data[0]);
|
|
367
|
-
expect(LoggerProxy.log).toHaveBeenCalledWith('getOrganizationSetting api success.', {
|
|
368
|
-
module: CONFIG_FILE_NAME,
|
|
369
|
-
method: 'getOrganizationSetting',
|
|
370
|
-
});
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
it('should throw an error if API call returns non-200 status code', async () => {
|
|
374
|
-
const mockError = {statusCode: 500};
|
|
375
|
-
mockWebexRequest.request.mockResolvedValue(mockError);
|
|
376
|
-
|
|
377
|
-
await expect(agentConfigService.getOrganizationSetting(mockOrgId)).rejects.toThrow(
|
|
378
|
-
'API call failed with 500'
|
|
379
|
-
);
|
|
380
|
-
expect(LoggerProxy.error).toHaveBeenCalledWith(
|
|
381
|
-
'getOrganizationSetting API call failed with Error: API call failed with 500',
|
|
382
|
-
{module: CONFIG_FILE_NAME, method: 'getOrganizationSetting'}
|
|
383
|
-
);
|
|
384
|
-
});
|
|
385
|
-
|
|
386
|
-
it('should handle network errors gracefully', async () => {
|
|
387
|
-
const networkError = new Error('Network Error');
|
|
388
|
-
mockWebexRequest.request.mockRejectedValue(networkError);
|
|
389
|
-
|
|
390
|
-
await expect(agentConfigService.getOrganizationSetting(mockOrgId)).rejects.toThrow(
|
|
391
|
-
'Network Error'
|
|
392
|
-
);
|
|
393
|
-
expect(LoggerProxy.error).toHaveBeenCalledWith(
|
|
394
|
-
'getOrganizationSetting API call failed with Error: Network Error',
|
|
395
|
-
{module: CONFIG_FILE_NAME, method: 'getOrganizationSetting'}
|
|
396
|
-
);
|
|
397
|
-
});
|
|
398
|
-
|
|
399
|
-
it('should handle timeout errors gracefully', async () => {
|
|
400
|
-
const timeoutError = new Error('Timeout Error');
|
|
401
|
-
mockWebexRequest.request.mockRejectedValue(timeoutError);
|
|
402
|
-
|
|
403
|
-
await expect(agentConfigService.getOrganizationSetting(mockOrgId)).rejects.toThrow(
|
|
404
|
-
'Timeout Error'
|
|
405
|
-
);
|
|
406
|
-
expect(LoggerProxy.error).toHaveBeenCalledWith(
|
|
407
|
-
'getOrganizationSetting API call failed with Error: Timeout Error',
|
|
408
|
-
{module: CONFIG_FILE_NAME, method: 'getOrganizationSetting'}
|
|
409
|
-
);
|
|
410
|
-
});
|
|
411
|
-
});
|
|
412
|
-
|
|
413
|
-
describe('getTenantData', () => {
|
|
414
|
-
it('should return tenant successfully', async () => {
|
|
415
|
-
const mockResponse = {statusCode: 200, body: {data: [{}]}}; // Adjust data accordingly
|
|
416
|
-
mockWebexRequest.request.mockResolvedValue(mockResponse);
|
|
417
|
-
|
|
418
|
-
const result = await agentConfigService.getTenantData(mockOrgId);
|
|
419
|
-
expect(result).toEqual(mockResponse.body.data[0]);
|
|
420
|
-
expect(LoggerProxy.log).toHaveBeenCalledWith('getTenantData api success.', {
|
|
421
|
-
module: CONFIG_FILE_NAME,
|
|
422
|
-
method: 'getTenantData',
|
|
423
|
-
});
|
|
424
|
-
});
|
|
425
|
-
|
|
426
|
-
it('should throw an error if API call returns non-200 status code', async () => {
|
|
427
|
-
const mockError = {statusCode: 500};
|
|
428
|
-
mockWebexRequest.request.mockResolvedValue(mockError);
|
|
429
|
-
|
|
430
|
-
await expect(agentConfigService.getTenantData(mockOrgId)).rejects.toThrow(
|
|
431
|
-
'API call failed with 500'
|
|
432
|
-
);
|
|
433
|
-
expect(LoggerProxy.error).toHaveBeenCalledWith(
|
|
434
|
-
'getTenantData API call failed with Error: API call failed with 500',
|
|
435
|
-
{module: CONFIG_FILE_NAME, method: 'getTenantData'}
|
|
436
|
-
);
|
|
437
|
-
});
|
|
438
|
-
|
|
439
|
-
it('should handle network errors gracefully', async () => {
|
|
440
|
-
const networkError = new Error('Network Error');
|
|
441
|
-
mockWebexRequest.request.mockRejectedValue(networkError);
|
|
442
|
-
|
|
443
|
-
await expect(agentConfigService.getTenantData(mockOrgId)).rejects.toThrow('Network Error');
|
|
444
|
-
expect(LoggerProxy.error).toHaveBeenCalledWith(
|
|
445
|
-
'getTenantData API call failed with Error: Network Error',
|
|
446
|
-
{module: CONFIG_FILE_NAME, method: 'getTenantData'}
|
|
447
|
-
);
|
|
448
|
-
});
|
|
449
|
-
});
|
|
450
|
-
|
|
451
|
-
describe(`getURLMapping`, () => {
|
|
452
|
-
it('should return URL mapping successfully', async () => {
|
|
453
|
-
const mockResponse = {statusCode: 200, body: {data: {}}}; // Adjust data accordingly
|
|
454
|
-
mockWebexRequest.request.mockResolvedValue(mockResponse);
|
|
455
|
-
|
|
456
|
-
const result = await agentConfigService.getURLMapping(mockOrgId);
|
|
457
|
-
expect(result).toEqual(mockResponse.body.data);
|
|
458
|
-
expect(LoggerProxy.log).toHaveBeenCalledWith('getURLMapping api success.', {
|
|
459
|
-
module: CONFIG_FILE_NAME,
|
|
460
|
-
method: 'getURLMapping',
|
|
461
|
-
});
|
|
462
|
-
});
|
|
463
|
-
|
|
464
|
-
it('should throw an error if API call returns non-200 status code', async () => {
|
|
465
|
-
const mockError = {statusCode: 500};
|
|
466
|
-
mockWebexRequest.request.mockResolvedValue(mockError);
|
|
467
|
-
|
|
468
|
-
await expect(agentConfigService.getURLMapping(mockOrgId)).rejects.toThrow(
|
|
469
|
-
'API call failed with 500'
|
|
470
|
-
);
|
|
471
|
-
expect(LoggerProxy.error).toHaveBeenCalledWith(
|
|
472
|
-
'getURLMapping API call failed with Error: API call failed with 500',
|
|
473
|
-
{module: CONFIG_FILE_NAME, method: 'getURLMapping'}
|
|
474
|
-
);
|
|
475
|
-
});
|
|
476
|
-
|
|
477
|
-
it('should handle network errors gracefully', async () => {
|
|
478
|
-
const networkError = new Error('Network Error');
|
|
479
|
-
mockWebexRequest.request.mockRejectedValue(networkError);
|
|
480
|
-
|
|
481
|
-
await expect(agentConfigService.getURLMapping(mockOrgId)).rejects.toThrow('Network Error');
|
|
482
|
-
expect(LoggerProxy.error).toHaveBeenCalledWith(
|
|
483
|
-
'getURLMapping API call failed with Error: Network Error',
|
|
484
|
-
{module: CONFIG_FILE_NAME, method: 'getURLMapping'}
|
|
485
|
-
);
|
|
486
|
-
});
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
describe('getAIFeatureFlags', () => {
|
|
490
|
-
it('should return AI feature flags successfully', async () => {
|
|
491
|
-
const mockResponse = {
|
|
492
|
-
statusCode: 200,
|
|
493
|
-
body: {
|
|
494
|
-
data: [{realtimeTranscripts: {enable: true}}],
|
|
495
|
-
},
|
|
496
|
-
};
|
|
497
|
-
mockWebexRequest.request.mockResolvedValue(mockResponse);
|
|
498
|
-
|
|
499
|
-
const result = await agentConfigService.getAIFeatureFlags(mockOrgId);
|
|
500
|
-
expect(result).toEqual(mockResponse.body);
|
|
501
|
-
expect(LoggerProxy.log).toHaveBeenCalledWith('getAIFeatureFlags api success.', {
|
|
502
|
-
module: CONFIG_FILE_NAME,
|
|
503
|
-
method: 'getAIFeatureFlags',
|
|
504
|
-
});
|
|
505
|
-
});
|
|
506
|
-
|
|
507
|
-
it('should throw an error if API call returns non-200 status code', async () => {
|
|
508
|
-
const mockError = {statusCode: 500};
|
|
509
|
-
mockWebexRequest.request.mockResolvedValue(mockError);
|
|
510
|
-
|
|
511
|
-
await expect(agentConfigService.getAIFeatureFlags(mockOrgId)).rejects.toThrow(
|
|
512
|
-
'API call failed with 500'
|
|
513
|
-
);
|
|
514
|
-
expect(LoggerProxy.error).toHaveBeenCalledWith(
|
|
515
|
-
'getAIFeatureFlags API call failed with Error: API call failed with 500',
|
|
516
|
-
{module: CONFIG_FILE_NAME, method: 'getAIFeatureFlags'}
|
|
517
|
-
);
|
|
518
|
-
});
|
|
519
|
-
|
|
520
|
-
it('should handle network errors gracefully', async () => {
|
|
521
|
-
const networkError = new Error('Network Error');
|
|
522
|
-
mockWebexRequest.request.mockRejectedValue(networkError);
|
|
523
|
-
|
|
524
|
-
await expect(agentConfigService.getAIFeatureFlags(mockOrgId)).rejects.toThrow('Network Error');
|
|
525
|
-
expect(LoggerProxy.error).toHaveBeenCalledWith(
|
|
526
|
-
'getAIFeatureFlags API call failed with Error: Network Error',
|
|
527
|
-
{module: CONFIG_FILE_NAME, method: 'getAIFeatureFlags'}
|
|
528
|
-
);
|
|
529
|
-
});
|
|
530
|
-
});
|
|
531
|
-
|
|
532
304
|
describe(`getDialPlanData`, () => {
|
|
533
305
|
it('should return dial plan data successfully', async () => {
|
|
534
306
|
const mockResponse = {statusCode: 200, body: {data: {}}}; // Adjust data accordingly
|
|
@@ -568,10 +340,10 @@ describe('AgentConfigService', () => {
|
|
|
568
340
|
});
|
|
569
341
|
|
|
570
342
|
describe(`getAllTeams`, () => {
|
|
343
|
+
const userDbId = 'db123';
|
|
344
|
+
|
|
571
345
|
it('should return all teams successfully', async () => {
|
|
572
346
|
const pageSize = 10;
|
|
573
|
-
const filter = ['filter1'];
|
|
574
|
-
const attributes = ['attribute1'];
|
|
575
347
|
|
|
576
348
|
const mockResponseFirst = {
|
|
577
349
|
body: {
|
|
@@ -590,7 +362,7 @@ describe('AgentConfigService', () => {
|
|
|
590
362
|
.mockResolvedValueOnce(mockResponseFirst)
|
|
591
363
|
.mockResolvedValue(mockResponseOther);
|
|
592
364
|
|
|
593
|
-
const result = await agentConfigService.getAllTeams(mockOrgId, pageSize,
|
|
365
|
+
const result = await agentConfigService.getAllTeams(mockOrgId, pageSize, userDbId);
|
|
594
366
|
expect(result).toEqual([
|
|
595
367
|
...mockResponseFirst.body.data,
|
|
596
368
|
...mockResponseOther.body.data,
|
|
@@ -616,15 +388,13 @@ describe('AgentConfigService', () => {
|
|
|
616
388
|
|
|
617
389
|
it('should throw an error if API call returns non-200 status code', async () => {
|
|
618
390
|
const pageSize = 10;
|
|
619
|
-
const filter = ['filter1'];
|
|
620
|
-
const attributes = ['attribute1'];
|
|
621
391
|
|
|
622
392
|
const mockError = {statusCode: 500};
|
|
623
393
|
(mockWebexRequest.request as jest.Mock).mockResolvedValue(mockError);
|
|
624
394
|
|
|
625
|
-
await expect(
|
|
626
|
-
|
|
627
|
-
)
|
|
395
|
+
await expect(agentConfigService.getAllTeams(mockOrgId, pageSize, userDbId)).rejects.toThrow(
|
|
396
|
+
'API call failed with 500'
|
|
397
|
+
);
|
|
628
398
|
expect(LoggerProxy.error).toHaveBeenCalledWith(
|
|
629
399
|
'getListOfTeams API call failed with Error: API call failed with 500',
|
|
630
400
|
{module: CONFIG_FILE_NAME, method: 'getListOfTeams'}
|
|
@@ -705,96 +475,90 @@ describe('AgentConfigService', () => {
|
|
|
705
475
|
});
|
|
706
476
|
});
|
|
707
477
|
|
|
708
|
-
describe('
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
478
|
+
describe('getWellbeingBreakIdleCode', () => {
|
|
479
|
+
it('uses the system-code query and finds the exact code across pages', async () => {
|
|
480
|
+
(mockWebexRequest.request as jest.Mock)
|
|
481
|
+
.mockResolvedValueOnce({
|
|
482
|
+
statusCode: 200,
|
|
483
|
+
body: {
|
|
484
|
+
data: [
|
|
485
|
+
{id: 'other', name: 'Other', active: true, isSystemCode: true, defaultCode: false},
|
|
486
|
+
],
|
|
487
|
+
meta: {totalPages: 2},
|
|
488
|
+
},
|
|
489
|
+
})
|
|
490
|
+
.mockResolvedValueOnce({
|
|
491
|
+
statusCode: 200,
|
|
492
|
+
body: {
|
|
493
|
+
data: [
|
|
494
|
+
{
|
|
495
|
+
id: 'wellbeing-code',
|
|
496
|
+
name: 'WellbeingBreak',
|
|
497
|
+
active: true,
|
|
498
|
+
isSystemCode: true,
|
|
499
|
+
defaultCode: false,
|
|
500
|
+
},
|
|
501
|
+
],
|
|
502
|
+
meta: {totalPages: 2},
|
|
503
|
+
},
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
await expect(agentConfigService.getWellbeingBreakIdleCode(mockOrgId)).resolves.toEqual({
|
|
507
|
+
id: 'wellbeing-code',
|
|
508
|
+
name: 'WellbeingBreak',
|
|
509
|
+
isSystem: true,
|
|
510
|
+
isDefault: false,
|
|
511
|
+
});
|
|
512
|
+
expect(mockWebexRequest.request).toHaveBeenNthCalledWith(1, {
|
|
513
|
+
service: mockWccAPIURL,
|
|
514
|
+
resource:
|
|
515
|
+
`organization/${mockOrgId}/v2/auxiliary-code?page=0&pageSize=100` +
|
|
516
|
+
'&workType=IDLE_CODE&customFilter=isSystemCode==true&desktopProfileFilter=false',
|
|
517
|
+
method: 'GET',
|
|
518
|
+
});
|
|
519
|
+
expect(mockWebexRequest.request).toHaveBeenNthCalledWith(2, {
|
|
520
|
+
service: mockWccAPIURL,
|
|
521
|
+
resource:
|
|
522
|
+
`organization/${mockOrgId}/v2/auxiliary-code?page=1&pageSize=100` +
|
|
523
|
+
'&workType=IDLE_CODE&customFilter=isSystemCode==true&desktopProfileFilter=false',
|
|
524
|
+
method: 'GET',
|
|
525
|
+
});
|
|
526
|
+
});
|
|
713
527
|
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
528
|
+
it('rejects when the exact system code is unavailable', async () => {
|
|
529
|
+
(mockWebexRequest.request as jest.Mock).mockResolvedValue({
|
|
530
|
+
statusCode: 200,
|
|
531
|
+
body: {
|
|
532
|
+
data: [
|
|
533
|
+
{id: 'inactive', name: 'WellbeingBreak', active: false, isSystemCode: true},
|
|
534
|
+
{id: 'lookalike', name: 'wellbeingbreak', active: true, isSystemCode: true},
|
|
535
|
+
],
|
|
536
|
+
meta: {totalPages: 1},
|
|
537
|
+
},
|
|
538
|
+
});
|
|
719
539
|
|
|
540
|
+
await expect(agentConfigService.getWellbeingBreakIdleCode(mockOrgId)).rejects.toThrow(
|
|
541
|
+
'WELLBEING_BREAK_IDLE_CODE_NOT_FOUND'
|
|
542
|
+
);
|
|
543
|
+
});
|
|
544
|
+
});
|
|
545
|
+
|
|
546
|
+
describe('getAgentConfig', () => {
|
|
720
547
|
const mockSiteInfo = {
|
|
721
548
|
id: 'c6a5451f-5ba7-49a1-aee8-fbef70c19ece',
|
|
722
549
|
name: 'Site-1',
|
|
723
550
|
multimediaProfileId: 'c5888e6f-5661-4871-9936-cbcec7658d41',
|
|
724
551
|
};
|
|
725
552
|
|
|
726
|
-
const
|
|
727
|
-
{
|
|
728
|
-
|
|
729
|
-
];
|
|
730
|
-
|
|
731
|
-
const mockAIFeatureFlags = {
|
|
732
|
-
data: [{realtimeTranscripts: {enable: true}}],
|
|
733
|
-
};
|
|
734
|
-
|
|
735
|
-
beforeEach(() => {
|
|
736
|
-
jest.clearAllMocks();
|
|
737
|
-
});
|
|
738
|
-
|
|
739
|
-
it('should fetch and parse agent configuration successfully', async () => {
|
|
740
|
-
const mockAgentId = 'agent001';
|
|
741
|
-
const mockUserConfig = {
|
|
742
|
-
ciUserId: 'agent001',
|
|
743
|
-
firstName: 'John',
|
|
744
|
-
lastName: 'Doe',
|
|
745
|
-
email: 'john.doe@example.com',
|
|
746
|
-
agentProfileId: 'profile123',
|
|
747
|
-
siteId: 'site789',
|
|
748
|
-
dbId: 'db123',
|
|
749
|
-
deafultDialledNumber: '1234567890',
|
|
750
|
-
id: 'user001',
|
|
751
|
-
teamIds: ['team1', 'team2'],
|
|
752
|
-
};
|
|
753
|
-
|
|
754
|
-
const mockAgentProfile = {
|
|
755
|
-
timeoutDesktopInactivityCustomEnabled: true,
|
|
756
|
-
timeoutDesktopInactivityMins: 10,
|
|
757
|
-
accessWrapUpCode: 'SPECIFIC',
|
|
758
|
-
wrapUpCodes: ['aux1'],
|
|
759
|
-
accessIdleCode: 'SPECIFIC',
|
|
760
|
-
idleCodes: ['aux2'],
|
|
761
|
-
autoWrapUp: true,
|
|
762
|
-
autoWrapAfterSeconds: 30,
|
|
763
|
-
lastAgentRouting: true,
|
|
764
|
-
allowAutoWrapUpExtension: false,
|
|
765
|
-
outdialEnabled: true,
|
|
766
|
-
dialPlanEnabled: false,
|
|
767
|
-
agentAvailableAfterOutdial: true,
|
|
768
|
-
outdialEntryPointId: 'entryPoint123',
|
|
769
|
-
consultToQueue: true,
|
|
770
|
-
addressBookId: 'addressBook123',
|
|
771
|
-
outdialANIId: 'ani123',
|
|
772
|
-
dialPlans: ['plan1', 'plan2'],
|
|
773
|
-
agentDNValidation: 'validation123',
|
|
774
|
-
};
|
|
775
|
-
|
|
776
|
-
const mockDialPlanData = [];
|
|
777
|
-
|
|
778
|
-
const mockTeamData = [
|
|
779
|
-
{id: 'team1', name: 'Support Team'},
|
|
780
|
-
{id: 'team2', name: 'Sales Team'},
|
|
781
|
-
];
|
|
782
|
-
|
|
783
|
-
const mockOrgInfo = {
|
|
784
|
-
tenantId: 'tenant123',
|
|
785
|
-
timezone: 'GMT',
|
|
786
|
-
environment: 'produs1',
|
|
787
|
-
};
|
|
788
|
-
|
|
789
|
-
const mockOrgSettings = {
|
|
553
|
+
const mockOrgConfig = {
|
|
554
|
+
organization: {tenantId: 'tenant123', timezone: 'GMT'},
|
|
555
|
+
organizationSetting: {
|
|
790
556
|
campaignManagerEnabled: true,
|
|
791
557
|
webRtcEnabled: true,
|
|
792
558
|
maskSensitiveData: false,
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
const mockTenantData = {
|
|
559
|
+
},
|
|
560
|
+
tenantConfiguration: {
|
|
796
561
|
timeoutDesktopInactivityEnabled: false,
|
|
797
|
-
timeoutDesktopInactivityMins: 15,
|
|
798
562
|
forceDefaultDn: true,
|
|
799
563
|
dnDefaultRegex: 'regexUS',
|
|
800
564
|
dnOtherRegex: 'regexOther',
|
|
@@ -803,33 +567,94 @@ describe('AgentConfigService', () => {
|
|
|
803
567
|
endCallEnabled: true,
|
|
804
568
|
endConsultEnabled: true,
|
|
805
569
|
callVariablesSuppressed: false,
|
|
806
|
-
|
|
570
|
+
lostConnectionRecoveryTimeout: 120000,
|
|
571
|
+
},
|
|
572
|
+
urlMappings: {},
|
|
573
|
+
aiFeature: {realtimeTranscripts: {enable: true}},
|
|
574
|
+
webexConfig: {showUserDetails: false, stateSynchronization: true},
|
|
575
|
+
};
|
|
807
576
|
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
577
|
+
const mockUser = {
|
|
578
|
+
ciUserId: 'agent001',
|
|
579
|
+
firstName: 'John',
|
|
580
|
+
lastName: 'Doe',
|
|
581
|
+
email: 'john.doe@example.com',
|
|
582
|
+
agentProfileId: 'profile123',
|
|
583
|
+
skillProfileId: 'skillProfile456',
|
|
584
|
+
siteId: 'site789',
|
|
585
|
+
dbId: 'db123',
|
|
586
|
+
deafultDialledNumber: '1234567890',
|
|
587
|
+
id: 'user001',
|
|
588
|
+
};
|
|
815
589
|
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
590
|
+
const mockAgentProfile = {
|
|
591
|
+
timeoutDesktopInactivityCustomEnabled: true,
|
|
592
|
+
timeoutDesktopInactivityMins: 10,
|
|
593
|
+
accessWrapUpCode: 'ALL',
|
|
594
|
+
accessIdleCode: 'ALL',
|
|
595
|
+
autoWrapUp: true,
|
|
596
|
+
autoWrapAfterSeconds: 30,
|
|
597
|
+
lastAgentRouting: true,
|
|
598
|
+
allowAutoWrapUpExtension: false,
|
|
599
|
+
outdialEnabled: true,
|
|
600
|
+
dialPlanEnabled: false,
|
|
601
|
+
agentAvailableAfterOutdial: true,
|
|
602
|
+
outdialEntryPointId: 'entryPoint123',
|
|
603
|
+
consultToQueue: true,
|
|
604
|
+
viewableStatistics: {agentStats: true},
|
|
605
|
+
addressBookId: 'addressBook123',
|
|
606
|
+
outdialANIId: 'ani123',
|
|
607
|
+
loginVoiceOptions: ['BROWSER', 'EXTENSION'],
|
|
608
|
+
agentDNValidation: 'PROVISIONED_VALUE',
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
const mockTeamData = [
|
|
612
|
+
{id: 'team1', name: 'Support Team', multiMediaProfileId: 'mmTeam123'},
|
|
613
|
+
];
|
|
614
|
+
|
|
615
|
+
const mockAuxCodes = [
|
|
616
|
+
{id: 'aux1', workTypeCode: 'WRAP_UP_CODE', name: 'Wrap Up Code 1', active: true},
|
|
617
|
+
{id: 'aux2', workTypeCode: 'IDLE_CODE', name: 'Idle Code 1', active: true},
|
|
618
|
+
];
|
|
619
|
+
|
|
620
|
+
const mockDialPlanData = [
|
|
621
|
+
{
|
|
622
|
+
id: 'dialPlan1',
|
|
623
|
+
name: 'Plan 1',
|
|
624
|
+
regularExpression: '[0-9]+',
|
|
625
|
+
prefix: '1',
|
|
626
|
+
strippedChars: '( )-',
|
|
627
|
+
active: true,
|
|
628
|
+
},
|
|
629
|
+
];
|
|
630
|
+
|
|
631
|
+
/** Stubs every call getAgentConfig makes, so each test overrides only what it exercises. */
|
|
632
|
+
const stubConfigCalls = ({
|
|
633
|
+
agentProfile = mockAgentProfile,
|
|
634
|
+
teamData = mockTeamData,
|
|
635
|
+
}: {agentProfile?: object; teamData?: object[]} = {}) => {
|
|
636
|
+
agentConfigService.getOrgDesktopLoginConfig = jest.fn().mockResolvedValue(mockOrgConfig);
|
|
637
|
+
agentConfigService.getUserDesktopLoginConfig = jest
|
|
638
|
+
.fn()
|
|
639
|
+
.mockResolvedValue({user: mockUser, agentProfile});
|
|
824
640
|
agentConfigService.getAllAuxCodes = jest.fn().mockResolvedValue(mockAuxCodes);
|
|
825
|
-
agentConfigService.
|
|
641
|
+
agentConfigService.getSiteInfo = jest.fn().mockResolvedValue(mockSiteInfo);
|
|
642
|
+
agentConfigService.getAllTeams = jest.fn().mockResolvedValue(teamData);
|
|
826
643
|
agentConfigService.getDialPlanData = jest.fn().mockResolvedValue(mockDialPlanData);
|
|
827
|
-
|
|
644
|
+
};
|
|
828
645
|
|
|
829
|
-
|
|
646
|
+
beforeEach(() => {
|
|
647
|
+
jest.clearAllMocks();
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
it('should fetch and parse agent configuration successfully', async () => {
|
|
651
|
+
const parseAgentConfigsSpy = jest.spyOn(util, 'parseAgentConfigs');
|
|
652
|
+
stubConfigCalls();
|
|
653
|
+
|
|
654
|
+
await agentConfigService.getAgentConfig(mockOrgId, mockAgentId);
|
|
830
655
|
|
|
831
656
|
expect(LoggerProxy.info).toHaveBeenCalledWith(
|
|
832
|
-
`Fetched user data, userId: ${
|
|
657
|
+
`Fetched user data, userId: ${mockUser.ciUserId}`,
|
|
833
658
|
{
|
|
834
659
|
module: CONFIG_FILE_NAME,
|
|
835
660
|
method: 'getAgentConfig',
|
|
@@ -850,172 +675,117 @@ describe('AgentConfigService', () => {
|
|
|
850
675
|
expect(parseAgentConfigsSpy).toHaveBeenCalledTimes(1);
|
|
851
676
|
|
|
852
677
|
expect(parseAgentConfigsSpy).toHaveBeenCalledWith({
|
|
853
|
-
|
|
678
|
+
orgConfig: mockOrgConfig,
|
|
679
|
+
userData: mockUser,
|
|
680
|
+
agentProfileData: mockAgentProfile,
|
|
854
681
|
teamData: mockTeamData,
|
|
855
|
-
tenantData: mockTenantData,
|
|
856
|
-
orgInfoData: mockOrgInfo,
|
|
857
682
|
auxCodes: mockAuxCodes,
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
dialPlanData: mockDialPlanData,
|
|
861
|
-
urlMapping: mockURLMapping,
|
|
862
|
-
multimediaProfileId: mockSiteInfo.multimediaProfileId,
|
|
863
|
-
aiFeatureFlags: mockAIFeatureFlags,
|
|
683
|
+
dialPlanData: [],
|
|
684
|
+
multimediaProfileId: 'mmTeam123',
|
|
864
685
|
});
|
|
865
686
|
});
|
|
866
687
|
|
|
867
|
-
it('should
|
|
868
|
-
|
|
869
|
-
const mockUserConfig = {
|
|
870
|
-
ciUserId: 'agent001',
|
|
871
|
-
firstName: 'John',
|
|
872
|
-
lastName: 'Doe',
|
|
873
|
-
email: 'john.doe@example.com',
|
|
874
|
-
agentProfileId: 'profile123',
|
|
875
|
-
skillProfileId: 'skillProfile456',
|
|
876
|
-
siteId: 'site789',
|
|
877
|
-
dbId: 'db123',
|
|
878
|
-
deafultDialledNumber: '1234567890',
|
|
879
|
-
id: 'user001',
|
|
880
|
-
teamIds: ['team1', 'team2'],
|
|
881
|
-
};
|
|
688
|
+
it('should request both aggregates and the aux-code pool for the given org and agent', async () => {
|
|
689
|
+
stubConfigCalls();
|
|
882
690
|
|
|
883
|
-
|
|
884
|
-
timeoutDesktopInactivityCustomEnabled: false,
|
|
885
|
-
timeoutDesktopInactivityMins: 10,
|
|
886
|
-
accessWrapUpCode: 'ALL',
|
|
887
|
-
wrapUpCodes: [],
|
|
888
|
-
accessIdleCode: 'ALL',
|
|
889
|
-
idleCodes: [],
|
|
890
|
-
autoWrapUp: true,
|
|
891
|
-
autoWrapAfterSeconds: 30,
|
|
892
|
-
lastAgentRouting: true,
|
|
893
|
-
allowAutoWrapUpExtension: false,
|
|
894
|
-
outdialEnabled: true,
|
|
895
|
-
dialPlanEnabled: true,
|
|
896
|
-
agentAvailableAfterOutdial: true,
|
|
897
|
-
outdialEntryPointId: 'entryPoint123',
|
|
898
|
-
consultToQueue: true,
|
|
899
|
-
viewableStatistics: {agentStats: true},
|
|
900
|
-
addressBookId: 'addressBook123',
|
|
901
|
-
outdialANIId: 'ani123',
|
|
902
|
-
loginVoiceOptions: ['option1', 'option2'],
|
|
903
|
-
dialPlans: ['dialPlan1', 'dialPlan2'],
|
|
904
|
-
agentDNValidation: 'validation123',
|
|
905
|
-
};
|
|
691
|
+
await agentConfigService.getAgentConfig(mockOrgId, mockAgentId);
|
|
906
692
|
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
693
|
+
expect(agentConfigService.getOrgDesktopLoginConfig).toHaveBeenCalledWith(mockOrgId);
|
|
694
|
+
expect(agentConfigService.getUserDesktopLoginConfig).toHaveBeenCalledWith(
|
|
695
|
+
mockOrgId,
|
|
696
|
+
mockAgentId
|
|
697
|
+
);
|
|
698
|
+
expect(agentConfigService.getAllAuxCodes).toHaveBeenCalledWith(
|
|
699
|
+
mockOrgId,
|
|
700
|
+
100,
|
|
701
|
+
[],
|
|
702
|
+
DEFAULT_AUXCODE_ATTRIBUTES
|
|
703
|
+
);
|
|
704
|
+
});
|
|
911
705
|
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
{id: 'team2', name: 'Sales Team'},
|
|
915
|
-
];
|
|
706
|
+
it('should query teams by the user dbId and the site by the user siteId', async () => {
|
|
707
|
+
stubConfigCalls();
|
|
916
708
|
|
|
917
|
-
|
|
918
|
-
tenantId: 'tenant123',
|
|
919
|
-
timezone: 'GMT',
|
|
920
|
-
environment: 'produs1',
|
|
921
|
-
};
|
|
709
|
+
await agentConfigService.getAgentConfig(mockOrgId, mockAgentId);
|
|
922
710
|
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
maskSensitiveData: true,
|
|
927
|
-
};
|
|
711
|
+
expect(agentConfigService.getAllTeams).toHaveBeenCalledWith(mockOrgId, 100, mockUser.dbId);
|
|
712
|
+
expect(agentConfigService.getSiteInfo).toHaveBeenCalledWith(mockOrgId, mockUser.siteId);
|
|
713
|
+
});
|
|
928
714
|
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
outdialEnabled: true,
|
|
937
|
-
endCallEnabled: true,
|
|
938
|
-
endConsultEnabled: true,
|
|
939
|
-
callVariablesSuppressed: false,
|
|
940
|
-
lostConnectionRecoveryTimeout: 30,
|
|
941
|
-
};
|
|
715
|
+
it.each([
|
|
716
|
+
{dialPlanEnabled: true, expectedCalls: 1},
|
|
717
|
+
{dialPlanEnabled: false, expectedCalls: 0},
|
|
718
|
+
])(
|
|
719
|
+
'should issue the dial-plan call $expectedCalls time(s) when dialPlanEnabled is $dialPlanEnabled',
|
|
720
|
+
async ({dialPlanEnabled, expectedCalls}) => {
|
|
721
|
+
stubConfigCalls({agentProfile: {...mockAgentProfile, dialPlanEnabled}});
|
|
942
722
|
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
data: [{realtimeTranscripts: {enable: true}}],
|
|
949
|
-
};
|
|
723
|
+
await agentConfigService.getAgentConfig(mockOrgId, mockAgentId);
|
|
724
|
+
|
|
725
|
+
expect(agentConfigService.getDialPlanData).toHaveBeenCalledTimes(expectedCalls);
|
|
726
|
+
}
|
|
727
|
+
);
|
|
950
728
|
|
|
729
|
+
it.each([
|
|
730
|
+
{
|
|
731
|
+
scenario: 'the team value when the agent has a team',
|
|
732
|
+
teamData: mockTeamData,
|
|
733
|
+
expected: 'mmTeam123',
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
scenario: 'the site value when the agent has no team',
|
|
737
|
+
teamData: [],
|
|
738
|
+
expected: mockSiteInfo.multimediaProfileId,
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
scenario: 'the site value when the team carries no multimedia profile',
|
|
742
|
+
teamData: [{id: 'team1', name: 'Support Team'}],
|
|
743
|
+
expected: mockSiteInfo.multimediaProfileId,
|
|
744
|
+
},
|
|
745
|
+
])('should resolve multimediaProfileId to $scenario', async ({teamData, expected}) => {
|
|
951
746
|
const parseAgentConfigsSpy = jest.spyOn(util, 'parseAgentConfigs');
|
|
952
|
-
|
|
953
|
-
agentConfigService.getOrgInfo = jest.fn().mockResolvedValue(mockOrgInfo);
|
|
954
|
-
agentConfigService.getOrganizationSetting = jest.fn().mockResolvedValue(mockOrgSettings);
|
|
955
|
-
agentConfigService.getSiteInfo = jest.fn().mockResolvedValue(mockSiteInfo);
|
|
956
|
-
agentConfigService.getTenantData = jest.fn().mockResolvedValue(mockTenantData);
|
|
957
|
-
agentConfigService.getURLMapping = jest.fn().mockResolvedValue(mockURLMapping);
|
|
958
|
-
agentConfigService.getAIFeatureFlags = jest.fn().mockResolvedValue(mockAIFeatureFlags);
|
|
959
|
-
agentConfigService.getAllAuxCodes = jest.fn().mockResolvedValue(mockAuxCodes);
|
|
960
|
-
agentConfigService.getDesktopProfileById = jest.fn().mockResolvedValue(mockAgentProfile);
|
|
961
|
-
agentConfigService.getDialPlanData = jest.fn().mockResolvedValue(mockDialPlanData);
|
|
962
|
-
agentConfigService.getAllTeams = jest.fn().mockResolvedValue(mockTeamData);
|
|
747
|
+
stubConfigCalls({teamData});
|
|
963
748
|
|
|
964
|
-
|
|
749
|
+
await agentConfigService.getAgentConfig(mockOrgId, mockAgentId);
|
|
965
750
|
|
|
966
|
-
expect(
|
|
967
|
-
|
|
968
|
-
{
|
|
969
|
-
module: CONFIG_FILE_NAME,
|
|
970
|
-
method: 'getAgentConfig',
|
|
971
|
-
}
|
|
751
|
+
expect(parseAgentConfigsSpy).toHaveBeenCalledWith(
|
|
752
|
+
expect.objectContaining({multimediaProfileId: expected})
|
|
972
753
|
);
|
|
973
|
-
|
|
974
|
-
module: CONFIG_FILE_NAME,
|
|
975
|
-
method: 'getAgentConfig',
|
|
976
|
-
});
|
|
977
|
-
expect(LoggerProxy.info).toHaveBeenCalledWith('Parsing completed for agent-config', {
|
|
978
|
-
module: CONFIG_FILE_NAME,
|
|
979
|
-
method: 'getAgentConfig',
|
|
980
|
-
});
|
|
981
|
-
expect(LoggerProxy.info).toHaveBeenCalledWith('Fetched configuration data successfully', {
|
|
982
|
-
module: CONFIG_FILE_NAME,
|
|
983
|
-
method: 'getAgentConfig',
|
|
984
|
-
});
|
|
985
|
-
expect(parseAgentConfigsSpy).toHaveBeenCalledTimes(1);
|
|
754
|
+
});
|
|
986
755
|
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
756
|
+
it('should build the dial plan from the dial-plan response when dial planning is enabled', async () => {
|
|
757
|
+
const parseAgentConfigsSpy = jest.spyOn(util, 'parseAgentConfigs');
|
|
758
|
+
stubConfigCalls({agentProfile: {...mockAgentProfile, dialPlanEnabled: true}});
|
|
759
|
+
|
|
760
|
+
const result = await agentConfigService.getAgentConfig(mockOrgId, mockAgentId);
|
|
761
|
+
|
|
762
|
+
expect(parseAgentConfigsSpy).toHaveBeenCalledWith(
|
|
763
|
+
expect.objectContaining({dialPlanData: mockDialPlanData})
|
|
764
|
+
);
|
|
765
|
+
expect(result.dialPlan).toEqual({
|
|
766
|
+
type: 'adhocDial',
|
|
767
|
+
dialPlanEntity: [{regex: '[0-9]+', prefix: '1', strippedChars: '( )-', name: 'Plan 1'}],
|
|
999
768
|
});
|
|
1000
769
|
});
|
|
1001
770
|
|
|
1002
|
-
it(
|
|
1003
|
-
|
|
771
|
+
it.each([
|
|
772
|
+
'getOrgDesktopLoginConfig',
|
|
773
|
+
'getUserDesktopLoginConfig',
|
|
774
|
+
'getAllAuxCodes',
|
|
775
|
+
'getSiteInfo',
|
|
776
|
+
'getAllTeams',
|
|
777
|
+
])('should throw an error if %s fails', async (failingCall) => {
|
|
1004
778
|
const mockError = new Error('API call failed');
|
|
1005
|
-
|
|
1006
|
-
agentConfigService
|
|
1007
|
-
agentConfigService.getOrganizationSetting = jest.fn().mockResolvedValue({});
|
|
1008
|
-
agentConfigService.getTenantData = jest.fn().mockResolvedValue({});
|
|
1009
|
-
agentConfigService.getURLMapping = jest.fn().mockResolvedValue({});
|
|
1010
|
-
agentConfigService.getAIFeatureFlags = jest.fn().mockResolvedValue({data: []});
|
|
1011
|
-
agentConfigService.getAllAuxCodes = jest.fn().mockResolvedValue({});
|
|
1012
|
-
agentConfigService.getDesktopProfileById = jest.fn().mockResolvedValue({});
|
|
1013
|
-
agentConfigService.getDialPlanData = jest.fn().mockResolvedValue({});
|
|
1014
|
-
agentConfigService.getAllTeams = jest.fn().mockResolvedValue({});
|
|
779
|
+
stubConfigCalls();
|
|
780
|
+
agentConfigService[failingCall] = jest.fn().mockRejectedValue(mockError);
|
|
1015
781
|
|
|
1016
782
|
await expect(agentConfigService.getAgentConfig(mockOrgId, mockAgentId)).rejects.toThrow(
|
|
1017
783
|
'API call failed'
|
|
1018
784
|
);
|
|
785
|
+
expect(LoggerProxy.error).toHaveBeenCalledWith(
|
|
786
|
+
'getAgentConfig call failed with Error: API call failed',
|
|
787
|
+
{module: CONFIG_FILE_NAME, method: 'getAgentConfig'}
|
|
788
|
+
);
|
|
1019
789
|
});
|
|
1020
790
|
});
|
|
1021
791
|
|