@webex/calling 3.8.1-web-workers-keepalive.2 → 3.9.0-multi-llms.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/dist/CallHistory/CallHistory.js +51 -46
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +146 -147
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallHistory/callHistoryFixtures.js.map +1 -1
- package/dist/CallHistory/constants.js.map +1 -1
- package/dist/CallHistory/types.js.map +1 -1
- package/dist/CallSettings/CallSettings.js +8 -8
- package/dist/CallSettings/CallSettings.js.map +1 -1
- package/dist/CallSettings/CallSettings.test.js +1 -1
- package/dist/CallSettings/CallSettings.test.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.js +12 -11
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +9 -10
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +68 -61
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +168 -102
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/constants.js.map +1 -1
- package/dist/CallSettings/testFixtures.js.map +1 -1
- package/dist/CallSettings/types.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +491 -200
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +501 -294
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/callRecordFixtures.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.js +2 -2
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +8 -7
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/types.js.map +1 -1
- package/dist/CallingClient/calling/call.js +369 -333
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +411 -410
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +3 -4
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +67 -68
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/calling/index.js.map +1 -1
- package/dist/CallingClient/calling/types.js.map +1 -1
- package/dist/CallingClient/callingClientFixtures.js.map +1 -1
- package/dist/CallingClient/constants.js +10 -8
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +10 -11
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +10 -9
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/line/types.js.map +1 -1
- package/dist/CallingClient/registration/index.js.map +1 -1
- package/dist/CallingClient/registration/register.js +321 -232
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +242 -160
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/registerFixtures.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +5 -4
- package/dist/CallingClient/registration/webWorker.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.test.js +14 -14
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
- package/dist/CallingClient/types.js.map +1 -1
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +142 -0
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -0
- package/dist/Contacts/ContactsClient.js +244 -238
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +89 -90
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Contacts/constants.js +2 -2
- package/dist/Contacts/constants.js.map +1 -1
- package/dist/Contacts/contactFixtures.js.map +1 -1
- package/dist/Contacts/types.js.map +1 -1
- package/dist/Errors/catalog/CallError.js +2 -2
- package/dist/Errors/catalog/CallError.js.map +1 -1
- package/dist/Errors/catalog/CallingDeviceError.js +2 -2
- package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
- package/dist/Errors/catalog/ExtendedError.js +3 -3
- package/dist/Errors/catalog/ExtendedError.js.map +1 -1
- package/dist/Errors/catalog/LineError.js +2 -2
- package/dist/Errors/catalog/LineError.js.map +1 -1
- package/dist/Errors/index.js.map +1 -1
- package/dist/Errors/types.js.map +1 -1
- package/dist/Events/impl/index.js +2 -2
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/Events/types.js.map +1 -1
- package/dist/Logger/index.js.map +1 -1
- package/dist/Logger/index.test.js.map +1 -1
- package/dist/Logger/types.js.map +1 -1
- package/dist/Metrics/index.js +166 -84
- package/dist/Metrics/index.js.map +1 -1
- package/dist/Metrics/index.test.js +60 -0
- package/dist/Metrics/index.test.js.map +1 -1
- package/dist/Metrics/types.js +15 -1
- package/dist/Metrics/types.js.map +1 -1
- package/dist/SDKConnector/index.js +0 -1
- package/dist/SDKConnector/index.js.map +1 -1
- package/dist/SDKConnector/index.test.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/SDKConnector/utils.js.map +1 -1
- package/dist/SDKConnector/utils.test.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +42 -39
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +119 -120
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +54 -47
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +73 -74
- package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +12 -11
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/Voicemail.test.js +2 -2
- package/dist/Voicemail/Voicemail.test.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +78 -70
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +184 -185
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/constants.js.map +1 -1
- package/dist/Voicemail/types.js.map +1 -1
- package/dist/Voicemail/voicemailFixture.js.map +1 -1
- package/dist/api.js.map +1 -1
- package/dist/common/Utils.js +97 -72
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +283 -143
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/index.js.map +1 -1
- package/dist/common/testUtil.js +1 -1
- package/dist/common/testUtil.js.map +1 -1
- package/dist/common/types.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +4 -0
- package/dist/module/CallSettings/UcmBackendConnector.js +1 -0
- package/dist/module/CallSettings/WxCallBackendConnector.js +8 -1
- package/dist/module/CallingClient/CallingClient.js +197 -40
- package/dist/module/CallingClient/calling/call.js +79 -43
- package/dist/module/CallingClient/constants.js +9 -6
- package/dist/module/CallingClient/line/index.js +3 -3
- package/dist/module/CallingClient/registration/register.js +50 -14
- package/dist/module/CallingClient/registration/webWorker.js +2 -1
- package/dist/module/CallingClient/windowsChromiumIceWarmupUtils.js +59 -0
- package/dist/module/Contacts/ContactsClient.js +23 -17
- package/dist/module/Contacts/constants.js +1 -1
- package/dist/module/Metrics/index.js +86 -32
- package/dist/module/Metrics/types.js +14 -0
- package/dist/module/Voicemail/BroadworksBackendConnector.js +3 -0
- package/dist/module/Voicemail/UcmBackendConnector.js +6 -0
- package/dist/module/Voicemail/WxCallBackendConnector.js +8 -0
- package/dist/module/common/Utils.js +35 -11
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/CallSettings/types.d.ts +1 -1
- package/dist/types/CallSettings/types.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts +12 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/types.d.ts +2 -1
- package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +9 -6
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +1 -0
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorker.d.ts +2 -1
- package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -1
- package/dist/types/CallingClient/windowsChromiumIceWarmupUtils.d.ts +5 -0
- package/dist/types/CallingClient/windowsChromiumIceWarmupUtils.d.ts.map +1 -0
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/Contacts/constants.d.ts +1 -1
- package/dist/types/Contacts/constants.d.ts.map +1 -1
- package/dist/types/Metrics/index.d.ts.map +1 -1
- package/dist/types/Metrics/types.d.ts +18 -3
- package/dist/types/Metrics/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/Voicemail/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +1 -0
- package/dist/types/common/types.d.ts.map +1 -1
- package/package.json +10 -9
|
@@ -12,6 +12,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/
|
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
13
13
|
var _assign = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/assign"));
|
|
14
14
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
15
|
+
var _uuid = require("uuid");
|
|
15
16
|
var _calling = require("../CallingClient/calling");
|
|
16
17
|
var _Errors = require("../Errors");
|
|
17
18
|
var _testUtil = require("./testUtil");
|
|
@@ -26,6 +27,13 @@ var _types3 = require("../Events/types");
|
|
|
26
27
|
var _SDKConnector = _interopRequireDefault(require("../SDKConnector"));
|
|
27
28
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
29
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } /* eslint-disable no-underscore-dangle */
|
|
30
|
+
// Mock uuid
|
|
31
|
+
jest.mock('uuid', function () {
|
|
32
|
+
return {
|
|
33
|
+
v4: jest.fn()
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
var mockUuid = _uuid.v4;
|
|
29
37
|
var mockSubmitRegistrationMetric = jest.fn();
|
|
30
38
|
var mockEmitterCb = jest.fn();
|
|
31
39
|
var mockRestoreCb = jest.fn();
|
|
@@ -270,6 +278,142 @@ describe('Registration Tests', function () {
|
|
|
270
278
|
expect(logSpy).toHaveBeenCalledWith(codeObj.logMsg, logObj);
|
|
271
279
|
});
|
|
272
280
|
});
|
|
281
|
+
describe('CallingClient Error Tests', function () {
|
|
282
|
+
var logSpy = jest.spyOn(_Logger.default, 'warn');
|
|
283
|
+
var logObj = {
|
|
284
|
+
file: 'CallingClient',
|
|
285
|
+
method: 'handleCallingClientErrors'
|
|
286
|
+
};
|
|
287
|
+
beforeEach(function () {
|
|
288
|
+
jest.clearAllMocks();
|
|
289
|
+
});
|
|
290
|
+
it('verify 401 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
291
|
+
var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
|
|
292
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
293
|
+
while (1) switch (_context.prev = _context.next) {
|
|
294
|
+
case 0:
|
|
295
|
+
statusCode = _types2.ERROR_CODE.UNAUTHORIZED;
|
|
296
|
+
message = 'User is unauthorized due to an expired token.';
|
|
297
|
+
errorType = _types2.ERROR_TYPE.TOKEN_ERROR;
|
|
298
|
+
finalError = true;
|
|
299
|
+
webexPayload = {
|
|
300
|
+
statusCode: statusCode,
|
|
301
|
+
headers: {
|
|
302
|
+
trackingid: 'webex-js-sdk_b5812e58-7246-4a9b-bf64-831bdf13b0cd_31'
|
|
303
|
+
},
|
|
304
|
+
body: {
|
|
305
|
+
device: {
|
|
306
|
+
deviceId: '8a67806f-fc4d-446b-a131-31e71ea5b010'
|
|
307
|
+
},
|
|
308
|
+
userId: '8a67806f-fc4d-446b-a131-31e71ea5b0e9',
|
|
309
|
+
errorCode: 0
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
mockErrorEvent = {
|
|
313
|
+
type: errorType,
|
|
314
|
+
message: message,
|
|
315
|
+
context: logObj
|
|
316
|
+
};
|
|
317
|
+
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
318
|
+
_context.next = 9;
|
|
319
|
+
return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
|
|
320
|
+
case 9:
|
|
321
|
+
result = _context.sent;
|
|
322
|
+
expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
|
|
323
|
+
expect(result).toBe(finalError);
|
|
324
|
+
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
|
|
325
|
+
expect(logSpy).toHaveBeenCalledWith('401 Unauthorized', logObj);
|
|
326
|
+
case 14:
|
|
327
|
+
case "end":
|
|
328
|
+
return _context.stop();
|
|
329
|
+
}
|
|
330
|
+
}, _callee);
|
|
331
|
+
})));
|
|
332
|
+
it('verify 500 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
333
|
+
var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
|
|
334
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
335
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
336
|
+
case 0:
|
|
337
|
+
statusCode = _types2.ERROR_CODE.INTERNAL_SERVER_ERROR;
|
|
338
|
+
message = 'An unknown error occurred while placing the request. Wait a moment and try again.';
|
|
339
|
+
errorType = _types2.ERROR_TYPE.SERVICE_UNAVAILABLE;
|
|
340
|
+
finalError = false;
|
|
341
|
+
webexPayload = {
|
|
342
|
+
statusCode: statusCode,
|
|
343
|
+
headers: {
|
|
344
|
+
trackingid: 'webex-js-sdk_b5812e58-7246-4a9b-bf64-831bdf13b0cd_31'
|
|
345
|
+
},
|
|
346
|
+
body: {
|
|
347
|
+
device: {
|
|
348
|
+
deviceId: '8a67806f-fc4d-446b-a131-31e71ea5b010'
|
|
349
|
+
},
|
|
350
|
+
userId: '8a67806f-fc4d-446b-a131-31e71ea5b0e9',
|
|
351
|
+
errorCode: 0
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
mockErrorEvent = {
|
|
355
|
+
type: errorType,
|
|
356
|
+
message: message,
|
|
357
|
+
context: logObj
|
|
358
|
+
};
|
|
359
|
+
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
360
|
+
_context2.next = 9;
|
|
361
|
+
return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
|
|
362
|
+
case 9:
|
|
363
|
+
result = _context2.sent;
|
|
364
|
+
expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
|
|
365
|
+
expect(result).toBe(finalError);
|
|
366
|
+
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
|
|
367
|
+
expect(logSpy).toHaveBeenCalledWith('500 Internal Server Error', logObj);
|
|
368
|
+
case 14:
|
|
369
|
+
case "end":
|
|
370
|
+
return _context2.stop();
|
|
371
|
+
}
|
|
372
|
+
}, _callee2);
|
|
373
|
+
})));
|
|
374
|
+
it('verify unknown error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
375
|
+
var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
|
|
376
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
377
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
378
|
+
case 0:
|
|
379
|
+
statusCode = 206;
|
|
380
|
+
message = 'Unknown error';
|
|
381
|
+
errorType = _types2.ERROR_TYPE.DEFAULT;
|
|
382
|
+
finalError = false;
|
|
383
|
+
webexPayload = {
|
|
384
|
+
statusCode: statusCode,
|
|
385
|
+
headers: {
|
|
386
|
+
trackingid: 'webex-js-sdk_b5812e58-7246-4a9b-bf64-831bdf13b0cd_31'
|
|
387
|
+
},
|
|
388
|
+
body: {
|
|
389
|
+
device: {
|
|
390
|
+
deviceId: '8a67806f-fc4d-446b-a131-31e71ea5b010'
|
|
391
|
+
},
|
|
392
|
+
userId: '8a67806f-fc4d-446b-a131-31e71ea5b0e9',
|
|
393
|
+
errorCode: 0
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
mockErrorEvent = {
|
|
397
|
+
type: errorType,
|
|
398
|
+
message: message,
|
|
399
|
+
context: logObj
|
|
400
|
+
};
|
|
401
|
+
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
402
|
+
_context3.next = 9;
|
|
403
|
+
return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
|
|
404
|
+
case 9:
|
|
405
|
+
result = _context3.sent;
|
|
406
|
+
expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
|
|
407
|
+
expect(result).toBe(finalError);
|
|
408
|
+
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
|
|
409
|
+
expect(logSpy).toHaveBeenCalledWith('Unknown Error', logObj);
|
|
410
|
+
case 14:
|
|
411
|
+
case "end":
|
|
412
|
+
return _context3.stop();
|
|
413
|
+
}
|
|
414
|
+
}, _callee3);
|
|
415
|
+
})));
|
|
416
|
+
});
|
|
273
417
|
describe('Call Tests', function () {
|
|
274
418
|
/* Error flows tests starts */
|
|
275
419
|
var logSpy = jest.spyOn(_Logger.default, 'warn');
|
|
@@ -815,11 +959,11 @@ describe('resolveContact tests', function () {
|
|
|
815
959
|
}));
|
|
816
960
|
});
|
|
817
961
|
});
|
|
818
|
-
it('Resolve by userExternalId - SCIM exception', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
962
|
+
it('Resolve by userExternalId - SCIM exception', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
819
963
|
var _callingPartyInfo$use2;
|
|
820
964
|
var callingPartyInfo, warnSpy, webexSpy, displayInfo, query;
|
|
821
|
-
return _regenerator.default.wrap(function
|
|
822
|
-
while (1) switch (
|
|
965
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
966
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
823
967
|
case 0:
|
|
824
968
|
callingPartyInfo = {};
|
|
825
969
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
@@ -829,13 +973,13 @@ describe('resolveContact tests', function () {
|
|
|
829
973
|
callingPartyInfo.userExternalId = {
|
|
830
974
|
$: 'userExternalId'
|
|
831
975
|
};
|
|
832
|
-
|
|
976
|
+
_context4.next = 6;
|
|
833
977
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
834
978
|
case 6:
|
|
835
|
-
displayInfo =
|
|
979
|
+
displayInfo = _context4.sent;
|
|
836
980
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
|
|
837
981
|
expect(warnSpy).toHaveBeenCalledWith('Error response: - 500', {
|
|
838
|
-
file:
|
|
982
|
+
file: _constants.UTILS_FILE,
|
|
839
983
|
method: 'resolveCallerIdDisplay'
|
|
840
984
|
});
|
|
841
985
|
query = scimUrl + encodeURIComponent("id eq \"".concat((_callingPartyInfo$use2 = callingPartyInfo.userExternalId) === null || _callingPartyInfo$use2 === void 0 ? void 0 : _callingPartyInfo$use2.$, "\""));
|
|
@@ -844,15 +988,15 @@ describe('resolveContact tests', function () {
|
|
|
844
988
|
}));
|
|
845
989
|
case 11:
|
|
846
990
|
case "end":
|
|
847
|
-
return
|
|
991
|
+
return _context4.stop();
|
|
848
992
|
}
|
|
849
|
-
},
|
|
993
|
+
}, _callee4);
|
|
850
994
|
})));
|
|
851
|
-
it('Resolve by userExternalId - totalResults zero', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
995
|
+
it('Resolve by userExternalId - totalResults zero', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
852
996
|
var _callingPartyInfo$use3;
|
|
853
997
|
var callingPartyInfo, scimResponse, webexSpy, displayInfo, query;
|
|
854
|
-
return _regenerator.default.wrap(function
|
|
855
|
-
while (1) switch (
|
|
998
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
999
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
856
1000
|
case 0:
|
|
857
1001
|
callingPartyInfo = {};
|
|
858
1002
|
scimResponse = (0, _testUtil.getSampleScimResponse)();
|
|
@@ -864,10 +1008,10 @@ describe('resolveContact tests', function () {
|
|
|
864
1008
|
callingPartyInfo.userExternalId = {
|
|
865
1009
|
$: 'userExternalId'
|
|
866
1010
|
};
|
|
867
|
-
|
|
1011
|
+
_context5.next = 7;
|
|
868
1012
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
869
1013
|
case 7:
|
|
870
|
-
displayInfo =
|
|
1014
|
+
displayInfo = _context5.sent;
|
|
871
1015
|
query = scimUrl + encodeURIComponent("id eq \"".concat((_callingPartyInfo$use3 = callingPartyInfo.userExternalId) === null || _callingPartyInfo$use3 === void 0 ? void 0 : _callingPartyInfo$use3.$, "\""));
|
|
872
1016
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
|
|
873
1017
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
@@ -876,15 +1020,15 @@ describe('resolveContact tests', function () {
|
|
|
876
1020
|
scimResponse.totalResults = '1';
|
|
877
1021
|
case 12:
|
|
878
1022
|
case "end":
|
|
879
|
-
return
|
|
1023
|
+
return _context5.stop();
|
|
880
1024
|
}
|
|
881
|
-
},
|
|
1025
|
+
}, _callee5);
|
|
882
1026
|
})));
|
|
883
|
-
it('Resolve by userExternalId - no primary number and no phone numbers', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1027
|
+
it('Resolve by userExternalId - no primary number and no phone numbers', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
884
1028
|
var _callingPartyInfo$use4, _displayInfo, _displayInfo2;
|
|
885
1029
|
var callingPartyInfo, scimResponse, webexSpy, displayInfo, query, phoneNumbers;
|
|
886
|
-
return _regenerator.default.wrap(function
|
|
887
|
-
while (1) switch (
|
|
1030
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
1031
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
888
1032
|
case 0:
|
|
889
1033
|
callingPartyInfo = {};
|
|
890
1034
|
scimResponse = (0, _testUtil.getSampleScimResponse)();
|
|
@@ -896,10 +1040,10 @@ describe('resolveContact tests', function () {
|
|
|
896
1040
|
callingPartyInfo.userExternalId = {
|
|
897
1041
|
$: 'userExternalId'
|
|
898
1042
|
};
|
|
899
|
-
|
|
1043
|
+
_context6.next = 7;
|
|
900
1044
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
901
1045
|
case 7:
|
|
902
|
-
displayInfo =
|
|
1046
|
+
displayInfo = _context6.sent;
|
|
903
1047
|
query = scimUrl + encodeURIComponent("id eq \"".concat((_callingPartyInfo$use4 = callingPartyInfo.userExternalId) === null || _callingPartyInfo$use4 === void 0 ? void 0 : _callingPartyInfo$use4.$, "\""));
|
|
904
1048
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
905
1049
|
uri: query
|
|
@@ -915,10 +1059,10 @@ describe('resolveContact tests', function () {
|
|
|
915
1059
|
statusCode: 200,
|
|
916
1060
|
body: scimResponse
|
|
917
1061
|
});
|
|
918
|
-
|
|
1062
|
+
_context6.next = 18;
|
|
919
1063
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
920
1064
|
case 18:
|
|
921
|
-
displayInfo =
|
|
1065
|
+
displayInfo = _context6.sent;
|
|
922
1066
|
expect((_displayInfo2 = displayInfo) === null || _displayInfo2 === void 0 ? void 0 : _displayInfo2.num).toBeUndefined();
|
|
923
1067
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
924
1068
|
uri: query
|
|
@@ -926,9 +1070,9 @@ describe('resolveContact tests', function () {
|
|
|
926
1070
|
scimResponse.Resources[0].phoneNumbers = phoneNumbers;
|
|
927
1071
|
case 22:
|
|
928
1072
|
case "end":
|
|
929
|
-
return
|
|
1073
|
+
return _context6.stop();
|
|
930
1074
|
}
|
|
931
|
-
},
|
|
1075
|
+
}, _callee6);
|
|
932
1076
|
})));
|
|
933
1077
|
it('Resolve by userExternalId - no photo', function () {
|
|
934
1078
|
var callingPartyInfo = {};
|
|
@@ -993,10 +1137,10 @@ describe('resolveContact tests', function () {
|
|
|
993
1137
|
}));
|
|
994
1138
|
});
|
|
995
1139
|
});
|
|
996
|
-
it('Resolve by name - Empty Info', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1140
|
+
it('Resolve by name - Empty Info', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
997
1141
|
var callingPartyInfo, peopleListResponse, items, webexSpy, displayInfo;
|
|
998
|
-
return _regenerator.default.wrap(function
|
|
999
|
-
while (1) switch (
|
|
1142
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
1143
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
1000
1144
|
case 0:
|
|
1001
1145
|
callingPartyInfo = {};
|
|
1002
1146
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1006,10 +1150,10 @@ describe('resolveContact tests', function () {
|
|
|
1006
1150
|
callingPartyInfo.name = {
|
|
1007
1151
|
$: 'Name'
|
|
1008
1152
|
};
|
|
1009
|
-
|
|
1153
|
+
_context7.next = 8;
|
|
1010
1154
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1011
1155
|
case 8:
|
|
1012
|
-
displayInfo =
|
|
1156
|
+
displayInfo = _context7.sent;
|
|
1013
1157
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
|
|
1014
1158
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1015
1159
|
displayName: 'Name'
|
|
@@ -1017,15 +1161,15 @@ describe('resolveContact tests', function () {
|
|
|
1017
1161
|
peopleListResponse.items = items;
|
|
1018
1162
|
case 12:
|
|
1019
1163
|
case "end":
|
|
1020
|
-
return
|
|
1164
|
+
return _context7.stop();
|
|
1021
1165
|
}
|
|
1022
|
-
},
|
|
1166
|
+
}, _callee7);
|
|
1023
1167
|
})));
|
|
1024
|
-
it('Resolve by name - ID as plain UUID instead of part of URI', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1168
|
+
it('Resolve by name - ID as plain UUID instead of part of URI', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
1025
1169
|
var _displayInfo3, _displayInfo4, _displayInfo5, _displayInfo6, _displayInfo7, _displayInfo8;
|
|
1026
1170
|
var callingPartyInfo, peopleListResponse, id, webexSpy, displayInfo;
|
|
1027
|
-
return _regenerator.default.wrap(function
|
|
1028
|
-
while (1) switch (
|
|
1171
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
1172
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
1029
1173
|
case 0:
|
|
1030
1174
|
callingPartyInfo = {};
|
|
1031
1175
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1036,10 +1180,10 @@ describe('resolveContact tests', function () {
|
|
|
1036
1180
|
callingPartyInfo.name = {
|
|
1037
1181
|
$: 'Name'
|
|
1038
1182
|
};
|
|
1039
|
-
|
|
1183
|
+
_context8.next = 8;
|
|
1040
1184
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1041
1185
|
case 8:
|
|
1042
|
-
displayInfo =
|
|
1186
|
+
displayInfo = _context8.sent;
|
|
1043
1187
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1044
1188
|
displayName: 'Name'
|
|
1045
1189
|
}));
|
|
@@ -1052,10 +1196,10 @@ describe('resolveContact tests', function () {
|
|
|
1052
1196
|
/* Also test empty id */
|
|
1053
1197
|
peopleListResponse.items[0].id = '';
|
|
1054
1198
|
webex.people.list.mockResolvedValueOnce(peopleListResponse);
|
|
1055
|
-
|
|
1199
|
+
_context8.next = 19;
|
|
1056
1200
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1057
1201
|
case 19:
|
|
1058
|
-
displayInfo =
|
|
1202
|
+
displayInfo = _context8.sent;
|
|
1059
1203
|
expect((_displayInfo7 = displayInfo) === null || _displayInfo7 === void 0 ? void 0 : _displayInfo7.id).toStrictEqual('');
|
|
1060
1204
|
expect((_displayInfo8 = displayInfo) === null || _displayInfo8 === void 0 ? void 0 : _displayInfo8.name).toStrictEqual(peopleListResponse.items[0].displayName);
|
|
1061
1205
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
@@ -1064,14 +1208,14 @@ describe('resolveContact tests', function () {
|
|
|
1064
1208
|
peopleListResponse.items[0].id = id;
|
|
1065
1209
|
case 24:
|
|
1066
1210
|
case "end":
|
|
1067
|
-
return
|
|
1211
|
+
return _context8.stop();
|
|
1068
1212
|
}
|
|
1069
|
-
},
|
|
1213
|
+
}, _callee8);
|
|
1070
1214
|
})));
|
|
1071
|
-
it('Resolve by name - Phone numbers no match for type - work', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1215
|
+
it('Resolve by name - Phone numbers no match for type - work', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
1072
1216
|
var callingPartyInfo, peopleListResponse, phoneNumbers, webexSpy, displayInfo;
|
|
1073
|
-
return _regenerator.default.wrap(function
|
|
1074
|
-
while (1) switch (
|
|
1217
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
1218
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
1075
1219
|
case 0:
|
|
1076
1220
|
callingPartyInfo = {};
|
|
1077
1221
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1082,10 +1226,10 @@ describe('resolveContact tests', function () {
|
|
|
1082
1226
|
callingPartyInfo.name = {
|
|
1083
1227
|
$: 'Name'
|
|
1084
1228
|
};
|
|
1085
|
-
|
|
1229
|
+
_context9.next = 9;
|
|
1086
1230
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1087
1231
|
case 9:
|
|
1088
|
-
displayInfo =
|
|
1232
|
+
displayInfo = _context9.sent;
|
|
1089
1233
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toStrictEqual(peopleListResponse.items[0].displayName);
|
|
1090
1234
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.num).toStrictEqual(peopleListResponse.items[0].phoneNumbers[0].value);
|
|
1091
1235
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.avatarSrc).toStrictEqual(peopleListResponse.items[0].avatar);
|
|
@@ -1095,14 +1239,14 @@ describe('resolveContact tests', function () {
|
|
|
1095
1239
|
peopleListResponse.items[0].phoneNumbers = phoneNumbers;
|
|
1096
1240
|
case 15:
|
|
1097
1241
|
case "end":
|
|
1098
|
-
return
|
|
1242
|
+
return _context9.stop();
|
|
1099
1243
|
}
|
|
1100
|
-
},
|
|
1244
|
+
}, _callee9);
|
|
1101
1245
|
})));
|
|
1102
|
-
it('Resolve by name - Phone numbers empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1246
|
+
it('Resolve by name - Phone numbers empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
|
|
1103
1247
|
var callingPartyInfo, peopleListResponse, phoneNumbers, webexSpy, displayInfo;
|
|
1104
|
-
return _regenerator.default.wrap(function
|
|
1105
|
-
while (1) switch (
|
|
1248
|
+
return _regenerator.default.wrap(function _callee0$(_context0) {
|
|
1249
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
1106
1250
|
case 0:
|
|
1107
1251
|
callingPartyInfo = {};
|
|
1108
1252
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1112,10 +1256,10 @@ describe('resolveContact tests', function () {
|
|
|
1112
1256
|
callingPartyInfo.name = {
|
|
1113
1257
|
$: 'Name'
|
|
1114
1258
|
};
|
|
1115
|
-
|
|
1259
|
+
_context0.next = 8;
|
|
1116
1260
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1117
1261
|
case 8:
|
|
1118
|
-
displayInfo =
|
|
1262
|
+
displayInfo = _context0.sent;
|
|
1119
1263
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1120
1264
|
displayName: 'Name'
|
|
1121
1265
|
}));
|
|
@@ -1125,9 +1269,9 @@ describe('resolveContact tests', function () {
|
|
|
1125
1269
|
peopleListResponse.items[0].phoneNumbers = phoneNumbers;
|
|
1126
1270
|
case 14:
|
|
1127
1271
|
case "end":
|
|
1128
|
-
return
|
|
1272
|
+
return _context0.stop();
|
|
1129
1273
|
}
|
|
1130
|
-
},
|
|
1274
|
+
}, _callee0);
|
|
1131
1275
|
})));
|
|
1132
1276
|
});
|
|
1133
1277
|
describe('Store and Fetch voicemail tests', function () {
|
|
@@ -1232,10 +1376,10 @@ describe('Infer id from UUID Tests', function () {
|
|
|
1232
1376
|
/* Tests conversion of UUID to hydra Id */
|
|
1233
1377
|
|
|
1234
1378
|
it('verify encoding of userId to personId', function () {
|
|
1235
|
-
var
|
|
1236
|
-
var hydraId = (0, _Utils.inferIdFromUuid)(
|
|
1379
|
+
var uuidVal = '14533573-f6aa-429d-b4fe-58aa04a2b631';
|
|
1380
|
+
var hydraId = (0, _Utils.inferIdFromUuid)(uuidVal, _types.DecodeType.PEOPLE);
|
|
1237
1381
|
var uuidAgain = Buffer.from(hydraId, 'base64').toString('binary');
|
|
1238
|
-
expect("".concat(_constants2.INFER_ID_CONSTANT, "/").concat(_types.DecodeType.PEOPLE, "/").concat(
|
|
1382
|
+
expect("".concat(_constants2.INFER_ID_CONSTANT, "/").concat(_types.DecodeType.PEOPLE, "/").concat(uuidVal)).toStrictEqual(uuidAgain);
|
|
1239
1383
|
});
|
|
1240
1384
|
it('verify encoding of orgId', function () {
|
|
1241
1385
|
var orgId = '24533573-f6aa-429d-b4fe-58aa04a2b630';
|
|
@@ -1245,40 +1389,40 @@ describe('Infer id from UUID Tests', function () {
|
|
|
1245
1389
|
});
|
|
1246
1390
|
});
|
|
1247
1391
|
describe('Get endpoint by CALLING_BACKEND tests', function () {
|
|
1248
|
-
it('verify invalid calling backend ucm for xsi endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1249
|
-
return _regenerator.default.wrap(function
|
|
1250
|
-
while (1) switch (
|
|
1392
|
+
it('verify invalid calling backend ucm for xsi endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
1393
|
+
return _regenerator.default.wrap(function _callee1$(_context1) {
|
|
1394
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
1251
1395
|
case 0:
|
|
1252
|
-
|
|
1253
|
-
|
|
1396
|
+
_context1.t0 = expect;
|
|
1397
|
+
_context1.next = 3;
|
|
1254
1398
|
return (0, _Utils.getXsiActionEndpoint)(webex, {
|
|
1255
1399
|
file: 'testFile',
|
|
1256
1400
|
method: 'testMethod'
|
|
1257
1401
|
}, _types.CALLING_BACKEND.UCM);
|
|
1258
1402
|
case 3:
|
|
1259
|
-
|
|
1260
|
-
(0,
|
|
1403
|
+
_context1.t1 = _context1.sent;
|
|
1404
|
+
(0, _context1.t0)(_context1.t1).toBeInstanceOf(Error);
|
|
1261
1405
|
case 5:
|
|
1262
1406
|
case "end":
|
|
1263
|
-
return
|
|
1407
|
+
return _context1.stop();
|
|
1264
1408
|
}
|
|
1265
|
-
},
|
|
1409
|
+
}, _callee1);
|
|
1266
1410
|
})));
|
|
1267
|
-
it('verify invalid calling backend wxc for vg endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1268
|
-
return _regenerator.default.wrap(function
|
|
1269
|
-
while (1) switch (
|
|
1411
|
+
it('verify invalid calling backend wxc for vg endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
1412
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1413
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
1270
1414
|
case 0:
|
|
1271
|
-
|
|
1272
|
-
|
|
1415
|
+
_context10.t0 = expect;
|
|
1416
|
+
_context10.next = 3;
|
|
1273
1417
|
return (0, _Utils.getVgActionEndpoint)(webex, _types.CALLING_BACKEND.WXC);
|
|
1274
1418
|
case 3:
|
|
1275
|
-
|
|
1276
|
-
(0,
|
|
1419
|
+
_context10.t1 = _context10.sent;
|
|
1420
|
+
(0, _context10.t0)(_context10.t1).toBeInstanceOf(Error);
|
|
1277
1421
|
case 5:
|
|
1278
1422
|
case "end":
|
|
1279
|
-
return
|
|
1423
|
+
return _context10.stop();
|
|
1280
1424
|
}
|
|
1281
|
-
},
|
|
1425
|
+
}, _callee10);
|
|
1282
1426
|
})));
|
|
1283
1427
|
});
|
|
1284
1428
|
describe('Get XSI Action Endpoint tests', function () {
|
|
@@ -1296,10 +1440,10 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1296
1440
|
file: 'testFile',
|
|
1297
1441
|
method: 'testMethod'
|
|
1298
1442
|
};
|
|
1299
|
-
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1443
|
+
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
1300
1444
|
var mockResponse, xsiEndpoint;
|
|
1301
|
-
return _regenerator.default.wrap(function
|
|
1302
|
-
while (1) switch (
|
|
1445
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1446
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1303
1447
|
case 0:
|
|
1304
1448
|
mockResponse = {
|
|
1305
1449
|
body: {
|
|
@@ -1311,22 +1455,22 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1311
1455
|
}
|
|
1312
1456
|
};
|
|
1313
1457
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1314
|
-
|
|
1458
|
+
_context11.next = 4;
|
|
1315
1459
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1316
1460
|
case 4:
|
|
1317
|
-
xsiEndpoint =
|
|
1461
|
+
xsiEndpoint = _context11.sent;
|
|
1318
1462
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1319
1463
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1320
1464
|
case 7:
|
|
1321
1465
|
case "end":
|
|
1322
|
-
return
|
|
1466
|
+
return _context11.stop();
|
|
1323
1467
|
}
|
|
1324
|
-
},
|
|
1468
|
+
}, _callee11);
|
|
1325
1469
|
})));
|
|
1326
|
-
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1470
|
+
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
1327
1471
|
var mockResponse, xsiEndpoint;
|
|
1328
|
-
return _regenerator.default.wrap(function
|
|
1329
|
-
while (1) switch (
|
|
1472
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
1473
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1330
1474
|
case 0:
|
|
1331
1475
|
mockResponse = {
|
|
1332
1476
|
body: {
|
|
@@ -1338,22 +1482,22 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1338
1482
|
}
|
|
1339
1483
|
};
|
|
1340
1484
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1341
|
-
|
|
1485
|
+
_context12.next = 4;
|
|
1342
1486
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1343
1487
|
case 4:
|
|
1344
|
-
xsiEndpoint =
|
|
1488
|
+
xsiEndpoint = _context12.sent;
|
|
1345
1489
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1346
1490
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1347
1491
|
case 7:
|
|
1348
1492
|
case "end":
|
|
1349
|
-
return
|
|
1493
|
+
return _context12.stop();
|
|
1350
1494
|
}
|
|
1351
|
-
},
|
|
1495
|
+
}, _callee12);
|
|
1352
1496
|
})));
|
|
1353
|
-
it('should return xsiEndpoint for BWRKS backend when URL does not end with any version', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
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 _callee13() {
|
|
1354
1498
|
var mockResponse, xsiEndpoint;
|
|
1355
|
-
return _regenerator.default.wrap(function
|
|
1356
|
-
while (1) switch (
|
|
1499
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1500
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1357
1501
|
case 0:
|
|
1358
1502
|
mockResponse = {
|
|
1359
1503
|
body: {
|
|
@@ -1365,17 +1509,17 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1365
1509
|
}
|
|
1366
1510
|
};
|
|
1367
1511
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1368
|
-
|
|
1512
|
+
_context13.next = 4;
|
|
1369
1513
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1370
1514
|
case 4:
|
|
1371
|
-
xsiEndpoint =
|
|
1515
|
+
xsiEndpoint = _context13.sent;
|
|
1372
1516
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1373
1517
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1374
1518
|
case 7:
|
|
1375
1519
|
case "end":
|
|
1376
|
-
return
|
|
1520
|
+
return _context13.stop();
|
|
1377
1521
|
}
|
|
1378
|
-
},
|
|
1522
|
+
}, _callee13);
|
|
1379
1523
|
})));
|
|
1380
1524
|
});
|
|
1381
1525
|
describe('modifySdpForIPv4', function () {
|
|
@@ -1427,15 +1571,10 @@ describe('modifySdpForIPv4', function () {
|
|
|
1427
1571
|
});
|
|
1428
1572
|
});
|
|
1429
1573
|
describe('uploadLogs', function () {
|
|
1430
|
-
var originalCrypto;
|
|
1431
1574
|
var submitLogsMock;
|
|
1432
1575
|
beforeEach(function () {
|
|
1433
|
-
//
|
|
1434
|
-
|
|
1435
|
-
global.crypto = {
|
|
1436
|
-
randomUUID: jest.fn().mockReturnValue('mocked-uuid-12345')
|
|
1437
|
-
};
|
|
1438
|
-
|
|
1576
|
+
// Mock uuid to return a consistent value
|
|
1577
|
+
mockUuid.mockReturnValue('mocked-uuid-12345');
|
|
1439
1578
|
// Mock the metrics manager submit function directly
|
|
1440
1579
|
mockSubmitRegistrationMetric.mockClear();
|
|
1441
1580
|
|
|
@@ -1448,23 +1587,21 @@ describe('uploadLogs', function () {
|
|
|
1448
1587
|
};
|
|
1449
1588
|
});
|
|
1450
1589
|
afterEach(function () {
|
|
1451
|
-
// Restore original crypto
|
|
1452
|
-
global.crypto = originalCrypto;
|
|
1453
1590
|
jest.clearAllMocks();
|
|
1454
1591
|
});
|
|
1455
|
-
it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1592
|
+
it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
1456
1593
|
var mockMetaData, logSpy, result;
|
|
1457
|
-
return _regenerator.default.wrap(function
|
|
1458
|
-
while (1) switch (
|
|
1594
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
1595
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1459
1596
|
case 0:
|
|
1460
1597
|
mockMetaData = {
|
|
1461
1598
|
correlationId: 'test-correlation'
|
|
1462
1599
|
};
|
|
1463
1600
|
logSpy = jest.spyOn(_Logger.default, 'info');
|
|
1464
|
-
|
|
1601
|
+
_context14.next = 4;
|
|
1465
1602
|
return (0, _Utils.uploadLogs)(mockMetaData, true);
|
|
1466
1603
|
case 4:
|
|
1467
|
-
result =
|
|
1604
|
+
result = _context14.sent;
|
|
1468
1605
|
expect(result).toEqual({
|
|
1469
1606
|
trackingid: '1234',
|
|
1470
1607
|
feedbackId: 'mocked-uuid-12345'
|
|
@@ -1497,14 +1634,14 @@ describe('uploadLogs', function () {
|
|
|
1497
1634
|
});
|
|
1498
1635
|
case 9:
|
|
1499
1636
|
case "end":
|
|
1500
|
-
return
|
|
1637
|
+
return _context14.stop();
|
|
1501
1638
|
}
|
|
1502
|
-
},
|
|
1639
|
+
}, _callee14);
|
|
1503
1640
|
})));
|
|
1504
|
-
it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1641
|
+
it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
1505
1642
|
var mockMetaData, mockError, logSpy;
|
|
1506
|
-
return _regenerator.default.wrap(function
|
|
1507
|
-
while (1) switch (
|
|
1643
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
1644
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1508
1645
|
case 0:
|
|
1509
1646
|
mockMetaData = {
|
|
1510
1647
|
correlationId: 'test-correlation'
|
|
@@ -1512,18 +1649,18 @@ describe('uploadLogs', function () {
|
|
|
1512
1649
|
mockError = new Error('Upload failed'); // Mock the submitLogs to fail
|
|
1513
1650
|
submitLogsMock.mockRejectedValueOnce(mockError);
|
|
1514
1651
|
logSpy = jest.spyOn(_Logger.default, 'error');
|
|
1515
|
-
|
|
1516
|
-
|
|
1652
|
+
_context15.prev = 4;
|
|
1653
|
+
_context15.next = 7;
|
|
1517
1654
|
return (0, _Utils.uploadLogs)(mockMetaData, true);
|
|
1518
1655
|
case 7:
|
|
1519
1656
|
// If we get here, the test should fail since we expected an exception
|
|
1520
1657
|
expect(true).toBe(false); // This will fail the test if no exception is thrown
|
|
1521
|
-
|
|
1658
|
+
_context15.next = 15;
|
|
1522
1659
|
break;
|
|
1523
1660
|
case 10:
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
expect(
|
|
1661
|
+
_context15.prev = 10;
|
|
1662
|
+
_context15.t0 = _context15["catch"](4);
|
|
1663
|
+
expect(_context15.t0).toBe(mockError);
|
|
1527
1664
|
expect(logSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
1528
1665
|
message: expect.stringContaining('Failed to upload Logs')
|
|
1529
1666
|
}), {
|
|
@@ -1532,14 +1669,15 @@ describe('uploadLogs', function () {
|
|
|
1532
1669
|
});
|
|
1533
1670
|
expect(mockSubmitRegistrationMetric).toHaveBeenCalledWith('web-calling-sdk-upload-logs-failed', {
|
|
1534
1671
|
fields: {
|
|
1535
|
-
call_id: undefined,
|
|
1536
|
-
calling_sdk_version: 'unknown',
|
|
1537
|
-
correlation_id: 'Failed to upload Logs Error: Upload failed',
|
|
1538
1672
|
device_url: undefined,
|
|
1539
|
-
error: undefined,
|
|
1540
|
-
feedback_id: 'test-correlation',
|
|
1541
1673
|
mobius_url: undefined,
|
|
1542
|
-
|
|
1674
|
+
calling_sdk_version: 'unknown',
|
|
1675
|
+
correlation_id: 'test-correlation',
|
|
1676
|
+
broadworksCorrelationInfo: undefined,
|
|
1677
|
+
tracking_id: undefined,
|
|
1678
|
+
feedback_id: 'mocked-uuid-12345',
|
|
1679
|
+
call_id: undefined,
|
|
1680
|
+
error: 'Failed to upload Logs Error: Upload failed'
|
|
1543
1681
|
},
|
|
1544
1682
|
tags: {
|
|
1545
1683
|
action: 'upload_logs',
|
|
@@ -1550,25 +1688,26 @@ describe('uploadLogs', function () {
|
|
|
1550
1688
|
});
|
|
1551
1689
|
case 15:
|
|
1552
1690
|
case "end":
|
|
1553
|
-
return
|
|
1691
|
+
return _context15.stop();
|
|
1554
1692
|
}
|
|
1555
|
-
},
|
|
1693
|
+
}, _callee15, null, [[4, 10]]);
|
|
1556
1694
|
})));
|
|
1557
|
-
it('should log error and not throw an error if the upload fails with throw exception false', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1695
|
+
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 _callee16() {
|
|
1558
1696
|
var mockMetaData, mockError, logSpy, result;
|
|
1559
|
-
return _regenerator.default.wrap(function
|
|
1560
|
-
while (1) switch (
|
|
1697
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
1698
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1561
1699
|
case 0:
|
|
1562
1700
|
mockMetaData = {
|
|
1563
|
-
correlationId: 'test-correlation'
|
|
1701
|
+
correlationId: 'test-correlation',
|
|
1702
|
+
broadworksCorrelationInfo: 'test-broadworks-correlation'
|
|
1564
1703
|
};
|
|
1565
1704
|
mockError = new Error('Upload failed'); // Mock the submitLogs to fail
|
|
1566
1705
|
submitLogsMock.mockRejectedValueOnce(mockError);
|
|
1567
1706
|
logSpy = jest.spyOn(_Logger.default, 'error');
|
|
1568
|
-
|
|
1707
|
+
_context16.next = 6;
|
|
1569
1708
|
return (0, _Utils.uploadLogs)(mockMetaData, false);
|
|
1570
1709
|
case 6:
|
|
1571
|
-
result =
|
|
1710
|
+
result = _context16.sent;
|
|
1572
1711
|
expect(result).toBeUndefined();
|
|
1573
1712
|
expect(logSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
1574
1713
|
message: expect.stringContaining('Failed to upload Logs')
|
|
@@ -1578,14 +1717,15 @@ describe('uploadLogs', function () {
|
|
|
1578
1717
|
});
|
|
1579
1718
|
expect(mockSubmitRegistrationMetric).toHaveBeenCalledWith('web-calling-sdk-upload-logs-failed', {
|
|
1580
1719
|
fields: {
|
|
1581
|
-
call_id: undefined,
|
|
1582
|
-
calling_sdk_version: 'unknown',
|
|
1583
|
-
correlation_id: 'Failed to upload Logs Error: Upload failed',
|
|
1584
1720
|
device_url: undefined,
|
|
1585
|
-
error: undefined,
|
|
1586
|
-
feedback_id: 'test-correlation',
|
|
1587
1721
|
mobius_url: undefined,
|
|
1588
|
-
|
|
1722
|
+
calling_sdk_version: 'unknown',
|
|
1723
|
+
correlation_id: 'test-correlation',
|
|
1724
|
+
broadworksCorrelationInfo: 'test-broadworks-correlation',
|
|
1725
|
+
tracking_id: undefined,
|
|
1726
|
+
feedback_id: 'mocked-uuid-12345',
|
|
1727
|
+
call_id: undefined,
|
|
1728
|
+
error: 'Failed to upload Logs Error: Upload failed'
|
|
1589
1729
|
},
|
|
1590
1730
|
tags: {
|
|
1591
1731
|
action: 'upload_logs',
|
|
@@ -1596,9 +1736,9 @@ describe('uploadLogs', function () {
|
|
|
1596
1736
|
});
|
|
1597
1737
|
case 10:
|
|
1598
1738
|
case "end":
|
|
1599
|
-
return
|
|
1739
|
+
return _context16.stop();
|
|
1600
1740
|
}
|
|
1601
|
-
},
|
|
1741
|
+
}, _callee16);
|
|
1602
1742
|
})));
|
|
1603
1743
|
});
|
|
1604
1744
|
//# sourceMappingURL=Utils.test.js.map
|