@webex/calling 3.12.0-next.9 → 3.12.0-next.90
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/CallRecording/CallRecording.js +160 -0
- package/dist/CallRecording/CallRecording.js.map +1 -0
- package/dist/CallRecording/CallRecording.test.js +257 -0
- package/dist/CallRecording/CallRecording.test.js.map +1 -0
- package/dist/CallRecording/WxcCallRecordingConnector.js +577 -0
- package/dist/CallRecording/WxcCallRecordingConnector.js.map +1 -0
- package/dist/CallRecording/WxcCallRecordingConnector.test.js +652 -0
- package/dist/CallRecording/WxcCallRecordingConnector.test.js.map +1 -0
- package/dist/CallRecording/callRecordingFixtures.js +235 -0
- package/dist/CallRecording/callRecordingFixtures.js.map +1 -0
- package/dist/CallRecording/constants.js +50 -0
- package/dist/CallRecording/constants.js.map +1 -0
- package/dist/CallRecording/types.js +137 -0
- package/dist/CallRecording/types.js.map +1 -0
- package/dist/CallRecording/utils.js +42 -0
- package/dist/CallRecording/utils.js.map +1 -0
- package/dist/CallRecording/utils.test.js +97 -0
- package/dist/CallRecording/utils.test.js.map +1 -0
- package/dist/CallingClient/CallingClient.js +456 -226
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +513 -154
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +634 -454
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +809 -451
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +106 -35
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +140 -0
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/calling/types.js +5 -0
- package/dist/CallingClient/calling/types.js.map +1 -1
- package/dist/CallingClient/constants.js +32 -3
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +8 -1
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +62 -10
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +890 -497
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +649 -58
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js +26 -0
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +41 -104
- package/dist/CallingClient/registration/webWorker.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.test.js +39 -153
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
- package/dist/CallingClient/types.js +7 -0
- package/dist/CallingClient/types.js.map +1 -1
- package/dist/CallingClient/utils/constants.js +58 -0
- package/dist/CallingClient/utils/constants.js.map +1 -0
- package/dist/CallingClient/utils/index.js +63 -0
- package/dist/CallingClient/utils/index.js.map +1 -0
- package/dist/CallingClient/utils/mobiusSocketMapper.js +122 -0
- package/dist/CallingClient/utils/mobiusSocketMapper.js.map +1 -0
- package/dist/CallingClient/utils/mobiusSocketMapper.test.js +221 -0
- package/dist/CallingClient/utils/mobiusSocketMapper.test.js.map +1 -0
- package/dist/CallingClient/utils/request.js +435 -0
- package/dist/CallingClient/utils/request.js.map +1 -0
- package/dist/CallingClient/utils/request.test.js +999 -0
- package/dist/CallingClient/utils/request.test.js.map +1 -0
- package/dist/CallingClient/utils/types.js +7 -0
- package/dist/CallingClient/utils/types.js.map +1 -0
- package/dist/CallingClient/utils/wsFeatureFlag.js +70 -0
- package/dist/CallingClient/utils/wsFeatureFlag.js.map +1 -0
- package/dist/CallingClient/utils/wsFeatureFlag.test.js +139 -0
- package/dist/CallingClient/utils/wsFeatureFlag.test.js.map +1 -0
- package/dist/Contacts/ContactsClient.js +13 -11
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +3 -8
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Errors/types.js +2 -0
- package/dist/Errors/types.js.map +1 -1
- package/dist/Events/types.js +38 -1
- package/dist/Events/types.js.map +1 -1
- package/dist/Metrics/index.js +63 -2
- package/dist/Metrics/index.js.map +1 -1
- package/dist/Metrics/index.test.js +357 -1
- package/dist/Metrics/index.test.js.map +1 -1
- package/dist/Metrics/types.js +19 -1
- package/dist/Metrics/types.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/api.js +56 -0
- package/dist/api.js.map +1 -1
- package/dist/common/Utils.js +212 -71
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +417 -181
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/testUtil.js +10 -5
- package/dist/common/testUtil.js.map +1 -1
- package/dist/common/types.js +3 -0
- package/dist/common/types.js.map +1 -1
- package/dist/index.js +171 -40
- package/dist/index.js.map +1 -1
- package/dist/mobius-socket/config.js +24 -0
- package/dist/mobius-socket/config.js.map +1 -0
- package/dist/mobius-socket/errors.js +143 -0
- package/dist/mobius-socket/errors.js.map +1 -0
- package/dist/mobius-socket/errors.test.js +20 -0
- package/dist/mobius-socket/errors.test.js.map +1 -0
- package/dist/mobius-socket/index.js +57 -0
- package/dist/mobius-socket/index.js.map +1 -0
- package/dist/mobius-socket/mobius-socket-events.test.js +492 -0
- package/dist/mobius-socket/mobius-socket-events.test.js.map +1 -0
- package/dist/mobius-socket/mobius-socket.js +849 -0
- package/dist/mobius-socket/mobius-socket.js.map +1 -0
- package/dist/mobius-socket/mobius-socket.test.js +1898 -0
- package/dist/mobius-socket/mobius-socket.test.js.map +1 -0
- package/dist/mobius-socket/socket/constants.js +55 -0
- package/dist/mobius-socket/socket/constants.js.map +1 -0
- package/dist/mobius-socket/socket/index.js +15 -0
- package/dist/mobius-socket/socket/index.js.map +1 -0
- package/dist/mobius-socket/socket/socket-base.js +604 -0
- package/dist/mobius-socket/socket/socket-base.js.map +1 -0
- package/dist/mobius-socket/socket/socket.js +19 -0
- package/dist/mobius-socket/socket/socket.js.map +1 -0
- package/dist/mobius-socket/socket/socket.shim.js +26 -0
- package/dist/mobius-socket/socket/socket.shim.js.map +1 -0
- package/dist/mobius-socket/socket/types.js +7 -0
- package/dist/mobius-socket/socket/types.js.map +1 -0
- package/dist/mobius-socket/socket.test.js +727 -0
- package/dist/mobius-socket/socket.test.js.map +1 -0
- package/dist/mobius-socket/test/mocha-helpers.js +23 -0
- package/dist/mobius-socket/test/mocha-helpers.js.map +1 -0
- package/dist/mobius-socket/test/promise-tick.js +28 -0
- package/dist/mobius-socket/test/promise-tick.js.map +1 -0
- package/dist/mobius-socket/types.js +7 -0
- package/dist/mobius-socket/types.js.map +1 -0
- package/dist/module/CallRecording/CallRecording.js +56 -0
- package/dist/module/CallRecording/WxcCallRecordingConnector.js +257 -0
- package/dist/module/CallRecording/callRecordingFixtures.js +201 -0
- package/dist/module/CallRecording/constants.js +28 -0
- package/dist/module/CallRecording/types.js +19 -0
- package/dist/module/CallRecording/utils.js +14 -0
- package/dist/module/CallingClient/CallingClient.js +126 -10
- package/dist/module/CallingClient/calling/call.js +198 -66
- package/dist/module/CallingClient/calling/callManager.js +51 -11
- package/dist/module/CallingClient/calling/types.js +2 -0
- package/dist/module/CallingClient/constants.js +27 -0
- package/dist/module/CallingClient/line/index.js +4 -2
- package/dist/module/CallingClient/registration/register.js +266 -64
- package/dist/module/CallingClient/registration/types.js +5 -1
- package/dist/module/CallingClient/registration/webWorker.js +42 -61
- package/dist/module/CallingClient/registration/webWorkerStr.js +47 -82
- package/dist/module/CallingClient/utils/constants.js +36 -0
- package/dist/module/CallingClient/utils/index.js +5 -0
- package/dist/module/CallingClient/utils/mobiusSocketMapper.js +72 -0
- package/dist/module/CallingClient/utils/request.js +211 -0
- package/dist/module/CallingClient/utils/types.js +1 -0
- package/dist/module/CallingClient/utils/wsFeatureFlag.js +41 -0
- package/dist/module/Contacts/ContactsClient.js +1 -1
- package/dist/module/Errors/types.js +2 -0
- package/dist/module/Events/types.js +23 -0
- package/dist/module/Metrics/index.js +48 -1
- package/dist/module/Metrics/types.js +18 -0
- package/dist/module/api.js +3 -2
- package/dist/module/common/Utils.js +85 -22
- package/dist/module/common/testUtil.js +6 -1
- package/dist/module/common/types.js +3 -0
- package/dist/module/index.js +7 -3
- package/dist/module/mobius-socket/config.js +15 -0
- package/dist/module/mobius-socket/errors.js +58 -0
- package/dist/module/mobius-socket/index.js +24 -0
- package/dist/module/mobius-socket/mobius-socket.js +593 -0
- package/dist/module/mobius-socket/socket/constants.js +26 -0
- package/dist/module/mobius-socket/socket/index.js +4 -0
- package/dist/module/mobius-socket/socket/socket-base.js +368 -0
- package/dist/module/mobius-socket/socket/socket.js +9 -0
- package/dist/module/mobius-socket/socket/socket.shim.js +12 -0
- package/dist/module/mobius-socket/socket/types.js +1 -0
- package/dist/module/mobius-socket/types.js +1 -0
- package/dist/types/CallRecording/CallRecording.d.ts +18 -0
- package/dist/types/CallRecording/CallRecording.d.ts.map +1 -0
- package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts +23 -0
- package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts.map +1 -0
- package/dist/types/CallRecording/callRecordingFixtures.d.ts +61 -0
- package/dist/types/CallRecording/callRecordingFixtures.d.ts.map +1 -0
- package/dist/types/CallRecording/constants.d.ts +29 -0
- package/dist/types/CallRecording/constants.d.ts.map +1 -0
- package/dist/types/CallRecording/types.d.ts +176 -0
- package/dist/types/CallRecording/types.d.ts.map +1 -0
- package/dist/types/CallRecording/utils.d.ts +3 -0
- package/dist/types/CallRecording/utils.d.ts.map +1 -0
- package/dist/types/CallingClient/CallingClient.d.ts +8 -0
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +17 -3
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/callManager.d.ts +8 -4
- package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/types.d.ts +38 -9
- package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +27 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts +1 -1
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +8 -1
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +27 -2
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts +1 -1
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -1
- package/dist/types/CallingClient/types.d.ts +4 -2
- package/dist/types/CallingClient/types.d.ts.map +1 -1
- package/dist/types/CallingClient/utils/constants.d.ts +35 -0
- package/dist/types/CallingClient/utils/constants.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/index.d.ts +6 -0
- package/dist/types/CallingClient/utils/index.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts +5 -0
- package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/request.d.ts +28 -0
- package/dist/types/CallingClient/utils/request.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/types.d.ts +34 -0
- package/dist/types/CallingClient/utils/types.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts +4 -0
- package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts.map +1 -0
- package/dist/types/Errors/types.d.ts +2 -0
- package/dist/types/Errors/types.d.ts.map +1 -1
- package/dist/types/Events/types.d.ts +80 -6
- package/dist/types/Events/types.d.ts.map +1 -1
- package/dist/types/Metrics/index.d.ts.map +1 -1
- package/dist/types/Metrics/types.d.ts +19 -2
- package/dist/types/Metrics/types.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +39 -12
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/api.d.ts +6 -4
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +9 -4
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +5 -1
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +5 -1
- package/dist/types/common/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +9 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/mobius-socket/config.d.ts +17 -0
- package/dist/types/mobius-socket/config.d.ts.map +1 -0
- package/dist/types/mobius-socket/errors.d.ts +32 -0
- package/dist/types/mobius-socket/errors.d.ts.map +1 -0
- package/dist/types/mobius-socket/index.d.ts +14 -0
- package/dist/types/mobius-socket/index.d.ts.map +1 -0
- package/dist/types/mobius-socket/mobius-socket.d.ts +48 -0
- package/dist/types/mobius-socket/mobius-socket.d.ts.map +1 -0
- package/dist/types/mobius-socket/socket/constants.d.ts +27 -0
- package/dist/types/mobius-socket/socket/constants.d.ts.map +1 -0
- package/dist/types/mobius-socket/socket/index.d.ts +5 -0
- package/dist/types/mobius-socket/socket/index.d.ts.map +1 -0
- package/dist/types/mobius-socket/socket/socket-base.d.ts +43 -0
- package/dist/types/mobius-socket/socket/socket-base.d.ts.map +1 -0
- package/dist/types/mobius-socket/socket/socket.d.ts +6 -0
- package/dist/types/mobius-socket/socket/socket.d.ts.map +1 -0
- package/dist/types/mobius-socket/socket/socket.shim.d.ts +6 -0
- package/dist/types/mobius-socket/socket/socket.shim.d.ts.map +1 -0
- package/dist/types/mobius-socket/socket/types.d.ts +61 -0
- package/dist/types/mobius-socket/socket/types.d.ts.map +1 -0
- package/dist/types/mobius-socket/types.d.ts +21 -0
- package/dist/types/mobius-socket/types.d.ts.map +1 -0
- package/package.json +21 -5
- package/src/mobius-socket/socket/socket.shim.ts +22 -0
- package/src/mobius-socket/socket/socket.ts +14 -0
|
@@ -23,6 +23,7 @@ var _types2 = require("../Errors/types");
|
|
|
23
23
|
var _Utils = require("./Utils");
|
|
24
24
|
var _voicemailFixture = require("../Voicemail/voicemailFixture");
|
|
25
25
|
var _constants2 = require("./constants");
|
|
26
|
+
var _testFixtures = require("../CallSettings/testFixtures");
|
|
26
27
|
var _types3 = require("../Events/types");
|
|
27
28
|
var _SDKConnector = _interopRequireDefault(require("../SDKConnector"));
|
|
28
29
|
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; }
|
|
@@ -38,6 +39,7 @@ var mockSubmitRegistrationMetric = jest.fn();
|
|
|
38
39
|
var mockEmitterCb = jest.fn();
|
|
39
40
|
var mockRestoreCb = jest.fn();
|
|
40
41
|
var mock429RetryCb = jest.fn();
|
|
42
|
+
var mockSessionSupersededCb = jest.fn();
|
|
41
43
|
var webex = (0, _testUtil.getTestUtilsWebex)();
|
|
42
44
|
_SDKConnector.default.setWebex(webex);
|
|
43
45
|
webex.internal.metrics.submitClientMetrics = mockSubmitRegistrationMetric;
|
|
@@ -452,6 +454,19 @@ describe('Registration Tests', function () {
|
|
|
452
454
|
restoreCbExpected: false,
|
|
453
455
|
retry429CbExpected: false,
|
|
454
456
|
logMsg: '400 Bad Request'
|
|
457
|
+
}, {
|
|
458
|
+
name: 'verify 409 error response',
|
|
459
|
+
statusCode: _types2.ERROR_CODE.CONFLICT,
|
|
460
|
+
deviceErrorCode: 0,
|
|
461
|
+
message: _constants.SESSION_SUPERSEDED_MESSAGE,
|
|
462
|
+
errorType: _types2.ERROR_TYPE.SESSION_SUPERSEDED,
|
|
463
|
+
emitterCbExpected: false,
|
|
464
|
+
finalError: true,
|
|
465
|
+
restoreCbExpected: false,
|
|
466
|
+
retry429CbExpected: false,
|
|
467
|
+
sessionSupersededCbExpected: true,
|
|
468
|
+
handledByCallback: true,
|
|
469
|
+
logMsg: '409 Conflict: session superseded by another device for this user'
|
|
455
470
|
}, {
|
|
456
471
|
name: 'verify unknown error response',
|
|
457
472
|
statusCode: 206,
|
|
@@ -477,55 +492,116 @@ describe('Registration Tests', function () {
|
|
|
477
492
|
};
|
|
478
493
|
|
|
479
494
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
480
|
-
it.each(errorCodes)('%s', function (
|
|
481
|
-
var
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
495
|
+
it.each(errorCodes)('%s', /*#__PURE__*/function () {
|
|
496
|
+
var _ref8 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8(codeObj) {
|
|
497
|
+
var webexPayload, mockErrorEvent, callClientError, result;
|
|
498
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
499
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
500
|
+
case 0:
|
|
501
|
+
webexPayload = {
|
|
502
|
+
statusCode: codeObj.statusCode,
|
|
503
|
+
headers: _objectSpread({
|
|
504
|
+
trackingid: 'webex-js-sdk_b5812e58-7246-4a9b-bf64-831bdf13b0cd_31'
|
|
505
|
+
}, codeObj.retryAfter && {
|
|
506
|
+
'retry-after': codeObj.retryAfter.toString()
|
|
507
|
+
}),
|
|
508
|
+
body: {
|
|
509
|
+
device: {
|
|
510
|
+
deviceId: '8a67806f-fc4d-446b-a131-31e71ea5b010'
|
|
511
|
+
},
|
|
512
|
+
userId: '8a67806f-fc4d-446b-a131-31e71ea5b0e9',
|
|
513
|
+
errorCode: codeObj.deviceErrorCode,
|
|
514
|
+
devices: [{
|
|
515
|
+
deviceId: '8a67806f-fc4d-446b-a131-31e71ea5b010',
|
|
516
|
+
uri: 'https://mobius.webex.com/api/v1/calling/web/',
|
|
517
|
+
status: 'active',
|
|
518
|
+
lastSeen: '2022-04-07T18:00:40Z',
|
|
519
|
+
addresses: ['sip:sipAddress@webex.com']
|
|
520
|
+
}]
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
if (codeObj.customBodyPresent) {
|
|
524
|
+
webexPayload.body = codeObj.body;
|
|
525
|
+
}
|
|
526
|
+
mockErrorEvent = {
|
|
527
|
+
type: codeObj.errorType,
|
|
528
|
+
message: codeObj.message,
|
|
529
|
+
context: logObj
|
|
530
|
+
};
|
|
531
|
+
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
532
|
+
_context8.next = 1;
|
|
533
|
+
return (0, _Utils.handleRegistrationErrors)(webexPayload, mockEmitterCb, logObj, {
|
|
534
|
+
retry429Cb: mock429RetryCb,
|
|
535
|
+
restoreRegCb: mockRestoreCb,
|
|
536
|
+
sessionSupersededCb: mockSessionSupersededCb
|
|
537
|
+
});
|
|
538
|
+
case 1:
|
|
539
|
+
result = _context8.sent;
|
|
540
|
+
expect(result.finalError).toBe(codeObj.finalError);
|
|
541
|
+
expect(result.handledByCallback).toBe(!!codeObj.handledByCallback);
|
|
542
|
+
if (codeObj.emitterCbExpected) {
|
|
543
|
+
expect(mockEmitterCb).toBeCalledOnceWith(callClientError, codeObj.finalError);
|
|
544
|
+
} else {
|
|
545
|
+
expect(mockEmitterCb).not.toHaveBeenCalled();
|
|
546
|
+
}
|
|
547
|
+
if (codeObj.restoreCbExpected) {
|
|
548
|
+
expect(mockRestoreCb).toBeCalledOnceWith(webexPayload.body, logObj.method);
|
|
549
|
+
} else {
|
|
550
|
+
expect(mockRestoreCb).not.toHaveBeenCalled();
|
|
551
|
+
}
|
|
552
|
+
if (codeObj.retry429CbExpected) {
|
|
553
|
+
expect(mock429RetryCb).toBeCalledOnceWith(codeObj.retryAfter, logObj.method);
|
|
554
|
+
} else {
|
|
555
|
+
expect(mock429RetryCb).not.toHaveBeenCalled();
|
|
556
|
+
}
|
|
557
|
+
if (codeObj.sessionSupersededCbExpected) {
|
|
558
|
+
expect(mockSessionSupersededCb).toBeCalledOnceWith(callClientError);
|
|
559
|
+
} else {
|
|
560
|
+
expect(mockSessionSupersededCb).not.toHaveBeenCalled();
|
|
561
|
+
}
|
|
562
|
+
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(codeObj.statusCode), logObj);
|
|
563
|
+
expect(logSpy).toHaveBeenCalledWith(codeObj.logMsg, logObj);
|
|
564
|
+
case 2:
|
|
565
|
+
case "end":
|
|
566
|
+
return _context8.stop();
|
|
567
|
+
}
|
|
568
|
+
}, _callee8);
|
|
569
|
+
}));
|
|
570
|
+
return function (_x) {
|
|
571
|
+
return _ref8.apply(this, arguments);
|
|
510
572
|
};
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
573
|
+
}());
|
|
574
|
+
it('verify 409 response for a caller that does not handle a superseded session', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
575
|
+
var webexPayload, result;
|
|
576
|
+
return _regenerator.default.wrap(function (_context9) {
|
|
577
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
578
|
+
case 0:
|
|
579
|
+
webexPayload = {
|
|
580
|
+
statusCode: _types2.ERROR_CODE.CONFLICT,
|
|
581
|
+
headers: {
|
|
582
|
+
trackingid: 'webex-js-sdk_b5812e58-7246-4a9b-bf64-831bdf13b0cd_31'
|
|
583
|
+
}
|
|
584
|
+
};
|
|
585
|
+
_context9.next = 1;
|
|
586
|
+
return (0, _Utils.handleRegistrationErrors)(webexPayload, mockEmitterCb, logObj, {
|
|
587
|
+
retry429Cb: mock429RetryCb,
|
|
588
|
+
restoreRegCb: mockRestoreCb
|
|
589
|
+
});
|
|
590
|
+
case 1:
|
|
591
|
+
result = _context9.sent;
|
|
592
|
+
expect(result).toStrictEqual({
|
|
593
|
+
finalError: false,
|
|
594
|
+
shouldDisconnect: false,
|
|
595
|
+
handledByCallback: false
|
|
596
|
+
});
|
|
597
|
+
expect(mockEmitterCb).toBeCalledOnceWith(new _Errors.CallingClientError('Unknown error', logObj, _types2.ERROR_TYPE.DEFAULT, _types.RegistrationStatus.ACTIVE), false);
|
|
598
|
+
expect(logSpy).toHaveBeenCalledWith('Unknown Error', logObj);
|
|
599
|
+
case 2:
|
|
600
|
+
case "end":
|
|
601
|
+
return _context9.stop();
|
|
602
|
+
}
|
|
603
|
+
}, _callee9);
|
|
604
|
+
})));
|
|
529
605
|
});
|
|
530
606
|
describe('CallingClient Error Tests', function () {
|
|
531
607
|
var logSpy = jest.spyOn(_Logger.default, 'warn');
|
|
@@ -536,10 +612,10 @@ describe('CallingClient Error Tests', function () {
|
|
|
536
612
|
beforeEach(function () {
|
|
537
613
|
jest.clearAllMocks();
|
|
538
614
|
});
|
|
539
|
-
it('verify 401 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
615
|
+
it('verify 401 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
|
|
540
616
|
var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
|
|
541
|
-
return _regenerator.default.wrap(function (
|
|
542
|
-
while (1) switch (
|
|
617
|
+
return _regenerator.default.wrap(function (_context0) {
|
|
618
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
543
619
|
case 0:
|
|
544
620
|
statusCode = _types2.ERROR_CODE.UNAUTHORIZED;
|
|
545
621
|
message = 'User is unauthorized due to an expired token.';
|
|
@@ -564,24 +640,24 @@ describe('CallingClient Error Tests', function () {
|
|
|
564
640
|
context: logObj
|
|
565
641
|
};
|
|
566
642
|
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
567
|
-
|
|
643
|
+
_context0.next = 1;
|
|
568
644
|
return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
|
|
569
645
|
case 1:
|
|
570
|
-
result =
|
|
646
|
+
result = _context0.sent;
|
|
571
647
|
expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
|
|
572
648
|
expect(result).toBe(finalError);
|
|
573
649
|
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
|
|
574
650
|
expect(logSpy).toHaveBeenCalledWith('401 Unauthorized', logObj);
|
|
575
651
|
case 2:
|
|
576
652
|
case "end":
|
|
577
|
-
return
|
|
653
|
+
return _context0.stop();
|
|
578
654
|
}
|
|
579
|
-
},
|
|
655
|
+
}, _callee0);
|
|
580
656
|
})));
|
|
581
|
-
it('verify 500 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
657
|
+
it('verify 500 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
582
658
|
var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
|
|
583
|
-
return _regenerator.default.wrap(function (
|
|
584
|
-
while (1) switch (
|
|
659
|
+
return _regenerator.default.wrap(function (_context1) {
|
|
660
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
585
661
|
case 0:
|
|
586
662
|
statusCode = _types2.ERROR_CODE.INTERNAL_SERVER_ERROR;
|
|
587
663
|
message = 'An unknown error occurred while placing the request. Wait a moment and try again.';
|
|
@@ -606,24 +682,24 @@ describe('CallingClient Error Tests', function () {
|
|
|
606
682
|
context: logObj
|
|
607
683
|
};
|
|
608
684
|
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
609
|
-
|
|
685
|
+
_context1.next = 1;
|
|
610
686
|
return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
|
|
611
687
|
case 1:
|
|
612
|
-
result =
|
|
688
|
+
result = _context1.sent;
|
|
613
689
|
expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
|
|
614
690
|
expect(result).toBe(finalError);
|
|
615
691
|
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
|
|
616
692
|
expect(logSpy).toHaveBeenCalledWith('500 Internal Server Error', logObj);
|
|
617
693
|
case 2:
|
|
618
694
|
case "end":
|
|
619
|
-
return
|
|
695
|
+
return _context1.stop();
|
|
620
696
|
}
|
|
621
|
-
},
|
|
697
|
+
}, _callee1);
|
|
622
698
|
})));
|
|
623
|
-
it('verify unknown error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
699
|
+
it('verify unknown error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
624
700
|
var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
|
|
625
|
-
return _regenerator.default.wrap(function (
|
|
626
|
-
while (1) switch (
|
|
701
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
702
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
627
703
|
case 0:
|
|
628
704
|
statusCode = 206;
|
|
629
705
|
message = 'Unknown error';
|
|
@@ -648,19 +724,19 @@ describe('CallingClient Error Tests', function () {
|
|
|
648
724
|
context: logObj
|
|
649
725
|
};
|
|
650
726
|
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
651
|
-
|
|
727
|
+
_context10.next = 1;
|
|
652
728
|
return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
|
|
653
729
|
case 1:
|
|
654
|
-
result =
|
|
730
|
+
result = _context10.sent;
|
|
655
731
|
expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
|
|
656
732
|
expect(result).toBe(finalError);
|
|
657
733
|
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
|
|
658
734
|
expect(logSpy).toHaveBeenCalledWith('Unknown Error', logObj);
|
|
659
735
|
case 2:
|
|
660
736
|
case "end":
|
|
661
|
-
return
|
|
737
|
+
return _context10.stop();
|
|
662
738
|
}
|
|
663
|
-
},
|
|
739
|
+
}, _callee10);
|
|
664
740
|
})));
|
|
665
741
|
});
|
|
666
742
|
describe('Call Tests', function () {
|
|
@@ -1208,11 +1284,11 @@ describe('resolveContact tests', function () {
|
|
|
1208
1284
|
}));
|
|
1209
1285
|
});
|
|
1210
1286
|
});
|
|
1211
|
-
it('Resolve by userExternalId - SCIM exception', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1287
|
+
it('Resolve by userExternalId - SCIM exception', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
1212
1288
|
var _callingPartyInfo$use2;
|
|
1213
1289
|
var callingPartyInfo, warnSpy, webexSpy, displayInfo, query;
|
|
1214
|
-
return _regenerator.default.wrap(function (
|
|
1215
|
-
while (1) switch (
|
|
1290
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
1291
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1216
1292
|
case 0:
|
|
1217
1293
|
callingPartyInfo = {};
|
|
1218
1294
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
@@ -1222,10 +1298,10 @@ describe('resolveContact tests', function () {
|
|
|
1222
1298
|
callingPartyInfo.userExternalId = {
|
|
1223
1299
|
$: 'userExternalId'
|
|
1224
1300
|
};
|
|
1225
|
-
|
|
1301
|
+
_context11.next = 1;
|
|
1226
1302
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1227
1303
|
case 1:
|
|
1228
|
-
displayInfo =
|
|
1304
|
+
displayInfo = _context11.sent;
|
|
1229
1305
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
|
|
1230
1306
|
expect(warnSpy).toHaveBeenCalledWith('Error response: - 500', {
|
|
1231
1307
|
file: _constants.UTILS_FILE,
|
|
@@ -1237,15 +1313,15 @@ describe('resolveContact tests', function () {
|
|
|
1237
1313
|
}));
|
|
1238
1314
|
case 2:
|
|
1239
1315
|
case "end":
|
|
1240
|
-
return
|
|
1316
|
+
return _context11.stop();
|
|
1241
1317
|
}
|
|
1242
|
-
},
|
|
1318
|
+
}, _callee11);
|
|
1243
1319
|
})));
|
|
1244
|
-
it('Resolve by userExternalId - totalResults zero', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1320
|
+
it('Resolve by userExternalId - totalResults zero', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
1245
1321
|
var _callingPartyInfo$use3;
|
|
1246
1322
|
var callingPartyInfo, scimResponse, webexSpy, displayInfo, query;
|
|
1247
|
-
return _regenerator.default.wrap(function (
|
|
1248
|
-
while (1) switch (
|
|
1323
|
+
return _regenerator.default.wrap(function (_context12) {
|
|
1324
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1249
1325
|
case 0:
|
|
1250
1326
|
callingPartyInfo = {};
|
|
1251
1327
|
scimResponse = (0, _testUtil.getSampleScimResponse)();
|
|
@@ -1257,10 +1333,10 @@ describe('resolveContact tests', function () {
|
|
|
1257
1333
|
callingPartyInfo.userExternalId = {
|
|
1258
1334
|
$: 'userExternalId'
|
|
1259
1335
|
};
|
|
1260
|
-
|
|
1336
|
+
_context12.next = 1;
|
|
1261
1337
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1262
1338
|
case 1:
|
|
1263
|
-
displayInfo =
|
|
1339
|
+
displayInfo = _context12.sent;
|
|
1264
1340
|
query = scimUrl + encodeURIComponent("id eq \"".concat((_callingPartyInfo$use3 = callingPartyInfo.userExternalId) === null || _callingPartyInfo$use3 === void 0 ? void 0 : _callingPartyInfo$use3.$, "\""));
|
|
1265
1341
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
|
|
1266
1342
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
@@ -1269,15 +1345,15 @@ describe('resolveContact tests', function () {
|
|
|
1269
1345
|
scimResponse.totalResults = '1';
|
|
1270
1346
|
case 2:
|
|
1271
1347
|
case "end":
|
|
1272
|
-
return
|
|
1348
|
+
return _context12.stop();
|
|
1273
1349
|
}
|
|
1274
|
-
},
|
|
1350
|
+
}, _callee12);
|
|
1275
1351
|
})));
|
|
1276
|
-
it('Resolve by userExternalId - no primary number and no phone numbers', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1352
|
+
it('Resolve by userExternalId - no primary number and no phone numbers', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
1277
1353
|
var _callingPartyInfo$use4, _displayInfo, _displayInfo2;
|
|
1278
1354
|
var callingPartyInfo, scimResponse, webexSpy, displayInfo, query, phoneNumbers;
|
|
1279
|
-
return _regenerator.default.wrap(function (
|
|
1280
|
-
while (1) switch (
|
|
1355
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
1356
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1281
1357
|
case 0:
|
|
1282
1358
|
callingPartyInfo = {};
|
|
1283
1359
|
scimResponse = (0, _testUtil.getSampleScimResponse)();
|
|
@@ -1289,10 +1365,10 @@ describe('resolveContact tests', function () {
|
|
|
1289
1365
|
callingPartyInfo.userExternalId = {
|
|
1290
1366
|
$: 'userExternalId'
|
|
1291
1367
|
};
|
|
1292
|
-
|
|
1368
|
+
_context13.next = 1;
|
|
1293
1369
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1294
1370
|
case 1:
|
|
1295
|
-
displayInfo =
|
|
1371
|
+
displayInfo = _context13.sent;
|
|
1296
1372
|
query = scimUrl + encodeURIComponent("id eq \"".concat((_callingPartyInfo$use4 = callingPartyInfo.userExternalId) === null || _callingPartyInfo$use4 === void 0 ? void 0 : _callingPartyInfo$use4.$, "\""));
|
|
1297
1373
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1298
1374
|
uri: query
|
|
@@ -1308,10 +1384,10 @@ describe('resolveContact tests', function () {
|
|
|
1308
1384
|
statusCode: 200,
|
|
1309
1385
|
body: scimResponse
|
|
1310
1386
|
});
|
|
1311
|
-
|
|
1387
|
+
_context13.next = 2;
|
|
1312
1388
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1313
1389
|
case 2:
|
|
1314
|
-
displayInfo =
|
|
1390
|
+
displayInfo = _context13.sent;
|
|
1315
1391
|
expect((_displayInfo2 = displayInfo) === null || _displayInfo2 === void 0 ? void 0 : _displayInfo2.num).toBeUndefined();
|
|
1316
1392
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1317
1393
|
uri: query
|
|
@@ -1319,9 +1395,9 @@ describe('resolveContact tests', function () {
|
|
|
1319
1395
|
scimResponse.Resources[0].phoneNumbers = phoneNumbers;
|
|
1320
1396
|
case 3:
|
|
1321
1397
|
case "end":
|
|
1322
|
-
return
|
|
1398
|
+
return _context13.stop();
|
|
1323
1399
|
}
|
|
1324
|
-
},
|
|
1400
|
+
}, _callee13);
|
|
1325
1401
|
})));
|
|
1326
1402
|
it('Resolve by userExternalId - no photo', function () {
|
|
1327
1403
|
var callingPartyInfo = {};
|
|
@@ -1386,10 +1462,10 @@ describe('resolveContact tests', function () {
|
|
|
1386
1462
|
}));
|
|
1387
1463
|
});
|
|
1388
1464
|
});
|
|
1389
|
-
it('Resolve by name - Empty Info', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1465
|
+
it('Resolve by name - Empty Info', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
1390
1466
|
var callingPartyInfo, peopleListResponse, items, webexSpy, displayInfo;
|
|
1391
|
-
return _regenerator.default.wrap(function (
|
|
1392
|
-
while (1) switch (
|
|
1467
|
+
return _regenerator.default.wrap(function (_context14) {
|
|
1468
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1393
1469
|
case 0:
|
|
1394
1470
|
callingPartyInfo = {};
|
|
1395
1471
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1399,10 +1475,10 @@ describe('resolveContact tests', function () {
|
|
|
1399
1475
|
callingPartyInfo.name = {
|
|
1400
1476
|
$: 'Name'
|
|
1401
1477
|
};
|
|
1402
|
-
|
|
1478
|
+
_context14.next = 1;
|
|
1403
1479
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1404
1480
|
case 1:
|
|
1405
|
-
displayInfo =
|
|
1481
|
+
displayInfo = _context14.sent;
|
|
1406
1482
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
|
|
1407
1483
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1408
1484
|
displayName: 'Name'
|
|
@@ -1410,15 +1486,15 @@ describe('resolveContact tests', function () {
|
|
|
1410
1486
|
peopleListResponse.items = items;
|
|
1411
1487
|
case 2:
|
|
1412
1488
|
case "end":
|
|
1413
|
-
return
|
|
1489
|
+
return _context14.stop();
|
|
1414
1490
|
}
|
|
1415
|
-
},
|
|
1491
|
+
}, _callee14);
|
|
1416
1492
|
})));
|
|
1417
|
-
it('Resolve by name - ID as plain UUID instead of part of URI', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1493
|
+
it('Resolve by name - ID as plain UUID instead of part of URI', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
1418
1494
|
var _displayInfo3, _displayInfo4, _displayInfo5, _displayInfo6, _displayInfo7, _displayInfo8;
|
|
1419
1495
|
var callingPartyInfo, peopleListResponse, id, webexSpy, displayInfo;
|
|
1420
|
-
return _regenerator.default.wrap(function (
|
|
1421
|
-
while (1) switch (
|
|
1496
|
+
return _regenerator.default.wrap(function (_context15) {
|
|
1497
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1422
1498
|
case 0:
|
|
1423
1499
|
callingPartyInfo = {};
|
|
1424
1500
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1429,10 +1505,10 @@ describe('resolveContact tests', function () {
|
|
|
1429
1505
|
callingPartyInfo.name = {
|
|
1430
1506
|
$: 'Name'
|
|
1431
1507
|
};
|
|
1432
|
-
|
|
1508
|
+
_context15.next = 1;
|
|
1433
1509
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1434
1510
|
case 1:
|
|
1435
|
-
displayInfo =
|
|
1511
|
+
displayInfo = _context15.sent;
|
|
1436
1512
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1437
1513
|
displayName: 'Name'
|
|
1438
1514
|
}));
|
|
@@ -1445,10 +1521,10 @@ describe('resolveContact tests', function () {
|
|
|
1445
1521
|
/* Also test empty id */
|
|
1446
1522
|
peopleListResponse.items[0].id = '';
|
|
1447
1523
|
webex.people.list.mockResolvedValueOnce(peopleListResponse);
|
|
1448
|
-
|
|
1524
|
+
_context15.next = 2;
|
|
1449
1525
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1450
1526
|
case 2:
|
|
1451
|
-
displayInfo =
|
|
1527
|
+
displayInfo = _context15.sent;
|
|
1452
1528
|
expect((_displayInfo7 = displayInfo) === null || _displayInfo7 === void 0 ? void 0 : _displayInfo7.id).toStrictEqual('');
|
|
1453
1529
|
expect((_displayInfo8 = displayInfo) === null || _displayInfo8 === void 0 ? void 0 : _displayInfo8.name).toStrictEqual(peopleListResponse.items[0].displayName);
|
|
1454
1530
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
@@ -1457,14 +1533,14 @@ describe('resolveContact tests', function () {
|
|
|
1457
1533
|
peopleListResponse.items[0].id = id;
|
|
1458
1534
|
case 3:
|
|
1459
1535
|
case "end":
|
|
1460
|
-
return
|
|
1536
|
+
return _context15.stop();
|
|
1461
1537
|
}
|
|
1462
|
-
},
|
|
1538
|
+
}, _callee15);
|
|
1463
1539
|
})));
|
|
1464
|
-
it('Resolve by name - Phone numbers no match for type - work', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1540
|
+
it('Resolve by name - Phone numbers no match for type - work', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
1465
1541
|
var callingPartyInfo, peopleListResponse, phoneNumbers, webexSpy, displayInfo;
|
|
1466
|
-
return _regenerator.default.wrap(function (
|
|
1467
|
-
while (1) switch (
|
|
1542
|
+
return _regenerator.default.wrap(function (_context16) {
|
|
1543
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1468
1544
|
case 0:
|
|
1469
1545
|
callingPartyInfo = {};
|
|
1470
1546
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1475,10 +1551,10 @@ describe('resolveContact tests', function () {
|
|
|
1475
1551
|
callingPartyInfo.name = {
|
|
1476
1552
|
$: 'Name'
|
|
1477
1553
|
};
|
|
1478
|
-
|
|
1554
|
+
_context16.next = 1;
|
|
1479
1555
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1480
1556
|
case 1:
|
|
1481
|
-
displayInfo =
|
|
1557
|
+
displayInfo = _context16.sent;
|
|
1482
1558
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toStrictEqual(peopleListResponse.items[0].displayName);
|
|
1483
1559
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.num).toStrictEqual(peopleListResponse.items[0].phoneNumbers[0].value);
|
|
1484
1560
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.avatarSrc).toStrictEqual(peopleListResponse.items[0].avatar);
|
|
@@ -1488,14 +1564,14 @@ describe('resolveContact tests', function () {
|
|
|
1488
1564
|
peopleListResponse.items[0].phoneNumbers = phoneNumbers;
|
|
1489
1565
|
case 2:
|
|
1490
1566
|
case "end":
|
|
1491
|
-
return
|
|
1567
|
+
return _context16.stop();
|
|
1492
1568
|
}
|
|
1493
|
-
},
|
|
1569
|
+
}, _callee16);
|
|
1494
1570
|
})));
|
|
1495
|
-
it('Resolve by name - Phone numbers empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1571
|
+
it('Resolve by name - Phone numbers empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
1496
1572
|
var callingPartyInfo, peopleListResponse, phoneNumbers, webexSpy, displayInfo;
|
|
1497
|
-
return _regenerator.default.wrap(function (
|
|
1498
|
-
while (1) switch (
|
|
1573
|
+
return _regenerator.default.wrap(function (_context17) {
|
|
1574
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1499
1575
|
case 0:
|
|
1500
1576
|
callingPartyInfo = {};
|
|
1501
1577
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1505,10 +1581,10 @@ describe('resolveContact tests', function () {
|
|
|
1505
1581
|
callingPartyInfo.name = {
|
|
1506
1582
|
$: 'Name'
|
|
1507
1583
|
};
|
|
1508
|
-
|
|
1584
|
+
_context17.next = 1;
|
|
1509
1585
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1510
1586
|
case 1:
|
|
1511
|
-
displayInfo =
|
|
1587
|
+
displayInfo = _context17.sent;
|
|
1512
1588
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1513
1589
|
displayName: 'Name'
|
|
1514
1590
|
}));
|
|
@@ -1518,9 +1594,9 @@ describe('resolveContact tests', function () {
|
|
|
1518
1594
|
peopleListResponse.items[0].phoneNumbers = phoneNumbers;
|
|
1519
1595
|
case 2:
|
|
1520
1596
|
case "end":
|
|
1521
|
-
return
|
|
1597
|
+
return _context17.stop();
|
|
1522
1598
|
}
|
|
1523
|
-
},
|
|
1599
|
+
}, _callee17);
|
|
1524
1600
|
})));
|
|
1525
1601
|
});
|
|
1526
1602
|
describe('Store and Fetch voicemail tests', function () {
|
|
@@ -1638,40 +1714,40 @@ describe('Infer id from UUID Tests', function () {
|
|
|
1638
1714
|
});
|
|
1639
1715
|
});
|
|
1640
1716
|
describe('Get endpoint by CALLING_BACKEND tests', function () {
|
|
1641
|
-
it('verify invalid calling backend ucm for xsi endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1717
|
+
it('verify invalid calling backend ucm for xsi endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
1642
1718
|
var _t;
|
|
1643
|
-
return _regenerator.default.wrap(function (
|
|
1644
|
-
while (1) switch (
|
|
1719
|
+
return _regenerator.default.wrap(function (_context18) {
|
|
1720
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1645
1721
|
case 0:
|
|
1646
1722
|
_t = expect;
|
|
1647
|
-
|
|
1723
|
+
_context18.next = 1;
|
|
1648
1724
|
return (0, _Utils.getXsiActionEndpoint)(webex, {
|
|
1649
1725
|
file: 'testFile',
|
|
1650
1726
|
method: 'testMethod'
|
|
1651
1727
|
}, _types.CALLING_BACKEND.UCM);
|
|
1652
1728
|
case 1:
|
|
1653
|
-
_t(
|
|
1729
|
+
_t(_context18.sent).toBeInstanceOf(Error);
|
|
1654
1730
|
case 2:
|
|
1655
1731
|
case "end":
|
|
1656
|
-
return
|
|
1732
|
+
return _context18.stop();
|
|
1657
1733
|
}
|
|
1658
|
-
},
|
|
1734
|
+
}, _callee18);
|
|
1659
1735
|
})));
|
|
1660
|
-
it('verify invalid calling backend wxc for vg endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1736
|
+
it('verify invalid calling backend wxc for vg endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
1661
1737
|
var _t2;
|
|
1662
|
-
return _regenerator.default.wrap(function (
|
|
1663
|
-
while (1) switch (
|
|
1738
|
+
return _regenerator.default.wrap(function (_context19) {
|
|
1739
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1664
1740
|
case 0:
|
|
1665
1741
|
_t2 = expect;
|
|
1666
|
-
|
|
1742
|
+
_context19.next = 1;
|
|
1667
1743
|
return (0, _Utils.getVgActionEndpoint)(webex, _types.CALLING_BACKEND.WXC);
|
|
1668
1744
|
case 1:
|
|
1669
|
-
_t2(
|
|
1745
|
+
_t2(_context19.sent).toBeInstanceOf(Error);
|
|
1670
1746
|
case 2:
|
|
1671
1747
|
case "end":
|
|
1672
|
-
return
|
|
1748
|
+
return _context19.stop();
|
|
1673
1749
|
}
|
|
1674
|
-
},
|
|
1750
|
+
}, _callee19);
|
|
1675
1751
|
})));
|
|
1676
1752
|
});
|
|
1677
1753
|
describe('Get XSI Action Endpoint tests', function () {
|
|
@@ -1689,10 +1765,91 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1689
1765
|
file: 'testFile',
|
|
1690
1766
|
method: 'testMethod'
|
|
1691
1767
|
};
|
|
1692
|
-
|
|
1768
|
+
var expectedXsiEndpoint = 'https://api-proxy-si.broadcloudpbx.net/com.broadsoft.xsi-actions';
|
|
1769
|
+
beforeEach(function () {
|
|
1770
|
+
mockWebex.request.mockClear();
|
|
1771
|
+
});
|
|
1772
|
+
it('should return xsiEndpoint for WXC backend using _serviceUrls.hydra', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
1773
|
+
var hydraEndpoint, wxcWebex, result;
|
|
1774
|
+
return _regenerator.default.wrap(function (_context20) {
|
|
1775
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1776
|
+
case 0:
|
|
1777
|
+
hydraEndpoint = 'https://hydra-a.wbx2.com/v1/';
|
|
1778
|
+
wxcWebex = {
|
|
1779
|
+
request: jest.fn().mockResolvedValue({
|
|
1780
|
+
statusCode: 200,
|
|
1781
|
+
body: _testFixtures.xsiEndpointUrlResponse
|
|
1782
|
+
}),
|
|
1783
|
+
internal: {
|
|
1784
|
+
services: {
|
|
1785
|
+
_serviceUrls: {
|
|
1786
|
+
hydra: hydraEndpoint
|
|
1787
|
+
},
|
|
1788
|
+
_activeServices: {
|
|
1789
|
+
hydra: 'urn:TEAM:us-east-2_a:hydra'
|
|
1790
|
+
},
|
|
1791
|
+
get: jest.fn()
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
};
|
|
1795
|
+
_context20.next = 1;
|
|
1796
|
+
return (0, _Utils.getXsiActionEndpoint)(wxcWebex, loggerContext, _types.CALLING_BACKEND.WXC);
|
|
1797
|
+
case 1:
|
|
1798
|
+
result = _context20.sent;
|
|
1799
|
+
expect(wxcWebex.request).toBeCalledOnceWith({
|
|
1800
|
+
method: _types.HTTP_METHODS.GET,
|
|
1801
|
+
uri: "".concat(hydraEndpoint, "/").concat(_constants2.XSI_ACTION_ENDPOINT_ORG_URL_PARAM)
|
|
1802
|
+
});
|
|
1803
|
+
expect(result).toBe(expectedXsiEndpoint);
|
|
1804
|
+
expect(wxcWebex.internal.services.get).not.toHaveBeenCalled();
|
|
1805
|
+
case 2:
|
|
1806
|
+
case "end":
|
|
1807
|
+
return _context20.stop();
|
|
1808
|
+
}
|
|
1809
|
+
}, _callee20);
|
|
1810
|
+
})));
|
|
1811
|
+
it('should return xsiEndpoint for WXC backend using services.get when _serviceUrls is undefined', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
1812
|
+
var hydraEndpoint, activeHydraCluster, wxcWebex, result;
|
|
1813
|
+
return _regenerator.default.wrap(function (_context21) {
|
|
1814
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1815
|
+
case 0:
|
|
1816
|
+
hydraEndpoint = 'https://hydra-a.wbx2.com/v1/';
|
|
1817
|
+
activeHydraCluster = 'urn:TEAM:us-east-2_a:hydra';
|
|
1818
|
+
wxcWebex = {
|
|
1819
|
+
request: jest.fn().mockResolvedValue({
|
|
1820
|
+
statusCode: 200,
|
|
1821
|
+
body: _testFixtures.xsiEndpointUrlResponse
|
|
1822
|
+
}),
|
|
1823
|
+
internal: {
|
|
1824
|
+
services: {
|
|
1825
|
+
_serviceUrls: undefined,
|
|
1826
|
+
_activeServices: {
|
|
1827
|
+
hydra: activeHydraCluster
|
|
1828
|
+
},
|
|
1829
|
+
get: jest.fn().mockReturnValue(hydraEndpoint)
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
};
|
|
1833
|
+
_context21.next = 1;
|
|
1834
|
+
return (0, _Utils.getXsiActionEndpoint)(wxcWebex, loggerContext, _types.CALLING_BACKEND.WXC);
|
|
1835
|
+
case 1:
|
|
1836
|
+
result = _context21.sent;
|
|
1837
|
+
expect(wxcWebex.internal.services.get).toBeCalledOnceWith(activeHydraCluster);
|
|
1838
|
+
expect(wxcWebex.request).toBeCalledOnceWith({
|
|
1839
|
+
method: _types.HTTP_METHODS.GET,
|
|
1840
|
+
uri: "".concat(hydraEndpoint, "/").concat(_constants2.XSI_ACTION_ENDPOINT_ORG_URL_PARAM)
|
|
1841
|
+
});
|
|
1842
|
+
expect(result).toBe(expectedXsiEndpoint);
|
|
1843
|
+
case 2:
|
|
1844
|
+
case "end":
|
|
1845
|
+
return _context21.stop();
|
|
1846
|
+
}
|
|
1847
|
+
}, _callee21);
|
|
1848
|
+
})));
|
|
1849
|
+
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
1693
1850
|
var mockResponse, xsiEndpoint;
|
|
1694
|
-
return _regenerator.default.wrap(function (
|
|
1695
|
-
while (1) switch (
|
|
1851
|
+
return _regenerator.default.wrap(function (_context22) {
|
|
1852
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1696
1853
|
case 0:
|
|
1697
1854
|
mockResponse = {
|
|
1698
1855
|
body: {
|
|
@@ -1704,22 +1861,22 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1704
1861
|
}
|
|
1705
1862
|
};
|
|
1706
1863
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1707
|
-
|
|
1864
|
+
_context22.next = 1;
|
|
1708
1865
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1709
1866
|
case 1:
|
|
1710
|
-
xsiEndpoint =
|
|
1867
|
+
xsiEndpoint = _context22.sent;
|
|
1711
1868
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1712
1869
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1713
1870
|
case 2:
|
|
1714
1871
|
case "end":
|
|
1715
|
-
return
|
|
1872
|
+
return _context22.stop();
|
|
1716
1873
|
}
|
|
1717
|
-
},
|
|
1874
|
+
}, _callee22);
|
|
1718
1875
|
})));
|
|
1719
|
-
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1876
|
+
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
1720
1877
|
var mockResponse, xsiEndpoint;
|
|
1721
|
-
return _regenerator.default.wrap(function (
|
|
1722
|
-
while (1) switch (
|
|
1878
|
+
return _regenerator.default.wrap(function (_context23) {
|
|
1879
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1723
1880
|
case 0:
|
|
1724
1881
|
mockResponse = {
|
|
1725
1882
|
body: {
|
|
@@ -1731,22 +1888,22 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1731
1888
|
}
|
|
1732
1889
|
};
|
|
1733
1890
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1734
|
-
|
|
1891
|
+
_context23.next = 1;
|
|
1735
1892
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1736
1893
|
case 1:
|
|
1737
|
-
xsiEndpoint =
|
|
1894
|
+
xsiEndpoint = _context23.sent;
|
|
1738
1895
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1739
1896
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1740
1897
|
case 2:
|
|
1741
1898
|
case "end":
|
|
1742
|
-
return
|
|
1899
|
+
return _context23.stop();
|
|
1743
1900
|
}
|
|
1744
|
-
},
|
|
1901
|
+
}, _callee23);
|
|
1745
1902
|
})));
|
|
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
|
|
1903
|
+
it('should return xsiEndpoint for BWRKS backend when URL does not end with any version', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
1747
1904
|
var mockResponse, xsiEndpoint;
|
|
1748
|
-
return _regenerator.default.wrap(function (
|
|
1749
|
-
while (1) switch (
|
|
1905
|
+
return _regenerator.default.wrap(function (_context24) {
|
|
1906
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1750
1907
|
case 0:
|
|
1751
1908
|
mockResponse = {
|
|
1752
1909
|
body: {
|
|
@@ -1758,17 +1915,17 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1758
1915
|
}
|
|
1759
1916
|
};
|
|
1760
1917
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1761
|
-
|
|
1918
|
+
_context24.next = 1;
|
|
1762
1919
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1763
1920
|
case 1:
|
|
1764
|
-
xsiEndpoint =
|
|
1921
|
+
xsiEndpoint = _context24.sent;
|
|
1765
1922
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1766
1923
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1767
1924
|
case 2:
|
|
1768
1925
|
case "end":
|
|
1769
|
-
return
|
|
1926
|
+
return _context24.stop();
|
|
1770
1927
|
}
|
|
1771
|
-
},
|
|
1928
|
+
}, _callee24);
|
|
1772
1929
|
})));
|
|
1773
1930
|
});
|
|
1774
1931
|
describe('modifySdpForIPv4', function () {
|
|
@@ -1838,19 +1995,19 @@ describe('uploadLogs', function () {
|
|
|
1838
1995
|
afterEach(function () {
|
|
1839
1996
|
jest.clearAllMocks();
|
|
1840
1997
|
});
|
|
1841
|
-
it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1998
|
+
it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
1842
1999
|
var mockMetaData, logSpy, result;
|
|
1843
|
-
return _regenerator.default.wrap(function (
|
|
1844
|
-
while (1) switch (
|
|
2000
|
+
return _regenerator.default.wrap(function (_context25) {
|
|
2001
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1845
2002
|
case 0:
|
|
1846
2003
|
mockMetaData = {
|
|
1847
2004
|
correlationId: 'test-correlation'
|
|
1848
2005
|
};
|
|
1849
2006
|
logSpy = jest.spyOn(_Logger.default, 'info');
|
|
1850
|
-
|
|
2007
|
+
_context25.next = 1;
|
|
1851
2008
|
return (0, _Utils.uploadLogs)(mockMetaData, true);
|
|
1852
2009
|
case 1:
|
|
1853
|
-
result =
|
|
2010
|
+
result = _context25.sent;
|
|
1854
2011
|
expect(result).toEqual({
|
|
1855
2012
|
trackingid: '1234',
|
|
1856
2013
|
feedbackId: 'mocked-uuid-12345'
|
|
@@ -1883,14 +2040,14 @@ describe('uploadLogs', function () {
|
|
|
1883
2040
|
});
|
|
1884
2041
|
case 2:
|
|
1885
2042
|
case "end":
|
|
1886
|
-
return
|
|
2043
|
+
return _context25.stop();
|
|
1887
2044
|
}
|
|
1888
|
-
},
|
|
2045
|
+
}, _callee25);
|
|
1889
2046
|
})));
|
|
1890
|
-
it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2047
|
+
it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
1891
2048
|
var mockMetaData, mockError, logSpy, _t3;
|
|
1892
|
-
return _regenerator.default.wrap(function (
|
|
1893
|
-
while (1) switch (
|
|
2049
|
+
return _regenerator.default.wrap(function (_context26) {
|
|
2050
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1894
2051
|
case 0:
|
|
1895
2052
|
mockMetaData = {
|
|
1896
2053
|
correlationId: 'test-correlation'
|
|
@@ -1898,17 +2055,17 @@ describe('uploadLogs', function () {
|
|
|
1898
2055
|
mockError = new Error('Upload failed'); // Mock the submitLogs to fail
|
|
1899
2056
|
submitLogsMock.mockRejectedValueOnce(mockError);
|
|
1900
2057
|
logSpy = jest.spyOn(_Logger.default, 'error');
|
|
1901
|
-
|
|
1902
|
-
|
|
2058
|
+
_context26.prev = 1;
|
|
2059
|
+
_context26.next = 2;
|
|
1903
2060
|
return (0, _Utils.uploadLogs)(mockMetaData, true);
|
|
1904
2061
|
case 2:
|
|
1905
2062
|
// If we get here, the test should fail since we expected an exception
|
|
1906
2063
|
expect(true).toBe(false); // This will fail the test if no exception is thrown
|
|
1907
|
-
|
|
2064
|
+
_context26.next = 4;
|
|
1908
2065
|
break;
|
|
1909
2066
|
case 3:
|
|
1910
|
-
|
|
1911
|
-
_t3 =
|
|
2067
|
+
_context26.prev = 3;
|
|
2068
|
+
_t3 = _context26["catch"](1);
|
|
1912
2069
|
expect(_t3).toBe(mockError);
|
|
1913
2070
|
expect(logSpy).toHaveBeenCalledWith("Failed to upload Logs ".concat((0, _stringify.default)(_t3)), {
|
|
1914
2071
|
file: _constants.UTILS_FILE,
|
|
@@ -1935,14 +2092,14 @@ describe('uploadLogs', function () {
|
|
|
1935
2092
|
});
|
|
1936
2093
|
case 4:
|
|
1937
2094
|
case "end":
|
|
1938
|
-
return
|
|
2095
|
+
return _context26.stop();
|
|
1939
2096
|
}
|
|
1940
|
-
},
|
|
2097
|
+
}, _callee26, null, [[1, 3]]);
|
|
1941
2098
|
})));
|
|
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
|
|
2099
|
+
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 _callee27() {
|
|
1943
2100
|
var mockMetaData, mockError, logSpy, result;
|
|
1944
|
-
return _regenerator.default.wrap(function (
|
|
1945
|
-
while (1) switch (
|
|
2101
|
+
return _regenerator.default.wrap(function (_context27) {
|
|
2102
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1946
2103
|
case 0:
|
|
1947
2104
|
mockMetaData = {
|
|
1948
2105
|
correlationId: 'test-correlation',
|
|
@@ -1951,10 +2108,10 @@ describe('uploadLogs', function () {
|
|
|
1951
2108
|
mockError = new Error('Upload failed'); // Mock the submitLogs to fail
|
|
1952
2109
|
submitLogsMock.mockRejectedValueOnce(mockError);
|
|
1953
2110
|
logSpy = jest.spyOn(_Logger.default, 'error');
|
|
1954
|
-
|
|
2111
|
+
_context27.next = 1;
|
|
1955
2112
|
return (0, _Utils.uploadLogs)(mockMetaData, false);
|
|
1956
2113
|
case 1:
|
|
1957
|
-
result =
|
|
2114
|
+
result = _context27.sent;
|
|
1958
2115
|
expect(result).toBeUndefined();
|
|
1959
2116
|
expect(logSpy).toHaveBeenCalledWith("Failed to upload Logs ".concat((0, _stringify.default)(mockError)), {
|
|
1960
2117
|
file: _constants.UTILS_FILE,
|
|
@@ -1981,9 +2138,88 @@ describe('uploadLogs', function () {
|
|
|
1981
2138
|
});
|
|
1982
2139
|
case 2:
|
|
1983
2140
|
case "end":
|
|
1984
|
-
return
|
|
2141
|
+
return _context27.stop();
|
|
1985
2142
|
}
|
|
1986
|
-
},
|
|
2143
|
+
}, _callee27);
|
|
1987
2144
|
})));
|
|
1988
2145
|
});
|
|
2146
|
+
describe('resolveCallingBackend', function () {
|
|
2147
|
+
var createDevice = function createDevice(callingBehavior, entitlementKeys) {
|
|
2148
|
+
return {
|
|
2149
|
+
url: 'https://wdm.example.com/devices/123',
|
|
2150
|
+
userId: 'user-id',
|
|
2151
|
+
orgId: 'org-id',
|
|
2152
|
+
version: '1.0',
|
|
2153
|
+
callingBehavior: callingBehavior,
|
|
2154
|
+
features: {
|
|
2155
|
+
developer: {
|
|
2156
|
+
models: [],
|
|
2157
|
+
get: jest.fn()
|
|
2158
|
+
},
|
|
2159
|
+
entitlement: {
|
|
2160
|
+
models: entitlementKeys.map(function (key) {
|
|
2161
|
+
return {
|
|
2162
|
+
_values: {
|
|
2163
|
+
key: key
|
|
2164
|
+
}
|
|
2165
|
+
};
|
|
2166
|
+
})
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
};
|
|
2170
|
+
};
|
|
2171
|
+
it.each([['bc-sp-basic', _types.CALLING_BACKEND.WXC], ['bc-sp-standard', _types.CALLING_BACKEND.WXC]])('returns WXC when callingBehavior is NATIVE_WEBEX_TEAMS_CALLING and entitlement is %s', function (entitlement, expected) {
|
|
2172
|
+
var device = createDevice('NATIVE_WEBEX_TEAMS_CALLING', [entitlement]);
|
|
2173
|
+
expect((0, _Utils.resolveCallingBackend)(device)).toBe(expected);
|
|
2174
|
+
});
|
|
2175
|
+
it('returns BWRKS when callingBehavior is NATIVE_WEBEX_TEAMS_CALLING and entitlement is broadworks-connector', function () {
|
|
2176
|
+
var device = createDevice('NATIVE_WEBEX_TEAMS_CALLING', ['broadworks-connector']);
|
|
2177
|
+
expect((0, _Utils.resolveCallingBackend)(device)).toBe(_types.CALLING_BACKEND.BWRKS);
|
|
2178
|
+
});
|
|
2179
|
+
it('returns UCM when callingBehavior is NATIVE_SIP_CALL_TO_UCM', function () {
|
|
2180
|
+
var device = createDevice('NATIVE_SIP_CALL_TO_UCM', []);
|
|
2181
|
+
expect((0, _Utils.resolveCallingBackend)(device)).toBe(_types.CALLING_BACKEND.UCM);
|
|
2182
|
+
});
|
|
2183
|
+
it('returns INVALID when callingBehavior is unknown', function () {
|
|
2184
|
+
var device = createDevice('UNKNOWN_BEHAVIOR', []);
|
|
2185
|
+
expect((0, _Utils.resolveCallingBackend)(device)).toBe(_types.CALLING_BACKEND.INVALID);
|
|
2186
|
+
});
|
|
2187
|
+
it('returns INVALID when callingBehavior is NATIVE_WEBEX_TEAMS_CALLING but no matching entitlement', function () {
|
|
2188
|
+
var device = createDevice('NATIVE_WEBEX_TEAMS_CALLING', ['some-other-entitlement']);
|
|
2189
|
+
expect((0, _Utils.resolveCallingBackend)(device)).toBe(_types.CALLING_BACKEND.INVALID);
|
|
2190
|
+
});
|
|
2191
|
+
it('matches the first qualifying entitlement when multiple are present', function () {
|
|
2192
|
+
var device = createDevice('NATIVE_WEBEX_TEAMS_CALLING', ['broadworks-connector', 'bc-sp-basic']);
|
|
2193
|
+
expect((0, _Utils.resolveCallingBackend)(device)).toBe(_types.CALLING_BACKEND.BWRKS);
|
|
2194
|
+
});
|
|
2195
|
+
});
|
|
2196
|
+
describe('getCallingBackEnd', function () {
|
|
2197
|
+
it('passes webex.internal.device to resolveCallingBackend and returns its result', function () {
|
|
2198
|
+
var device = {
|
|
2199
|
+
url: 'https://wdm.example.com/devices/123',
|
|
2200
|
+
userId: 'user-id',
|
|
2201
|
+
orgId: 'org-id',
|
|
2202
|
+
version: '1.0',
|
|
2203
|
+
callingBehavior: 'NATIVE_SIP_CALL_TO_UCM',
|
|
2204
|
+
features: {
|
|
2205
|
+
developer: {
|
|
2206
|
+
models: [],
|
|
2207
|
+
get: jest.fn()
|
|
2208
|
+
},
|
|
2209
|
+
entitlement: {
|
|
2210
|
+
models: []
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2213
|
+
};
|
|
2214
|
+
var mockWebex = {
|
|
2215
|
+
internal: {
|
|
2216
|
+
device: device
|
|
2217
|
+
}
|
|
2218
|
+
};
|
|
2219
|
+
var result = (0, _Utils.getCallingBackEnd)(mockWebex);
|
|
2220
|
+
expect(result).toBe((0, _Utils.resolveCallingBackend)(device));
|
|
2221
|
+
expect((0, _Utils.resolveCallingBackend)(device)).toBe(_types.CALLING_BACKEND.UCM);
|
|
2222
|
+
expect(result).toBe(_types.CALLING_BACKEND.UCM);
|
|
2223
|
+
});
|
|
2224
|
+
});
|
|
1989
2225
|
//# sourceMappingURL=Utils.test.js.map
|