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