@webex/calling 3.10.0-next.2 → 3.10.0-next.21
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/dist/CallHistory/CallHistory.js +128 -128
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +278 -181
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallSettings/CallSettings.js +17 -18
- package/dist/CallSettings/CallSettings.js.map +1 -1
- package/dist/CallSettings/CallSettings.test.js +14 -14
- package/dist/CallSettings/CallSettings.test.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.js +71 -24
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +136 -47
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +137 -138
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +145 -149
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +297 -345
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +267 -405
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.js +7 -8
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +24 -24
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +655 -611
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +762 -551
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +15 -18
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +113 -113
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/constants.js +5 -1
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +57 -74
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +22 -22
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +657 -526
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +657 -309
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +24 -24
- package/dist/CallingClient/registration/webWorker.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.test.js +20 -20
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +28 -28
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -1
- package/dist/Contacts/ContactsClient.js +258 -258
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +60 -60
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Errors/catalog/CallError.js +7 -10
- package/dist/Errors/catalog/CallError.js.map +1 -1
- package/dist/Errors/catalog/CallingDeviceError.js +6 -9
- package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
- package/dist/Errors/catalog/ExtendedError.js +6 -8
- package/dist/Errors/catalog/ExtendedError.js.map +1 -1
- package/dist/Errors/catalog/LineError.js +6 -9
- package/dist/Errors/catalog/LineError.js.map +1 -1
- package/dist/Events/impl/index.js +11 -13
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/Metrics/index.js +1 -2
- package/dist/Metrics/index.js.map +1 -1
- package/dist/SDKConnector/index.js +1 -2
- package/dist/SDKConnector/index.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +129 -128
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +98 -98
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +86 -86
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +72 -72
- package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +58 -61
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/Voicemail.test.js +20 -20
- package/dist/Voicemail/Voicemail.test.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +116 -117
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +140 -140
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
- package/dist/common/Utils.js +195 -165
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +432 -183
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/constants.js +3 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/testUtil.js +5 -4
- package/dist/common/testUtil.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +7 -3
- package/dist/module/CallSettings/UcmBackendConnector.js +20 -6
- package/dist/module/CallSettings/WxCallBackendConnector.js +3 -1
- package/dist/module/CallingClient/CallingClient.js +83 -121
- package/dist/module/CallingClient/calling/call.js +60 -39
- package/dist/module/CallingClient/constants.js +3 -0
- package/dist/module/CallingClient/registration/register.js +82 -2
- package/dist/module/Contacts/ContactsClient.js +9 -5
- package/dist/module/Voicemail/BroadworksBackendConnector.js +3 -1
- package/dist/module/Voicemail/UcmBackendConnector.js +2 -1
- package/dist/module/common/Utils.js +27 -3
- package/dist/module/common/constants.js +2 -0
- package/dist/module/common/testUtil.js +1 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts +1 -0
- package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +4 -0
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +3 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +4 -0
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +6 -0
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/Contacts/ContactsClient.d.ts +1 -0
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +16 -0
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/constants.d.ts +2 -0
- package/dist/types/common/constants.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +1 -0
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -7,11 +7,11 @@ var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/
|
|
|
7
7
|
var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
|
|
8
8
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
9
9
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
11
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
12
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
13
10
|
var _assign = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/assign"));
|
|
14
11
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
12
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
13
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
15
15
|
var _uuid = require("uuid");
|
|
16
16
|
var _calling = require("../CallingClient/calling");
|
|
17
17
|
var _Errors = require("../Errors");
|
|
@@ -65,6 +65,255 @@ describe('Mobius service discovery tests', function () {
|
|
|
65
65
|
expect(filteredUris.backup.length).toBe(0);
|
|
66
66
|
});
|
|
67
67
|
});
|
|
68
|
+
describe('Call Tests - keepalive (handleCallEstablished) cases', function () {
|
|
69
|
+
var logObj = {
|
|
70
|
+
file: _constants.CALL_FILE,
|
|
71
|
+
method: 'handleCallErrors'
|
|
72
|
+
};
|
|
73
|
+
var dummyCorrelationId = '8a67806f-fc4d-446b-a131-31e71ea5b010';
|
|
74
|
+
beforeEach(function () {
|
|
75
|
+
jest.clearAllMocks();
|
|
76
|
+
});
|
|
77
|
+
it('401 during keepalive emits token error and ends call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
78
|
+
var emitted, retrySpy, payload, abort;
|
|
79
|
+
return _regenerator.default.wrap(function (_context) {
|
|
80
|
+
while (1) switch (_context.prev = _context.next) {
|
|
81
|
+
case 0:
|
|
82
|
+
emitted = false;
|
|
83
|
+
retrySpy = jest.fn();
|
|
84
|
+
payload = {
|
|
85
|
+
statusCode: 401,
|
|
86
|
+
headers: {
|
|
87
|
+
trackingid: 't'
|
|
88
|
+
},
|
|
89
|
+
body: {
|
|
90
|
+
device: {
|
|
91
|
+
deviceId: 'd'
|
|
92
|
+
},
|
|
93
|
+
errorCode: 0
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
_context.next = 1;
|
|
97
|
+
return (0, _Utils.handleCallErrors)(function () {
|
|
98
|
+
emitted = true;
|
|
99
|
+
}, _types2.ERROR_LAYER.CALL_CONTROL, retrySpy, dummyCorrelationId, payload, 'handleCallEstablished', logObj.file);
|
|
100
|
+
case 1:
|
|
101
|
+
abort = _context.sent;
|
|
102
|
+
expect(emitted).toBe(true);
|
|
103
|
+
expect(abort).toBe(true);
|
|
104
|
+
expect(retrySpy).not.toHaveBeenCalled();
|
|
105
|
+
case 2:
|
|
106
|
+
case "end":
|
|
107
|
+
return _context.stop();
|
|
108
|
+
}
|
|
109
|
+
}, _callee);
|
|
110
|
+
})));
|
|
111
|
+
it('403 during keepalive emits error and ends call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
112
|
+
var emitted, retrySpy, payload, abort;
|
|
113
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
114
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
115
|
+
case 0:
|
|
116
|
+
emitted = false;
|
|
117
|
+
retrySpy = jest.fn();
|
|
118
|
+
payload = {
|
|
119
|
+
statusCode: 403,
|
|
120
|
+
headers: {
|
|
121
|
+
trackingid: 't'
|
|
122
|
+
},
|
|
123
|
+
body: {
|
|
124
|
+
device: {
|
|
125
|
+
deviceId: 'd'
|
|
126
|
+
},
|
|
127
|
+
errorCode: 0
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
_context2.next = 1;
|
|
131
|
+
return (0, _Utils.handleCallErrors)(function () {
|
|
132
|
+
emitted = true;
|
|
133
|
+
}, _types2.ERROR_LAYER.CALL_CONTROL, retrySpy, dummyCorrelationId, payload, 'handleCallEstablished', logObj.file);
|
|
134
|
+
case 1:
|
|
135
|
+
abort = _context2.sent;
|
|
136
|
+
expect(emitted).toBe(true);
|
|
137
|
+
expect(abort).toBe(true);
|
|
138
|
+
expect(retrySpy).not.toHaveBeenCalled();
|
|
139
|
+
case 2:
|
|
140
|
+
case "end":
|
|
141
|
+
return _context2.stop();
|
|
142
|
+
}
|
|
143
|
+
}, _callee2);
|
|
144
|
+
})));
|
|
145
|
+
it('500 during keepalive with retry-after triggers retryCb with interval', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
146
|
+
var emitted, endSpy, retrySpy, payload;
|
|
147
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
148
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
149
|
+
case 0:
|
|
150
|
+
emitted = false;
|
|
151
|
+
endSpy = jest.fn();
|
|
152
|
+
retrySpy = jest.fn();
|
|
153
|
+
payload = {
|
|
154
|
+
statusCode: 500,
|
|
155
|
+
headers: {
|
|
156
|
+
trackingid: 't',
|
|
157
|
+
'retry-after': 2
|
|
158
|
+
},
|
|
159
|
+
body: {
|
|
160
|
+
device: {
|
|
161
|
+
deviceId: 'd'
|
|
162
|
+
},
|
|
163
|
+
errorCode: 0
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
_context3.next = 1;
|
|
167
|
+
return (0, _Utils.handleCallErrors)(function () {
|
|
168
|
+
emitted = true;
|
|
169
|
+
}, _types2.ERROR_LAYER.CALL_CONTROL, retrySpy, dummyCorrelationId, payload, 'handleCallEstablished', logObj.file, endSpy);
|
|
170
|
+
case 1:
|
|
171
|
+
expect(emitted).toBe(true);
|
|
172
|
+
expect(endSpy).not.toHaveBeenCalled();
|
|
173
|
+
expect(retrySpy).toHaveBeenCalledWith(2);
|
|
174
|
+
case 2:
|
|
175
|
+
case "end":
|
|
176
|
+
return _context3.stop();
|
|
177
|
+
}
|
|
178
|
+
}, _callee3);
|
|
179
|
+
})));
|
|
180
|
+
it('500 during keepalive without retry-after triggers retryCb without args', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
181
|
+
var emitted, retrySpy, payload, abort;
|
|
182
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
183
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
184
|
+
case 0:
|
|
185
|
+
emitted = false;
|
|
186
|
+
retrySpy = jest.fn();
|
|
187
|
+
payload = {
|
|
188
|
+
statusCode: 500,
|
|
189
|
+
headers: {
|
|
190
|
+
trackingid: 't'
|
|
191
|
+
},
|
|
192
|
+
body: {
|
|
193
|
+
device: {
|
|
194
|
+
deviceId: 'd'
|
|
195
|
+
},
|
|
196
|
+
errorCode: 0
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
_context4.next = 1;
|
|
200
|
+
return (0, _Utils.handleCallErrors)(function () {
|
|
201
|
+
emitted = true;
|
|
202
|
+
}, _types2.ERROR_LAYER.CALL_CONTROL, retrySpy, dummyCorrelationId, payload, 'handleCallEstablished', logObj.file);
|
|
203
|
+
case 1:
|
|
204
|
+
abort = _context4.sent;
|
|
205
|
+
expect(abort).toBe(false);
|
|
206
|
+
expect(emitted).toBe(true);
|
|
207
|
+
expect(retrySpy).toHaveBeenCalledWith(_constants.DEFAULT_KEEPALIVE_INTERVAL);
|
|
208
|
+
case 2:
|
|
209
|
+
case "end":
|
|
210
|
+
return _context4.stop();
|
|
211
|
+
}
|
|
212
|
+
}, _callee4);
|
|
213
|
+
})));
|
|
214
|
+
it('404 during keepalive emits not found and ends call (no retry)', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
215
|
+
var emitted, retrySpy, payload, abort;
|
|
216
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
217
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
218
|
+
case 0:
|
|
219
|
+
emitted = false;
|
|
220
|
+
retrySpy = jest.fn();
|
|
221
|
+
payload = {
|
|
222
|
+
statusCode: 404,
|
|
223
|
+
headers: {
|
|
224
|
+
trackingid: 't'
|
|
225
|
+
},
|
|
226
|
+
body: {
|
|
227
|
+
device: {
|
|
228
|
+
deviceId: 'd'
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
_context5.next = 1;
|
|
233
|
+
return (0, _Utils.handleCallErrors)(function () {
|
|
234
|
+
emitted = true;
|
|
235
|
+
}, _types2.ERROR_LAYER.CALL_CONTROL, retrySpy, dummyCorrelationId, payload, 'handleCallEstablished', logObj.file);
|
|
236
|
+
case 1:
|
|
237
|
+
abort = _context5.sent;
|
|
238
|
+
expect(emitted).toBe(true);
|
|
239
|
+
expect(abort).toBe(true);
|
|
240
|
+
expect(retrySpy).not.toHaveBeenCalled();
|
|
241
|
+
case 2:
|
|
242
|
+
case "end":
|
|
243
|
+
return _context5.stop();
|
|
244
|
+
}
|
|
245
|
+
}, _callee5);
|
|
246
|
+
})));
|
|
247
|
+
it('503 during keepalive with retry-after does not invoke emitterCb and retries with interval', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
248
|
+
var emitted, retrySpy, payload, abort;
|
|
249
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
250
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
251
|
+
case 0:
|
|
252
|
+
emitted = false;
|
|
253
|
+
retrySpy = jest.fn();
|
|
254
|
+
payload = {
|
|
255
|
+
statusCode: 503,
|
|
256
|
+
headers: {
|
|
257
|
+
trackingid: 't',
|
|
258
|
+
'retry-after': 7
|
|
259
|
+
},
|
|
260
|
+
body: {
|
|
261
|
+
device: {
|
|
262
|
+
deviceId: 'd'
|
|
263
|
+
},
|
|
264
|
+
errorCode: 0
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
_context6.next = 1;
|
|
268
|
+
return (0, _Utils.handleCallErrors)(function () {
|
|
269
|
+
emitted = true;
|
|
270
|
+
}, _types2.ERROR_LAYER.CALL_CONTROL, retrySpy, dummyCorrelationId, payload, 'handleCallEstablished', logObj.file);
|
|
271
|
+
case 1:
|
|
272
|
+
abort = _context6.sent;
|
|
273
|
+
expect(abort).toBe(false);
|
|
274
|
+
expect(emitted).toBe(false);
|
|
275
|
+
expect(retrySpy).toHaveBeenCalledWith(7);
|
|
276
|
+
case 2:
|
|
277
|
+
case "end":
|
|
278
|
+
return _context6.stop();
|
|
279
|
+
}
|
|
280
|
+
}, _callee6);
|
|
281
|
+
})));
|
|
282
|
+
it('503 during keepalive without retry-after invokes emitterCb and triggers retryCb without args', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
283
|
+
var emitted, retrySpy, payload, abort;
|
|
284
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
285
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
286
|
+
case 0:
|
|
287
|
+
emitted = false;
|
|
288
|
+
retrySpy = jest.fn();
|
|
289
|
+
payload = {
|
|
290
|
+
statusCode: 503,
|
|
291
|
+
headers: {
|
|
292
|
+
trackingid: 't'
|
|
293
|
+
},
|
|
294
|
+
body: {
|
|
295
|
+
device: {
|
|
296
|
+
deviceId: 'd'
|
|
297
|
+
},
|
|
298
|
+
errorCode: 111
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
_context7.next = 1;
|
|
302
|
+
return (0, _Utils.handleCallErrors)(function () {
|
|
303
|
+
emitted = true;
|
|
304
|
+
}, _types2.ERROR_LAYER.CALL_CONTROL, retrySpy, dummyCorrelationId, payload, 'handleCallEstablished', logObj.file);
|
|
305
|
+
case 1:
|
|
306
|
+
abort = _context7.sent;
|
|
307
|
+
expect(abort).toBe(false);
|
|
308
|
+
expect(emitted).toBe(true);
|
|
309
|
+
expect(retrySpy).toHaveBeenCalledWith(_constants.DEFAULT_KEEPALIVE_INTERVAL);
|
|
310
|
+
case 2:
|
|
311
|
+
case "end":
|
|
312
|
+
return _context7.stop();
|
|
313
|
+
}
|
|
314
|
+
}, _callee7);
|
|
315
|
+
})));
|
|
316
|
+
});
|
|
68
317
|
describe('Registration Tests', function () {
|
|
69
318
|
/**
|
|
70
319
|
* TestCase inputs
|
|
@@ -287,10 +536,10 @@ describe('CallingClient Error Tests', function () {
|
|
|
287
536
|
beforeEach(function () {
|
|
288
537
|
jest.clearAllMocks();
|
|
289
538
|
});
|
|
290
|
-
it('verify 401 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
539
|
+
it('verify 401 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
291
540
|
var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
|
|
292
|
-
return _regenerator.default.wrap(function
|
|
293
|
-
while (1) switch (
|
|
541
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
542
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
294
543
|
case 0:
|
|
295
544
|
statusCode = _types2.ERROR_CODE.UNAUTHORIZED;
|
|
296
545
|
message = 'User is unauthorized due to an expired token.';
|
|
@@ -315,24 +564,24 @@ describe('CallingClient Error Tests', function () {
|
|
|
315
564
|
context: logObj
|
|
316
565
|
};
|
|
317
566
|
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
318
|
-
|
|
567
|
+
_context8.next = 1;
|
|
319
568
|
return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
|
|
320
|
-
case
|
|
321
|
-
result =
|
|
569
|
+
case 1:
|
|
570
|
+
result = _context8.sent;
|
|
322
571
|
expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
|
|
323
572
|
expect(result).toBe(finalError);
|
|
324
573
|
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
|
|
325
574
|
expect(logSpy).toHaveBeenCalledWith('401 Unauthorized', logObj);
|
|
326
|
-
case
|
|
575
|
+
case 2:
|
|
327
576
|
case "end":
|
|
328
|
-
return
|
|
577
|
+
return _context8.stop();
|
|
329
578
|
}
|
|
330
|
-
},
|
|
579
|
+
}, _callee8);
|
|
331
580
|
})));
|
|
332
|
-
it('verify 500 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
581
|
+
it('verify 500 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
333
582
|
var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
|
|
334
|
-
return _regenerator.default.wrap(function
|
|
335
|
-
while (1) switch (
|
|
583
|
+
return _regenerator.default.wrap(function (_context9) {
|
|
584
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
336
585
|
case 0:
|
|
337
586
|
statusCode = _types2.ERROR_CODE.INTERNAL_SERVER_ERROR;
|
|
338
587
|
message = 'An unknown error occurred while placing the request. Wait a moment and try again.';
|
|
@@ -357,24 +606,24 @@ describe('CallingClient Error Tests', function () {
|
|
|
357
606
|
context: logObj
|
|
358
607
|
};
|
|
359
608
|
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
360
|
-
|
|
609
|
+
_context9.next = 1;
|
|
361
610
|
return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
|
|
362
|
-
case
|
|
363
|
-
result =
|
|
611
|
+
case 1:
|
|
612
|
+
result = _context9.sent;
|
|
364
613
|
expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
|
|
365
614
|
expect(result).toBe(finalError);
|
|
366
615
|
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
|
|
367
616
|
expect(logSpy).toHaveBeenCalledWith('500 Internal Server Error', logObj);
|
|
368
|
-
case
|
|
617
|
+
case 2:
|
|
369
618
|
case "end":
|
|
370
|
-
return
|
|
619
|
+
return _context9.stop();
|
|
371
620
|
}
|
|
372
|
-
},
|
|
621
|
+
}, _callee9);
|
|
373
622
|
})));
|
|
374
|
-
it('verify unknown error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
623
|
+
it('verify unknown error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
|
|
375
624
|
var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
|
|
376
|
-
return _regenerator.default.wrap(function
|
|
377
|
-
while (1) switch (
|
|
625
|
+
return _regenerator.default.wrap(function (_context0) {
|
|
626
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
378
627
|
case 0:
|
|
379
628
|
statusCode = 206;
|
|
380
629
|
message = 'Unknown error';
|
|
@@ -399,19 +648,19 @@ describe('CallingClient Error Tests', function () {
|
|
|
399
648
|
context: logObj
|
|
400
649
|
};
|
|
401
650
|
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
402
|
-
|
|
651
|
+
_context0.next = 1;
|
|
403
652
|
return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
|
|
404
|
-
case
|
|
405
|
-
result =
|
|
653
|
+
case 1:
|
|
654
|
+
result = _context0.sent;
|
|
406
655
|
expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
|
|
407
656
|
expect(result).toBe(finalError);
|
|
408
657
|
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
|
|
409
658
|
expect(logSpy).toHaveBeenCalledWith('Unknown Error', logObj);
|
|
410
|
-
case
|
|
659
|
+
case 2:
|
|
411
660
|
case "end":
|
|
412
|
-
return
|
|
661
|
+
return _context0.stop();
|
|
413
662
|
}
|
|
414
|
-
},
|
|
663
|
+
}, _callee0);
|
|
415
664
|
})));
|
|
416
665
|
});
|
|
417
666
|
describe('Call Tests', function () {
|
|
@@ -959,11 +1208,11 @@ describe('resolveContact tests', function () {
|
|
|
959
1208
|
}));
|
|
960
1209
|
});
|
|
961
1210
|
});
|
|
962
|
-
it('Resolve by userExternalId - SCIM exception', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1211
|
+
it('Resolve by userExternalId - SCIM exception', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
963
1212
|
var _callingPartyInfo$use2;
|
|
964
1213
|
var callingPartyInfo, warnSpy, webexSpy, displayInfo, query;
|
|
965
|
-
return _regenerator.default.wrap(function
|
|
966
|
-
while (1) switch (
|
|
1214
|
+
return _regenerator.default.wrap(function (_context1) {
|
|
1215
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
967
1216
|
case 0:
|
|
968
1217
|
callingPartyInfo = {};
|
|
969
1218
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
@@ -973,10 +1222,10 @@ describe('resolveContact tests', function () {
|
|
|
973
1222
|
callingPartyInfo.userExternalId = {
|
|
974
1223
|
$: 'userExternalId'
|
|
975
1224
|
};
|
|
976
|
-
|
|
1225
|
+
_context1.next = 1;
|
|
977
1226
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
978
|
-
case
|
|
979
|
-
displayInfo =
|
|
1227
|
+
case 1:
|
|
1228
|
+
displayInfo = _context1.sent;
|
|
980
1229
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
|
|
981
1230
|
expect(warnSpy).toHaveBeenCalledWith('Error response: - 500', {
|
|
982
1231
|
file: _constants.UTILS_FILE,
|
|
@@ -986,17 +1235,17 @@ describe('resolveContact tests', function () {
|
|
|
986
1235
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
987
1236
|
uri: query
|
|
988
1237
|
}));
|
|
989
|
-
case
|
|
1238
|
+
case 2:
|
|
990
1239
|
case "end":
|
|
991
|
-
return
|
|
1240
|
+
return _context1.stop();
|
|
992
1241
|
}
|
|
993
|
-
},
|
|
1242
|
+
}, _callee1);
|
|
994
1243
|
})));
|
|
995
|
-
it('Resolve by userExternalId - totalResults zero', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1244
|
+
it('Resolve by userExternalId - totalResults zero', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
996
1245
|
var _callingPartyInfo$use3;
|
|
997
1246
|
var callingPartyInfo, scimResponse, webexSpy, displayInfo, query;
|
|
998
|
-
return _regenerator.default.wrap(function
|
|
999
|
-
while (1) switch (
|
|
1247
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
1248
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
1000
1249
|
case 0:
|
|
1001
1250
|
callingPartyInfo = {};
|
|
1002
1251
|
scimResponse = (0, _testUtil.getSampleScimResponse)();
|
|
@@ -1008,27 +1257,27 @@ describe('resolveContact tests', function () {
|
|
|
1008
1257
|
callingPartyInfo.userExternalId = {
|
|
1009
1258
|
$: 'userExternalId'
|
|
1010
1259
|
};
|
|
1011
|
-
|
|
1260
|
+
_context10.next = 1;
|
|
1012
1261
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1013
|
-
case
|
|
1014
|
-
displayInfo =
|
|
1262
|
+
case 1:
|
|
1263
|
+
displayInfo = _context10.sent;
|
|
1015
1264
|
query = scimUrl + encodeURIComponent("id eq \"".concat((_callingPartyInfo$use3 = callingPartyInfo.userExternalId) === null || _callingPartyInfo$use3 === void 0 ? void 0 : _callingPartyInfo$use3.$, "\""));
|
|
1016
1265
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
|
|
1017
1266
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1018
1267
|
uri: query
|
|
1019
1268
|
}));
|
|
1020
1269
|
scimResponse.totalResults = '1';
|
|
1021
|
-
case
|
|
1270
|
+
case 2:
|
|
1022
1271
|
case "end":
|
|
1023
|
-
return
|
|
1272
|
+
return _context10.stop();
|
|
1024
1273
|
}
|
|
1025
|
-
},
|
|
1274
|
+
}, _callee10);
|
|
1026
1275
|
})));
|
|
1027
|
-
it('Resolve by userExternalId - no primary number and no phone numbers', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1276
|
+
it('Resolve by userExternalId - no primary number and no phone numbers', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
1028
1277
|
var _callingPartyInfo$use4, _displayInfo, _displayInfo2;
|
|
1029
1278
|
var callingPartyInfo, scimResponse, webexSpy, displayInfo, query, phoneNumbers;
|
|
1030
|
-
return _regenerator.default.wrap(function
|
|
1031
|
-
while (1) switch (
|
|
1279
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
1280
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1032
1281
|
case 0:
|
|
1033
1282
|
callingPartyInfo = {};
|
|
1034
1283
|
scimResponse = (0, _testUtil.getSampleScimResponse)();
|
|
@@ -1040,10 +1289,10 @@ describe('resolveContact tests', function () {
|
|
|
1040
1289
|
callingPartyInfo.userExternalId = {
|
|
1041
1290
|
$: 'userExternalId'
|
|
1042
1291
|
};
|
|
1043
|
-
|
|
1292
|
+
_context11.next = 1;
|
|
1044
1293
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1045
|
-
case
|
|
1046
|
-
displayInfo =
|
|
1294
|
+
case 1:
|
|
1295
|
+
displayInfo = _context11.sent;
|
|
1047
1296
|
query = scimUrl + encodeURIComponent("id eq \"".concat((_callingPartyInfo$use4 = callingPartyInfo.userExternalId) === null || _callingPartyInfo$use4 === void 0 ? void 0 : _callingPartyInfo$use4.$, "\""));
|
|
1048
1297
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1049
1298
|
uri: query
|
|
@@ -1059,20 +1308,20 @@ describe('resolveContact tests', function () {
|
|
|
1059
1308
|
statusCode: 200,
|
|
1060
1309
|
body: scimResponse
|
|
1061
1310
|
});
|
|
1062
|
-
|
|
1311
|
+
_context11.next = 2;
|
|
1063
1312
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1064
|
-
case
|
|
1065
|
-
displayInfo =
|
|
1313
|
+
case 2:
|
|
1314
|
+
displayInfo = _context11.sent;
|
|
1066
1315
|
expect((_displayInfo2 = displayInfo) === null || _displayInfo2 === void 0 ? void 0 : _displayInfo2.num).toBeUndefined();
|
|
1067
1316
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1068
1317
|
uri: query
|
|
1069
1318
|
}));
|
|
1070
1319
|
scimResponse.Resources[0].phoneNumbers = phoneNumbers;
|
|
1071
|
-
case
|
|
1320
|
+
case 3:
|
|
1072
1321
|
case "end":
|
|
1073
|
-
return
|
|
1322
|
+
return _context11.stop();
|
|
1074
1323
|
}
|
|
1075
|
-
},
|
|
1324
|
+
}, _callee11);
|
|
1076
1325
|
})));
|
|
1077
1326
|
it('Resolve by userExternalId - no photo', function () {
|
|
1078
1327
|
var callingPartyInfo = {};
|
|
@@ -1137,10 +1386,10 @@ describe('resolveContact tests', function () {
|
|
|
1137
1386
|
}));
|
|
1138
1387
|
});
|
|
1139
1388
|
});
|
|
1140
|
-
it('Resolve by name - Empty Info', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1389
|
+
it('Resolve by name - Empty Info', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
1141
1390
|
var callingPartyInfo, peopleListResponse, items, webexSpy, displayInfo;
|
|
1142
|
-
return _regenerator.default.wrap(function
|
|
1143
|
-
while (1) switch (
|
|
1391
|
+
return _regenerator.default.wrap(function (_context12) {
|
|
1392
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1144
1393
|
case 0:
|
|
1145
1394
|
callingPartyInfo = {};
|
|
1146
1395
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1150,26 +1399,26 @@ describe('resolveContact tests', function () {
|
|
|
1150
1399
|
callingPartyInfo.name = {
|
|
1151
1400
|
$: 'Name'
|
|
1152
1401
|
};
|
|
1153
|
-
|
|
1402
|
+
_context12.next = 1;
|
|
1154
1403
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1155
|
-
case
|
|
1156
|
-
displayInfo =
|
|
1404
|
+
case 1:
|
|
1405
|
+
displayInfo = _context12.sent;
|
|
1157
1406
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
|
|
1158
1407
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1159
1408
|
displayName: 'Name'
|
|
1160
1409
|
}));
|
|
1161
1410
|
peopleListResponse.items = items;
|
|
1162
|
-
case
|
|
1411
|
+
case 2:
|
|
1163
1412
|
case "end":
|
|
1164
|
-
return
|
|
1413
|
+
return _context12.stop();
|
|
1165
1414
|
}
|
|
1166
|
-
},
|
|
1415
|
+
}, _callee12);
|
|
1167
1416
|
})));
|
|
1168
|
-
it('Resolve by name - ID as plain UUID instead of part of URI', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1417
|
+
it('Resolve by name - ID as plain UUID instead of part of URI', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
1169
1418
|
var _displayInfo3, _displayInfo4, _displayInfo5, _displayInfo6, _displayInfo7, _displayInfo8;
|
|
1170
1419
|
var callingPartyInfo, peopleListResponse, id, webexSpy, displayInfo;
|
|
1171
|
-
return _regenerator.default.wrap(function
|
|
1172
|
-
while (1) switch (
|
|
1420
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
1421
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1173
1422
|
case 0:
|
|
1174
1423
|
callingPartyInfo = {};
|
|
1175
1424
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1180,10 +1429,10 @@ describe('resolveContact tests', function () {
|
|
|
1180
1429
|
callingPartyInfo.name = {
|
|
1181
1430
|
$: 'Name'
|
|
1182
1431
|
};
|
|
1183
|
-
|
|
1432
|
+
_context13.next = 1;
|
|
1184
1433
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1185
|
-
case
|
|
1186
|
-
displayInfo =
|
|
1434
|
+
case 1:
|
|
1435
|
+
displayInfo = _context13.sent;
|
|
1187
1436
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1188
1437
|
displayName: 'Name'
|
|
1189
1438
|
}));
|
|
@@ -1196,26 +1445,26 @@ describe('resolveContact tests', function () {
|
|
|
1196
1445
|
/* Also test empty id */
|
|
1197
1446
|
peopleListResponse.items[0].id = '';
|
|
1198
1447
|
webex.people.list.mockResolvedValueOnce(peopleListResponse);
|
|
1199
|
-
|
|
1448
|
+
_context13.next = 2;
|
|
1200
1449
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1201
|
-
case
|
|
1202
|
-
displayInfo =
|
|
1450
|
+
case 2:
|
|
1451
|
+
displayInfo = _context13.sent;
|
|
1203
1452
|
expect((_displayInfo7 = displayInfo) === null || _displayInfo7 === void 0 ? void 0 : _displayInfo7.id).toStrictEqual('');
|
|
1204
1453
|
expect((_displayInfo8 = displayInfo) === null || _displayInfo8 === void 0 ? void 0 : _displayInfo8.name).toStrictEqual(peopleListResponse.items[0].displayName);
|
|
1205
1454
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1206
1455
|
displayName: 'Name'
|
|
1207
1456
|
}));
|
|
1208
1457
|
peopleListResponse.items[0].id = id;
|
|
1209
|
-
case
|
|
1458
|
+
case 3:
|
|
1210
1459
|
case "end":
|
|
1211
|
-
return
|
|
1460
|
+
return _context13.stop();
|
|
1212
1461
|
}
|
|
1213
|
-
},
|
|
1462
|
+
}, _callee13);
|
|
1214
1463
|
})));
|
|
1215
|
-
it('Resolve by name - Phone numbers no match for type - work', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1464
|
+
it('Resolve by name - Phone numbers no match for type - work', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
1216
1465
|
var callingPartyInfo, peopleListResponse, phoneNumbers, webexSpy, displayInfo;
|
|
1217
|
-
return _regenerator.default.wrap(function
|
|
1218
|
-
while (1) switch (
|
|
1466
|
+
return _regenerator.default.wrap(function (_context14) {
|
|
1467
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1219
1468
|
case 0:
|
|
1220
1469
|
callingPartyInfo = {};
|
|
1221
1470
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1226,10 +1475,10 @@ describe('resolveContact tests', function () {
|
|
|
1226
1475
|
callingPartyInfo.name = {
|
|
1227
1476
|
$: 'Name'
|
|
1228
1477
|
};
|
|
1229
|
-
|
|
1478
|
+
_context14.next = 1;
|
|
1230
1479
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1231
|
-
case
|
|
1232
|
-
displayInfo =
|
|
1480
|
+
case 1:
|
|
1481
|
+
displayInfo = _context14.sent;
|
|
1233
1482
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toStrictEqual(peopleListResponse.items[0].displayName);
|
|
1234
1483
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.num).toStrictEqual(peopleListResponse.items[0].phoneNumbers[0].value);
|
|
1235
1484
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.avatarSrc).toStrictEqual(peopleListResponse.items[0].avatar);
|
|
@@ -1237,16 +1486,16 @@ describe('resolveContact tests', function () {
|
|
|
1237
1486
|
displayName: 'Name'
|
|
1238
1487
|
}));
|
|
1239
1488
|
peopleListResponse.items[0].phoneNumbers = phoneNumbers;
|
|
1240
|
-
case
|
|
1489
|
+
case 2:
|
|
1241
1490
|
case "end":
|
|
1242
|
-
return
|
|
1491
|
+
return _context14.stop();
|
|
1243
1492
|
}
|
|
1244
|
-
},
|
|
1493
|
+
}, _callee14);
|
|
1245
1494
|
})));
|
|
1246
|
-
it('Resolve by name - Phone numbers empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1495
|
+
it('Resolve by name - Phone numbers empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
1247
1496
|
var callingPartyInfo, peopleListResponse, phoneNumbers, webexSpy, displayInfo;
|
|
1248
|
-
return _regenerator.default.wrap(function
|
|
1249
|
-
while (1) switch (
|
|
1497
|
+
return _regenerator.default.wrap(function (_context15) {
|
|
1498
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1250
1499
|
case 0:
|
|
1251
1500
|
callingPartyInfo = {};
|
|
1252
1501
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1256,10 +1505,10 @@ describe('resolveContact tests', function () {
|
|
|
1256
1505
|
callingPartyInfo.name = {
|
|
1257
1506
|
$: 'Name'
|
|
1258
1507
|
};
|
|
1259
|
-
|
|
1508
|
+
_context15.next = 1;
|
|
1260
1509
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1261
|
-
case
|
|
1262
|
-
displayInfo =
|
|
1510
|
+
case 1:
|
|
1511
|
+
displayInfo = _context15.sent;
|
|
1263
1512
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1264
1513
|
displayName: 'Name'
|
|
1265
1514
|
}));
|
|
@@ -1267,11 +1516,11 @@ describe('resolveContact tests', function () {
|
|
|
1267
1516
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.num).toBeUndefined();
|
|
1268
1517
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.avatarSrc).toStrictEqual(peopleListResponse.items[0].avatar);
|
|
1269
1518
|
peopleListResponse.items[0].phoneNumbers = phoneNumbers;
|
|
1270
|
-
case
|
|
1519
|
+
case 2:
|
|
1271
1520
|
case "end":
|
|
1272
|
-
return
|
|
1521
|
+
return _context15.stop();
|
|
1273
1522
|
}
|
|
1274
|
-
},
|
|
1523
|
+
}, _callee15);
|
|
1275
1524
|
})));
|
|
1276
1525
|
});
|
|
1277
1526
|
describe('Store and Fetch voicemail tests', function () {
|
|
@@ -1389,40 +1638,40 @@ describe('Infer id from UUID Tests', function () {
|
|
|
1389
1638
|
});
|
|
1390
1639
|
});
|
|
1391
1640
|
describe('Get endpoint by CALLING_BACKEND tests', function () {
|
|
1392
|
-
it('verify invalid calling backend ucm for xsi endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1393
|
-
|
|
1394
|
-
|
|
1641
|
+
it('verify invalid calling backend ucm for xsi endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
1642
|
+
var _t;
|
|
1643
|
+
return _regenerator.default.wrap(function (_context16) {
|
|
1644
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1395
1645
|
case 0:
|
|
1396
|
-
|
|
1397
|
-
|
|
1646
|
+
_t = expect;
|
|
1647
|
+
_context16.next = 1;
|
|
1398
1648
|
return (0, _Utils.getXsiActionEndpoint)(webex, {
|
|
1399
1649
|
file: 'testFile',
|
|
1400
1650
|
method: 'testMethod'
|
|
1401
1651
|
}, _types.CALLING_BACKEND.UCM);
|
|
1402
|
-
case
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
case 5:
|
|
1652
|
+
case 1:
|
|
1653
|
+
_t(_context16.sent).toBeInstanceOf(Error);
|
|
1654
|
+
case 2:
|
|
1406
1655
|
case "end":
|
|
1407
|
-
return
|
|
1656
|
+
return _context16.stop();
|
|
1408
1657
|
}
|
|
1409
|
-
},
|
|
1658
|
+
}, _callee16);
|
|
1410
1659
|
})));
|
|
1411
|
-
it('verify invalid calling backend wxc for vg endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1412
|
-
|
|
1413
|
-
|
|
1660
|
+
it('verify invalid calling backend wxc for vg endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
1661
|
+
var _t2;
|
|
1662
|
+
return _regenerator.default.wrap(function (_context17) {
|
|
1663
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1414
1664
|
case 0:
|
|
1415
|
-
|
|
1416
|
-
|
|
1665
|
+
_t2 = expect;
|
|
1666
|
+
_context17.next = 1;
|
|
1417
1667
|
return (0, _Utils.getVgActionEndpoint)(webex, _types.CALLING_BACKEND.WXC);
|
|
1418
|
-
case
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
case 5:
|
|
1668
|
+
case 1:
|
|
1669
|
+
_t2(_context17.sent).toBeInstanceOf(Error);
|
|
1670
|
+
case 2:
|
|
1422
1671
|
case "end":
|
|
1423
|
-
return
|
|
1672
|
+
return _context17.stop();
|
|
1424
1673
|
}
|
|
1425
|
-
},
|
|
1674
|
+
}, _callee17);
|
|
1426
1675
|
})));
|
|
1427
1676
|
});
|
|
1428
1677
|
describe('Get XSI Action Endpoint tests', function () {
|
|
@@ -1440,10 +1689,10 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1440
1689
|
file: 'testFile',
|
|
1441
1690
|
method: 'testMethod'
|
|
1442
1691
|
};
|
|
1443
|
-
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1692
|
+
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
1444
1693
|
var mockResponse, xsiEndpoint;
|
|
1445
|
-
return _regenerator.default.wrap(function
|
|
1446
|
-
while (1) switch (
|
|
1694
|
+
return _regenerator.default.wrap(function (_context18) {
|
|
1695
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1447
1696
|
case 0:
|
|
1448
1697
|
mockResponse = {
|
|
1449
1698
|
body: {
|
|
@@ -1455,22 +1704,22 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1455
1704
|
}
|
|
1456
1705
|
};
|
|
1457
1706
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1458
|
-
|
|
1707
|
+
_context18.next = 1;
|
|
1459
1708
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1460
|
-
case
|
|
1461
|
-
xsiEndpoint =
|
|
1709
|
+
case 1:
|
|
1710
|
+
xsiEndpoint = _context18.sent;
|
|
1462
1711
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1463
1712
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1464
|
-
case
|
|
1713
|
+
case 2:
|
|
1465
1714
|
case "end":
|
|
1466
|
-
return
|
|
1715
|
+
return _context18.stop();
|
|
1467
1716
|
}
|
|
1468
|
-
},
|
|
1717
|
+
}, _callee18);
|
|
1469
1718
|
})));
|
|
1470
|
-
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1719
|
+
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
1471
1720
|
var mockResponse, xsiEndpoint;
|
|
1472
|
-
return _regenerator.default.wrap(function
|
|
1473
|
-
while (1) switch (
|
|
1721
|
+
return _regenerator.default.wrap(function (_context19) {
|
|
1722
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1474
1723
|
case 0:
|
|
1475
1724
|
mockResponse = {
|
|
1476
1725
|
body: {
|
|
@@ -1482,22 +1731,22 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1482
1731
|
}
|
|
1483
1732
|
};
|
|
1484
1733
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1485
|
-
|
|
1734
|
+
_context19.next = 1;
|
|
1486
1735
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1487
|
-
case
|
|
1488
|
-
xsiEndpoint =
|
|
1736
|
+
case 1:
|
|
1737
|
+
xsiEndpoint = _context19.sent;
|
|
1489
1738
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1490
1739
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1491
|
-
case
|
|
1740
|
+
case 2:
|
|
1492
1741
|
case "end":
|
|
1493
|
-
return
|
|
1742
|
+
return _context19.stop();
|
|
1494
1743
|
}
|
|
1495
|
-
},
|
|
1744
|
+
}, _callee19);
|
|
1496
1745
|
})));
|
|
1497
|
-
it('should return xsiEndpoint for BWRKS backend when URL does not end with any version', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1746
|
+
it('should return xsiEndpoint for BWRKS backend when URL does not end with any version', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
1498
1747
|
var mockResponse, xsiEndpoint;
|
|
1499
|
-
return _regenerator.default.wrap(function
|
|
1500
|
-
while (1) switch (
|
|
1748
|
+
return _regenerator.default.wrap(function (_context20) {
|
|
1749
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1501
1750
|
case 0:
|
|
1502
1751
|
mockResponse = {
|
|
1503
1752
|
body: {
|
|
@@ -1509,17 +1758,17 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1509
1758
|
}
|
|
1510
1759
|
};
|
|
1511
1760
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1512
|
-
|
|
1761
|
+
_context20.next = 1;
|
|
1513
1762
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1514
|
-
case
|
|
1515
|
-
xsiEndpoint =
|
|
1763
|
+
case 1:
|
|
1764
|
+
xsiEndpoint = _context20.sent;
|
|
1516
1765
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1517
1766
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1518
|
-
case
|
|
1767
|
+
case 2:
|
|
1519
1768
|
case "end":
|
|
1520
|
-
return
|
|
1769
|
+
return _context20.stop();
|
|
1521
1770
|
}
|
|
1522
|
-
},
|
|
1771
|
+
}, _callee20);
|
|
1523
1772
|
})));
|
|
1524
1773
|
});
|
|
1525
1774
|
describe('modifySdpForIPv4', function () {
|
|
@@ -1589,19 +1838,19 @@ describe('uploadLogs', function () {
|
|
|
1589
1838
|
afterEach(function () {
|
|
1590
1839
|
jest.clearAllMocks();
|
|
1591
1840
|
});
|
|
1592
|
-
it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1841
|
+
it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
1593
1842
|
var mockMetaData, logSpy, result;
|
|
1594
|
-
return _regenerator.default.wrap(function
|
|
1595
|
-
while (1) switch (
|
|
1843
|
+
return _regenerator.default.wrap(function (_context21) {
|
|
1844
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1596
1845
|
case 0:
|
|
1597
1846
|
mockMetaData = {
|
|
1598
1847
|
correlationId: 'test-correlation'
|
|
1599
1848
|
};
|
|
1600
1849
|
logSpy = jest.spyOn(_Logger.default, 'info');
|
|
1601
|
-
|
|
1850
|
+
_context21.next = 1;
|
|
1602
1851
|
return (0, _Utils.uploadLogs)(mockMetaData, true);
|
|
1603
|
-
case
|
|
1604
|
-
result =
|
|
1852
|
+
case 1:
|
|
1853
|
+
result = _context21.sent;
|
|
1605
1854
|
expect(result).toEqual({
|
|
1606
1855
|
trackingid: '1234',
|
|
1607
1856
|
feedbackId: 'mocked-uuid-12345'
|
|
@@ -1632,16 +1881,16 @@ describe('uploadLogs', function () {
|
|
|
1632
1881
|
}), undefined, {
|
|
1633
1882
|
type: 'diff'
|
|
1634
1883
|
});
|
|
1635
|
-
case
|
|
1884
|
+
case 2:
|
|
1636
1885
|
case "end":
|
|
1637
|
-
return
|
|
1886
|
+
return _context21.stop();
|
|
1638
1887
|
}
|
|
1639
|
-
},
|
|
1888
|
+
}, _callee21);
|
|
1640
1889
|
})));
|
|
1641
|
-
it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1642
|
-
var mockMetaData, mockError, logSpy;
|
|
1643
|
-
return _regenerator.default.wrap(function
|
|
1644
|
-
while (1) switch (
|
|
1890
|
+
it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
1891
|
+
var mockMetaData, mockError, logSpy, _t3;
|
|
1892
|
+
return _regenerator.default.wrap(function (_context22) {
|
|
1893
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1645
1894
|
case 0:
|
|
1646
1895
|
mockMetaData = {
|
|
1647
1896
|
correlationId: 'test-correlation'
|
|
@@ -1649,19 +1898,19 @@ describe('uploadLogs', function () {
|
|
|
1649
1898
|
mockError = new Error('Upload failed'); // Mock the submitLogs to fail
|
|
1650
1899
|
submitLogsMock.mockRejectedValueOnce(mockError);
|
|
1651
1900
|
logSpy = jest.spyOn(_Logger.default, 'error');
|
|
1652
|
-
|
|
1653
|
-
|
|
1901
|
+
_context22.prev = 1;
|
|
1902
|
+
_context22.next = 2;
|
|
1654
1903
|
return (0, _Utils.uploadLogs)(mockMetaData, true);
|
|
1655
|
-
case
|
|
1904
|
+
case 2:
|
|
1656
1905
|
// If we get here, the test should fail since we expected an exception
|
|
1657
1906
|
expect(true).toBe(false); // This will fail the test if no exception is thrown
|
|
1658
|
-
|
|
1907
|
+
_context22.next = 4;
|
|
1659
1908
|
break;
|
|
1660
|
-
case
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
expect(
|
|
1664
|
-
expect(logSpy).toHaveBeenCalledWith("Failed to upload Logs ".concat((0, _stringify.default)(
|
|
1909
|
+
case 3:
|
|
1910
|
+
_context22.prev = 3;
|
|
1911
|
+
_t3 = _context22["catch"](1);
|
|
1912
|
+
expect(_t3).toBe(mockError);
|
|
1913
|
+
expect(logSpy).toHaveBeenCalledWith("Failed to upload Logs ".concat((0, _stringify.default)(_t3)), {
|
|
1665
1914
|
file: _constants.UTILS_FILE,
|
|
1666
1915
|
method: 'uploadLogs'
|
|
1667
1916
|
});
|
|
@@ -1675,7 +1924,7 @@ describe('uploadLogs', function () {
|
|
|
1675
1924
|
tracking_id: undefined,
|
|
1676
1925
|
feedback_id: 'mocked-uuid-12345',
|
|
1677
1926
|
call_id: undefined,
|
|
1678
|
-
error: "Failed to upload Logs ".concat((0, _stringify.default)(
|
|
1927
|
+
error: "Failed to upload Logs ".concat((0, _stringify.default)(_t3))
|
|
1679
1928
|
},
|
|
1680
1929
|
tags: {
|
|
1681
1930
|
action: 'upload_logs',
|
|
@@ -1684,16 +1933,16 @@ describe('uploadLogs', function () {
|
|
|
1684
1933
|
},
|
|
1685
1934
|
type: 'behavioral'
|
|
1686
1935
|
});
|
|
1687
|
-
case
|
|
1936
|
+
case 4:
|
|
1688
1937
|
case "end":
|
|
1689
|
-
return
|
|
1938
|
+
return _context22.stop();
|
|
1690
1939
|
}
|
|
1691
|
-
},
|
|
1940
|
+
}, _callee22, null, [[1, 3]]);
|
|
1692
1941
|
})));
|
|
1693
|
-
it('should log error and not throw an error if the upload fails with throw exception false', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1942
|
+
it('should log error and not throw an error if the upload fails with throw exception false', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
1694
1943
|
var mockMetaData, mockError, logSpy, result;
|
|
1695
|
-
return _regenerator.default.wrap(function
|
|
1696
|
-
while (1) switch (
|
|
1944
|
+
return _regenerator.default.wrap(function (_context23) {
|
|
1945
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1697
1946
|
case 0:
|
|
1698
1947
|
mockMetaData = {
|
|
1699
1948
|
correlationId: 'test-correlation',
|
|
@@ -1702,10 +1951,10 @@ describe('uploadLogs', function () {
|
|
|
1702
1951
|
mockError = new Error('Upload failed'); // Mock the submitLogs to fail
|
|
1703
1952
|
submitLogsMock.mockRejectedValueOnce(mockError);
|
|
1704
1953
|
logSpy = jest.spyOn(_Logger.default, 'error');
|
|
1705
|
-
|
|
1954
|
+
_context23.next = 1;
|
|
1706
1955
|
return (0, _Utils.uploadLogs)(mockMetaData, false);
|
|
1707
|
-
case
|
|
1708
|
-
result =
|
|
1956
|
+
case 1:
|
|
1957
|
+
result = _context23.sent;
|
|
1709
1958
|
expect(result).toBeUndefined();
|
|
1710
1959
|
expect(logSpy).toHaveBeenCalledWith("Failed to upload Logs ".concat((0, _stringify.default)(mockError)), {
|
|
1711
1960
|
file: _constants.UTILS_FILE,
|
|
@@ -1730,11 +1979,11 @@ describe('uploadLogs', function () {
|
|
|
1730
1979
|
},
|
|
1731
1980
|
type: 'behavioral'
|
|
1732
1981
|
});
|
|
1733
|
-
case
|
|
1982
|
+
case 2:
|
|
1734
1983
|
case "end":
|
|
1735
|
-
return
|
|
1984
|
+
return _context23.stop();
|
|
1736
1985
|
}
|
|
1737
|
-
},
|
|
1986
|
+
}, _callee23);
|
|
1738
1987
|
})));
|
|
1739
1988
|
});
|
|
1740
1989
|
//# sourceMappingURL=Utils.test.js.map
|