@webex/calling 3.12.0 → 3.13.0-next.10
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/README.md +1 -1
- package/dist/CallHistory/CallHistory.js +1 -1
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +2 -1
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallQueue/CallQueue.js +1322 -0
- package/dist/CallQueue/CallQueue.js.map +1 -0
- package/dist/CallQueue/CallQueue.test.js +3321 -0
- package/dist/CallQueue/CallQueue.test.js.map +1 -0
- package/dist/CallQueue/constants.js +65 -0
- package/dist/CallQueue/constants.js.map +1 -0
- package/dist/CallQueue/types.js +4 -0
- package/dist/CallQueue/types.js.map +1 -0
- package/dist/CallQueue/utils.js +370 -0
- package/dist/CallQueue/utils.js.map +1 -0
- package/dist/CallQueue/utils.test.js +548 -0
- package/dist/CallQueue/utils.test.js.map +1 -0
- 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 +748 -0
- package/dist/CallRecording/WxcCallRecordingConnector.js.map +1 -0
- package/dist/CallRecording/WxcCallRecordingConnector.test.js +824 -0
- package/dist/CallRecording/WxcCallRecordingConnector.test.js.map +1 -0
- package/dist/CallRecording/callRecordingFixtures.js +266 -0
- package/dist/CallRecording/callRecordingFixtures.js.map +1 -0
- package/dist/CallRecording/constants.js +35 -0
- package/dist/CallRecording/constants.js.map +1 -0
- package/dist/CallRecording/types.js +142 -0
- package/dist/CallRecording/types.js.map +1 -0
- package/dist/CallRecording/userhub.js +117 -0
- package/dist/CallRecording/userhub.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 +469 -233
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +736 -179
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.js +3 -1
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +12 -2
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +645 -458
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +928 -498
- 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 +34 -4
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +27 -3
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +102 -17
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +971 -506
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +1037 -116
- 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 +39 -11
- 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/Voicemail/Voicemail.js +10 -10
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/Voicemail.test.js +40 -20
- package/dist/Voicemail/Voicemail.test.js.map +1 -1
- package/dist/api.js +95 -0
- package/dist/api.js.map +1 -1
- package/dist/common/Utils.js +259 -133
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +643 -298
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/callUtils.js +187 -0
- package/dist/common/callUtils.js.map +1 -0
- package/dist/common/callUtils.test.js +313 -0
- package/dist/common/callUtils.test.js.map +1 -0
- package/dist/common/constants.js +27 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/index.js +11 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/testUtil.js +11 -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 +228 -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 +493 -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 +614 -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 +747 -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/CallHistory/CallHistory.js +1 -1
- package/dist/module/CallQueue/CallQueue.js +718 -0
- package/dist/module/CallQueue/constants.js +41 -0
- package/dist/module/CallQueue/types.js +1 -0
- package/dist/module/CallQueue/utils.js +253 -0
- package/dist/module/CallRecording/CallRecording.js +56 -0
- package/dist/module/CallRecording/WxcCallRecordingConnector.js +349 -0
- package/dist/module/CallRecording/callRecordingFixtures.js +231 -0
- package/dist/module/CallRecording/constants.js +27 -0
- package/dist/module/CallRecording/types.js +19 -0
- package/dist/module/CallRecording/userhub.js +100 -0
- package/dist/module/CallRecording/utils.js +14 -0
- package/dist/module/CallingClient/CallingClient.js +137 -20
- package/dist/module/CallingClient/calling/CallerId/index.js +2 -2
- package/dist/module/CallingClient/calling/call.js +207 -68
- package/dist/module/CallingClient/calling/callManager.js +51 -11
- package/dist/module/CallingClient/calling/types.js +2 -0
- package/dist/module/CallingClient/constants.js +29 -1
- package/dist/module/CallingClient/line/index.js +11 -3
- package/dist/module/CallingClient/registration/register.js +297 -68
- 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 +24 -10
- package/dist/module/Metrics/index.js +48 -1
- package/dist/module/Metrics/types.js +18 -0
- package/dist/module/Voicemail/Voicemail.js +10 -10
- package/dist/module/api.js +6 -2
- package/dist/module/common/Utils.js +110 -63
- package/dist/module/common/callUtils.js +90 -0
- package/dist/module/common/constants.js +11 -0
- package/dist/module/common/index.js +1 -0
- package/dist/module/common/testUtil.js +7 -1
- package/dist/module/common/types.js +3 -0
- package/dist/module/index.js +10 -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 +376 -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/CallQueue/CallQueue.d.ts +45 -0
- package/dist/types/CallQueue/CallQueue.d.ts.map +1 -0
- package/dist/types/CallQueue/constants.d.ts +37 -0
- package/dist/types/CallQueue/constants.d.ts.map +1 -0
- package/dist/types/CallQueue/types.d.ts +97 -0
- package/dist/types/CallQueue/types.d.ts.map +1 -0
- package/dist/types/CallQueue/utils.d.ts +19 -0
- package/dist/types/CallQueue/utils.d.ts.map +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 +27 -0
- package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts.map +1 -0
- package/dist/types/CallRecording/callRecordingFixtures.d.ts +152 -0
- package/dist/types/CallRecording/callRecordingFixtures.d.ts.map +1 -0
- package/dist/types/CallRecording/constants.d.ts +28 -0
- package/dist/types/CallRecording/constants.d.ts.map +1 -0
- package/dist/types/CallRecording/types.d.ts +184 -0
- package/dist/types/CallRecording/types.d.ts.map +1 -0
- package/dist/types/CallRecording/userhub.d.ts +44 -0
- package/dist/types/CallRecording/userhub.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/CallerId/index.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 +29 -1
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts +3 -2
- 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 +6 -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 +81 -16
- 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 +41 -13
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/api.d.ts +10 -4
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +11 -5
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/callUtils.d.ts +6 -0
- package/dist/types/common/callUtils.d.ts.map +1 -0
- package/dist/types/common/constants.d.ts +6 -0
- package/dist/types/common/constants.d.ts.map +1 -1
- package/dist/types/common/index.d.ts +1 -0
- package/dist/types/common/index.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +6 -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 +13 -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 -18
- package/src/mobius-socket/socket/socket.shim.ts +22 -0
- package/src/mobius-socket/socket/socket.ts +14 -0
|
@@ -12,6 +12,8 @@ var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/
|
|
|
12
12
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
14
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
15
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
16
|
+
var _path = _interopRequireDefault(require("path"));
|
|
15
17
|
var _uuid = require("uuid");
|
|
16
18
|
var _calling = require("../CallingClient/calling");
|
|
17
19
|
var _Errors = require("../Errors");
|
|
@@ -23,6 +25,7 @@ var _types2 = require("../Errors/types");
|
|
|
23
25
|
var _Utils = require("./Utils");
|
|
24
26
|
var _voicemailFixture = require("../Voicemail/voicemailFixture");
|
|
25
27
|
var _constants2 = require("./constants");
|
|
28
|
+
var _testFixtures = require("../CallSettings/testFixtures");
|
|
26
29
|
var _types3 = require("../Events/types");
|
|
27
30
|
var _SDKConnector = _interopRequireDefault(require("../SDKConnector"));
|
|
28
31
|
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 +41,24 @@ var mockSubmitRegistrationMetric = jest.fn();
|
|
|
38
41
|
var mockEmitterCb = jest.fn();
|
|
39
42
|
var mockRestoreCb = jest.fn();
|
|
40
43
|
var mock429RetryCb = jest.fn();
|
|
44
|
+
var mockSessionSupersededCb = jest.fn();
|
|
45
|
+
var retryAfterCases = [{
|
|
46
|
+
headers: {
|
|
47
|
+
'retry-after': '120'
|
|
48
|
+
},
|
|
49
|
+
retryAfter: 120
|
|
50
|
+
}, {
|
|
51
|
+
headers: {
|
|
52
|
+
'Retry-After': '120'
|
|
53
|
+
},
|
|
54
|
+
retryAfter: 120
|
|
55
|
+
}, {
|
|
56
|
+
headers: {
|
|
57
|
+
'retry-after': '0',
|
|
58
|
+
'Retry-After': '120'
|
|
59
|
+
},
|
|
60
|
+
retryAfter: 0
|
|
61
|
+
}];
|
|
41
62
|
var webex = (0, _testUtil.getTestUtilsWebex)();
|
|
42
63
|
_SDKConnector.default.setWebex(webex);
|
|
43
64
|
webex.internal.metrics.submitClientMetrics = mockSubmitRegistrationMetric;
|
|
@@ -64,6 +85,28 @@ describe('Mobius service discovery tests', function () {
|
|
|
64
85
|
expect(filteredUris.primary[0]).toBe(defaultMobiusUrl + callingContext);
|
|
65
86
|
expect(filteredUris.backup.length).toBe(0);
|
|
66
87
|
});
|
|
88
|
+
it('filterMobiusUris drops untrusted wss hosts', function () {
|
|
89
|
+
var defaultMobiusUrl = 'https://mobius.webex.com/api/v1/calling/web';
|
|
90
|
+
var discoveryResponse = (0, _testUtil.getMobiusDiscoveryResponse)();
|
|
91
|
+
discoveryResponse.primary.wss = ['wss://mobius-dfw.webex.com/socket', 'wss://evil.example.com/socket'];
|
|
92
|
+
discoveryResponse.backup.wss = ['wss://mobius-sjc.webex.com/socket', 'wss://attacker.example.org/socket'];
|
|
93
|
+
var filteredUris = (0, _Utils.filterMobiusUris)(discoveryResponse, defaultMobiusUrl);
|
|
94
|
+
expect(filteredUris.primaryWss).toHaveLength(1);
|
|
95
|
+
expect(filteredUris.primaryWss[0]).toBe('wss://mobius-dfw.webex.com/socket');
|
|
96
|
+
expect(filteredUris.backupWss).toHaveLength(1);
|
|
97
|
+
expect(filteredUris.backupWss[0]).toBe('wss://mobius-sjc.webex.com/socket');
|
|
98
|
+
});
|
|
99
|
+
it('filterMobiusUris drops malformed/unparseable wss hosts', function () {
|
|
100
|
+
var defaultMobiusUrl = 'https://mobius.webex.com/api/v1/calling/web';
|
|
101
|
+
var discoveryResponse = (0, _testUtil.getMobiusDiscoveryResponse)();
|
|
102
|
+
discoveryResponse.primary.wss = ['wss://mobius-dfw.webex.com/socket', 'wss://', 'not a url'];
|
|
103
|
+
discoveryResponse.backup.wss = ['not a url', 'wss://mobius-sjc.webex.com/socket'];
|
|
104
|
+
var filteredUris = (0, _Utils.filterMobiusUris)(discoveryResponse, defaultMobiusUrl);
|
|
105
|
+
expect(filteredUris.primaryWss).toHaveLength(1);
|
|
106
|
+
expect(filteredUris.primaryWss[0]).toBe('wss://mobius-dfw.webex.com/socket');
|
|
107
|
+
expect(filteredUris.backupWss).toHaveLength(1);
|
|
108
|
+
expect(filteredUris.backupWss[0]).toBe('wss://mobius-sjc.webex.com/socket');
|
|
109
|
+
});
|
|
67
110
|
});
|
|
68
111
|
describe('Call Tests - keepalive (handleCallEstablished) cases', function () {
|
|
69
112
|
var logObj = {
|
|
@@ -142,41 +185,46 @@ describe('Call Tests - keepalive (handleCallEstablished) cases', function () {
|
|
|
142
185
|
}
|
|
143
186
|
}, _callee2);
|
|
144
187
|
})));
|
|
145
|
-
it('500
|
|
146
|
-
var
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
188
|
+
it.each(retryAfterCases)('500 keepalive honors $headers', /*#__PURE__*/function () {
|
|
189
|
+
var _ref4 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3(_ref3) {
|
|
190
|
+
var headers, retryAfter, emitted, endSpy, retrySpy, payload;
|
|
191
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
192
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
193
|
+
case 0:
|
|
194
|
+
headers = _ref3.headers, retryAfter = _ref3.retryAfter;
|
|
195
|
+
emitted = false;
|
|
196
|
+
endSpy = jest.fn();
|
|
197
|
+
retrySpy = jest.fn();
|
|
198
|
+
payload = {
|
|
199
|
+
statusCode: 500,
|
|
200
|
+
headers: _objectSpread({
|
|
201
|
+
trackingid: 't'
|
|
202
|
+
}, headers),
|
|
203
|
+
body: {
|
|
204
|
+
device: {
|
|
205
|
+
deviceId: 'd'
|
|
206
|
+
},
|
|
207
|
+
errorCode: 0
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
_context3.next = 1;
|
|
211
|
+
return (0, _Utils.handleCallErrors)(function () {
|
|
212
|
+
emitted = true;
|
|
213
|
+
}, _types2.ERROR_LAYER.CALL_CONTROL, retrySpy, dummyCorrelationId, payload, 'handleCallEstablished', logObj.file, endSpy);
|
|
214
|
+
case 1:
|
|
215
|
+
expect(emitted).toBe(true);
|
|
216
|
+
expect(endSpy).not.toHaveBeenCalled();
|
|
217
|
+
expect(retrySpy).toBeCalledOnceWith(retryAfter);
|
|
218
|
+
case 2:
|
|
219
|
+
case "end":
|
|
220
|
+
return _context3.stop();
|
|
221
|
+
}
|
|
222
|
+
}, _callee3);
|
|
223
|
+
}));
|
|
224
|
+
return function (_x) {
|
|
225
|
+
return _ref4.apply(this, arguments);
|
|
226
|
+
};
|
|
227
|
+
}());
|
|
180
228
|
it('500 during keepalive without retry-after triggers retryCb without args', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
181
229
|
var emitted, retrySpy, payload, abort;
|
|
182
230
|
return _regenerator.default.wrap(function (_context4) {
|
|
@@ -244,41 +292,46 @@ describe('Call Tests - keepalive (handleCallEstablished) cases', function () {
|
|
|
244
292
|
}
|
|
245
293
|
}, _callee5);
|
|
246
294
|
})));
|
|
247
|
-
it('503
|
|
248
|
-
var
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
295
|
+
it.each(retryAfterCases)('503 keepalive honors $headers', /*#__PURE__*/function () {
|
|
296
|
+
var _ref8 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(_ref7) {
|
|
297
|
+
var headers, retryAfter, emitted, retrySpy, payload, abort;
|
|
298
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
299
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
300
|
+
case 0:
|
|
301
|
+
headers = _ref7.headers, retryAfter = _ref7.retryAfter;
|
|
302
|
+
emitted = false;
|
|
303
|
+
retrySpy = jest.fn();
|
|
304
|
+
payload = {
|
|
305
|
+
statusCode: 503,
|
|
306
|
+
headers: _objectSpread({
|
|
307
|
+
trackingid: 't'
|
|
308
|
+
}, headers),
|
|
309
|
+
body: {
|
|
310
|
+
device: {
|
|
311
|
+
deviceId: 'd'
|
|
312
|
+
},
|
|
313
|
+
errorCode: 0
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
_context6.next = 1;
|
|
317
|
+
return (0, _Utils.handleCallErrors)(function () {
|
|
318
|
+
emitted = true;
|
|
319
|
+
}, _types2.ERROR_LAYER.CALL_CONTROL, retrySpy, dummyCorrelationId, payload, 'handleCallEstablished', logObj.file);
|
|
320
|
+
case 1:
|
|
321
|
+
abort = _context6.sent;
|
|
322
|
+
expect(abort).toBe(false);
|
|
323
|
+
expect(emitted).toBe(false);
|
|
324
|
+
expect(retrySpy).toBeCalledOnceWith(retryAfter);
|
|
325
|
+
case 2:
|
|
326
|
+
case "end":
|
|
327
|
+
return _context6.stop();
|
|
328
|
+
}
|
|
329
|
+
}, _callee6);
|
|
330
|
+
}));
|
|
331
|
+
return function (_x2) {
|
|
332
|
+
return _ref8.apply(this, arguments);
|
|
333
|
+
};
|
|
334
|
+
}());
|
|
282
335
|
it('503 during keepalive without retry-after invokes emitterCb and triggers retryCb without args', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
283
336
|
var emitted, retrySpy, payload, abort;
|
|
284
337
|
return _regenerator.default.wrap(function (_context7) {
|
|
@@ -452,6 +505,18 @@ describe('Registration Tests', function () {
|
|
|
452
505
|
restoreCbExpected: false,
|
|
453
506
|
retry429CbExpected: false,
|
|
454
507
|
logMsg: '400 Bad Request'
|
|
508
|
+
}, {
|
|
509
|
+
name: 'verify 409 error response',
|
|
510
|
+
statusCode: _types2.ERROR_CODE.CONFLICT,
|
|
511
|
+
deviceErrorCode: 0,
|
|
512
|
+
message: _constants.SESSION_SUPERSEDED_MESSAGE,
|
|
513
|
+
errorType: _types2.ERROR_TYPE.SESSION_SUPERSEDED,
|
|
514
|
+
emitterCbExpected: false,
|
|
515
|
+
finalError: true,
|
|
516
|
+
restoreCbExpected: false,
|
|
517
|
+
retry429CbExpected: false,
|
|
518
|
+
sessionSupersededCbExpected: true,
|
|
519
|
+
logMsg: '409 Conflict: session superseded by another device for this user'
|
|
455
520
|
}, {
|
|
456
521
|
name: 'verify unknown error response',
|
|
457
522
|
statusCode: 206,
|
|
@@ -477,55 +542,142 @@ describe('Registration Tests', function () {
|
|
|
477
542
|
};
|
|
478
543
|
|
|
479
544
|
/* 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
|
-
|
|
545
|
+
it.each(errorCodes)('%s', /*#__PURE__*/function () {
|
|
546
|
+
var _ref0 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8(codeObj) {
|
|
547
|
+
var webexPayload, mockErrorEvent, callClientError, result;
|
|
548
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
549
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
550
|
+
case 0:
|
|
551
|
+
webexPayload = {
|
|
552
|
+
statusCode: codeObj.statusCode,
|
|
553
|
+
headers: _objectSpread({
|
|
554
|
+
trackingid: 'webex-js-sdk_b5812e58-7246-4a9b-bf64-831bdf13b0cd_31'
|
|
555
|
+
}, codeObj.retryAfter && {
|
|
556
|
+
'retry-after': codeObj.retryAfter.toString()
|
|
557
|
+
}),
|
|
558
|
+
body: {
|
|
559
|
+
device: {
|
|
560
|
+
deviceId: '8a67806f-fc4d-446b-a131-31e71ea5b010'
|
|
561
|
+
},
|
|
562
|
+
userId: '8a67806f-fc4d-446b-a131-31e71ea5b0e9',
|
|
563
|
+
errorCode: codeObj.deviceErrorCode,
|
|
564
|
+
devices: [{
|
|
565
|
+
deviceId: '8a67806f-fc4d-446b-a131-31e71ea5b010',
|
|
566
|
+
uri: 'https://mobius.webex.com/api/v1/calling/web/',
|
|
567
|
+
status: 'active',
|
|
568
|
+
lastSeen: '2022-04-07T18:00:40Z',
|
|
569
|
+
addresses: ['sip:sipAddress@webex.com']
|
|
570
|
+
}]
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
if (codeObj.customBodyPresent) {
|
|
574
|
+
webexPayload.body = codeObj.body;
|
|
575
|
+
}
|
|
576
|
+
mockErrorEvent = {
|
|
577
|
+
type: codeObj.errorType,
|
|
578
|
+
message: codeObj.message,
|
|
579
|
+
context: logObj
|
|
580
|
+
};
|
|
581
|
+
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
582
|
+
_context8.next = 1;
|
|
583
|
+
return (0, _Utils.handleRegistrationErrors)(webexPayload, mockEmitterCb, logObj, {
|
|
584
|
+
retry429Cb: mock429RetryCb,
|
|
585
|
+
restoreRegCb: mockRestoreCb,
|
|
586
|
+
sessionSupersededCb: mockSessionSupersededCb
|
|
587
|
+
});
|
|
588
|
+
case 1:
|
|
589
|
+
result = _context8.sent;
|
|
590
|
+
expect(result.finalError).toBe(codeObj.finalError);
|
|
591
|
+
if (codeObj.emitterCbExpected) {
|
|
592
|
+
expect(mockEmitterCb).toBeCalledOnceWith(callClientError, codeObj.finalError);
|
|
593
|
+
} else {
|
|
594
|
+
expect(mockEmitterCb).not.toHaveBeenCalled();
|
|
595
|
+
}
|
|
596
|
+
if (codeObj.restoreCbExpected) {
|
|
597
|
+
expect(mockRestoreCb).toBeCalledOnceWith(webexPayload.body, logObj.method);
|
|
598
|
+
} else {
|
|
599
|
+
expect(mockRestoreCb).not.toHaveBeenCalled();
|
|
600
|
+
}
|
|
601
|
+
if (codeObj.retry429CbExpected) {
|
|
602
|
+
expect(mock429RetryCb).toBeCalledOnceWith(codeObj.retryAfter, logObj.method);
|
|
603
|
+
} else {
|
|
604
|
+
expect(mock429RetryCb).not.toHaveBeenCalled();
|
|
605
|
+
}
|
|
606
|
+
if (codeObj.sessionSupersededCbExpected) {
|
|
607
|
+
expect(mockSessionSupersededCb).toBeCalledOnceWith(callClientError);
|
|
608
|
+
} else {
|
|
609
|
+
expect(mockSessionSupersededCb).not.toHaveBeenCalled();
|
|
610
|
+
}
|
|
611
|
+
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(codeObj.statusCode), logObj);
|
|
612
|
+
expect(logSpy).toHaveBeenCalledWith(codeObj.logMsg, logObj);
|
|
613
|
+
case 2:
|
|
614
|
+
case "end":
|
|
615
|
+
return _context8.stop();
|
|
616
|
+
}
|
|
617
|
+
}, _callee8);
|
|
618
|
+
}));
|
|
619
|
+
return function (_x3) {
|
|
620
|
+
return _ref0.apply(this, arguments);
|
|
502
621
|
};
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
622
|
+
}());
|
|
623
|
+
it.each(retryAfterCases)('429 honors $headers', /*#__PURE__*/function () {
|
|
624
|
+
var _ref10 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9(_ref1) {
|
|
625
|
+
var headers, retryAfter, webexPayload;
|
|
626
|
+
return _regenerator.default.wrap(function (_context9) {
|
|
627
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
628
|
+
case 0:
|
|
629
|
+
headers = _ref1.headers, retryAfter = _ref1.retryAfter;
|
|
630
|
+
webexPayload = {
|
|
631
|
+
statusCode: _types2.ERROR_CODE.TOO_MANY_REQUESTS,
|
|
632
|
+
headers: headers
|
|
633
|
+
};
|
|
634
|
+
_context9.next = 1;
|
|
635
|
+
return (0, _Utils.handleRegistrationErrors)(webexPayload, mockEmitterCb, logObj, {
|
|
636
|
+
retry429Cb: mock429RetryCb
|
|
637
|
+
});
|
|
638
|
+
case 1:
|
|
639
|
+
expect(mock429RetryCb).toBeCalledOnceWith(retryAfter, logObj.method);
|
|
640
|
+
expect(mockEmitterCb).not.toHaveBeenCalled();
|
|
641
|
+
case 2:
|
|
642
|
+
case "end":
|
|
643
|
+
return _context9.stop();
|
|
644
|
+
}
|
|
645
|
+
}, _callee9);
|
|
646
|
+
}));
|
|
647
|
+
return function (_x4) {
|
|
648
|
+
return _ref10.apply(this, arguments);
|
|
510
649
|
};
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
650
|
+
}());
|
|
651
|
+
it('verify 409 response for a caller that does not handle a superseded session', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
|
|
652
|
+
var webexPayload, result;
|
|
653
|
+
return _regenerator.default.wrap(function (_context0) {
|
|
654
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
655
|
+
case 0:
|
|
656
|
+
webexPayload = {
|
|
657
|
+
statusCode: _types2.ERROR_CODE.CONFLICT,
|
|
658
|
+
headers: {
|
|
659
|
+
trackingid: 'webex-js-sdk_b5812e58-7246-4a9b-bf64-831bdf13b0cd_31'
|
|
660
|
+
}
|
|
661
|
+
};
|
|
662
|
+
_context0.next = 1;
|
|
663
|
+
return (0, _Utils.handleRegistrationErrors)(webexPayload, mockEmitterCb, logObj, {
|
|
664
|
+
retry429Cb: mock429RetryCb,
|
|
665
|
+
restoreRegCb: mockRestoreCb
|
|
666
|
+
});
|
|
667
|
+
case 1:
|
|
668
|
+
result = _context0.sent;
|
|
669
|
+
expect(result).toStrictEqual({
|
|
670
|
+
finalError: false,
|
|
671
|
+
shouldDisconnect: false
|
|
672
|
+
});
|
|
673
|
+
expect(mockEmitterCb).not.toHaveBeenCalled();
|
|
674
|
+
expect(logSpy).toHaveBeenCalledWith('409 Conflict: ignored, caller does not handle a superseded session', logObj);
|
|
675
|
+
case 2:
|
|
676
|
+
case "end":
|
|
677
|
+
return _context0.stop();
|
|
678
|
+
}
|
|
679
|
+
}, _callee0);
|
|
680
|
+
})));
|
|
529
681
|
});
|
|
530
682
|
describe('CallingClient Error Tests', function () {
|
|
531
683
|
var logSpy = jest.spyOn(_Logger.default, 'warn');
|
|
@@ -536,10 +688,10 @@ describe('CallingClient Error Tests', function () {
|
|
|
536
688
|
beforeEach(function () {
|
|
537
689
|
jest.clearAllMocks();
|
|
538
690
|
});
|
|
539
|
-
it('verify 401 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
691
|
+
it('verify 401 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
540
692
|
var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
|
|
541
|
-
return _regenerator.default.wrap(function (
|
|
542
|
-
while (1) switch (
|
|
693
|
+
return _regenerator.default.wrap(function (_context1) {
|
|
694
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
543
695
|
case 0:
|
|
544
696
|
statusCode = _types2.ERROR_CODE.UNAUTHORIZED;
|
|
545
697
|
message = 'User is unauthorized due to an expired token.';
|
|
@@ -564,24 +716,24 @@ describe('CallingClient Error Tests', function () {
|
|
|
564
716
|
context: logObj
|
|
565
717
|
};
|
|
566
718
|
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
567
|
-
|
|
719
|
+
_context1.next = 1;
|
|
568
720
|
return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
|
|
569
721
|
case 1:
|
|
570
|
-
result =
|
|
722
|
+
result = _context1.sent;
|
|
571
723
|
expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
|
|
572
724
|
expect(result).toBe(finalError);
|
|
573
725
|
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
|
|
574
726
|
expect(logSpy).toHaveBeenCalledWith('401 Unauthorized', logObj);
|
|
575
727
|
case 2:
|
|
576
728
|
case "end":
|
|
577
|
-
return
|
|
729
|
+
return _context1.stop();
|
|
578
730
|
}
|
|
579
|
-
},
|
|
731
|
+
}, _callee1);
|
|
580
732
|
})));
|
|
581
|
-
it('verify 500 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
733
|
+
it('verify 500 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
582
734
|
var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
|
|
583
|
-
return _regenerator.default.wrap(function (
|
|
584
|
-
while (1) switch (
|
|
735
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
736
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
585
737
|
case 0:
|
|
586
738
|
statusCode = _types2.ERROR_CODE.INTERNAL_SERVER_ERROR;
|
|
587
739
|
message = 'An unknown error occurred while placing the request. Wait a moment and try again.';
|
|
@@ -606,24 +758,24 @@ describe('CallingClient Error Tests', function () {
|
|
|
606
758
|
context: logObj
|
|
607
759
|
};
|
|
608
760
|
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
609
|
-
|
|
761
|
+
_context10.next = 1;
|
|
610
762
|
return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
|
|
611
763
|
case 1:
|
|
612
|
-
result =
|
|
764
|
+
result = _context10.sent;
|
|
613
765
|
expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
|
|
614
766
|
expect(result).toBe(finalError);
|
|
615
767
|
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
|
|
616
768
|
expect(logSpy).toHaveBeenCalledWith('500 Internal Server Error', logObj);
|
|
617
769
|
case 2:
|
|
618
770
|
case "end":
|
|
619
|
-
return
|
|
771
|
+
return _context10.stop();
|
|
620
772
|
}
|
|
621
|
-
},
|
|
773
|
+
}, _callee10);
|
|
622
774
|
})));
|
|
623
|
-
it('verify unknown error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
775
|
+
it('verify unknown error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
624
776
|
var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
|
|
625
|
-
return _regenerator.default.wrap(function (
|
|
626
|
-
while (1) switch (
|
|
777
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
778
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
627
779
|
case 0:
|
|
628
780
|
statusCode = 206;
|
|
629
781
|
message = 'Unknown error';
|
|
@@ -648,19 +800,19 @@ describe('CallingClient Error Tests', function () {
|
|
|
648
800
|
context: logObj
|
|
649
801
|
};
|
|
650
802
|
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
651
|
-
|
|
803
|
+
_context11.next = 1;
|
|
652
804
|
return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
|
|
653
805
|
case 1:
|
|
654
|
-
result =
|
|
806
|
+
result = _context11.sent;
|
|
655
807
|
expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
|
|
656
808
|
expect(result).toBe(finalError);
|
|
657
809
|
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
|
|
658
810
|
expect(logSpy).toHaveBeenCalledWith('Unknown Error', logObj);
|
|
659
811
|
case 2:
|
|
660
812
|
case "end":
|
|
661
|
-
return
|
|
813
|
+
return _context11.stop();
|
|
662
814
|
}
|
|
663
|
-
},
|
|
815
|
+
}, _callee11);
|
|
664
816
|
})));
|
|
665
817
|
});
|
|
666
818
|
describe('Call Tests', function () {
|
|
@@ -1208,11 +1360,11 @@ describe('resolveContact tests', function () {
|
|
|
1208
1360
|
}));
|
|
1209
1361
|
});
|
|
1210
1362
|
});
|
|
1211
|
-
it('Resolve by userExternalId - SCIM exception', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1363
|
+
it('Resolve by userExternalId - SCIM exception', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
1212
1364
|
var _callingPartyInfo$use2;
|
|
1213
1365
|
var callingPartyInfo, warnSpy, webexSpy, displayInfo, query;
|
|
1214
|
-
return _regenerator.default.wrap(function (
|
|
1215
|
-
while (1) switch (
|
|
1366
|
+
return _regenerator.default.wrap(function (_context12) {
|
|
1367
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1216
1368
|
case 0:
|
|
1217
1369
|
callingPartyInfo = {};
|
|
1218
1370
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
@@ -1222,10 +1374,10 @@ describe('resolveContact tests', function () {
|
|
|
1222
1374
|
callingPartyInfo.userExternalId = {
|
|
1223
1375
|
$: 'userExternalId'
|
|
1224
1376
|
};
|
|
1225
|
-
|
|
1377
|
+
_context12.next = 1;
|
|
1226
1378
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1227
1379
|
case 1:
|
|
1228
|
-
displayInfo =
|
|
1380
|
+
displayInfo = _context12.sent;
|
|
1229
1381
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
|
|
1230
1382
|
expect(warnSpy).toHaveBeenCalledWith('Error response: - 500', {
|
|
1231
1383
|
file: _constants.UTILS_FILE,
|
|
@@ -1237,15 +1389,15 @@ describe('resolveContact tests', function () {
|
|
|
1237
1389
|
}));
|
|
1238
1390
|
case 2:
|
|
1239
1391
|
case "end":
|
|
1240
|
-
return
|
|
1392
|
+
return _context12.stop();
|
|
1241
1393
|
}
|
|
1242
|
-
},
|
|
1394
|
+
}, _callee12);
|
|
1243
1395
|
})));
|
|
1244
|
-
it('Resolve by userExternalId - totalResults zero', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1396
|
+
it('Resolve by userExternalId - totalResults zero', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
1245
1397
|
var _callingPartyInfo$use3;
|
|
1246
1398
|
var callingPartyInfo, scimResponse, webexSpy, displayInfo, query;
|
|
1247
|
-
return _regenerator.default.wrap(function (
|
|
1248
|
-
while (1) switch (
|
|
1399
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
1400
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1249
1401
|
case 0:
|
|
1250
1402
|
callingPartyInfo = {};
|
|
1251
1403
|
scimResponse = (0, _testUtil.getSampleScimResponse)();
|
|
@@ -1257,10 +1409,10 @@ describe('resolveContact tests', function () {
|
|
|
1257
1409
|
callingPartyInfo.userExternalId = {
|
|
1258
1410
|
$: 'userExternalId'
|
|
1259
1411
|
};
|
|
1260
|
-
|
|
1412
|
+
_context13.next = 1;
|
|
1261
1413
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1262
1414
|
case 1:
|
|
1263
|
-
displayInfo =
|
|
1415
|
+
displayInfo = _context13.sent;
|
|
1264
1416
|
query = scimUrl + encodeURIComponent("id eq \"".concat((_callingPartyInfo$use3 = callingPartyInfo.userExternalId) === null || _callingPartyInfo$use3 === void 0 ? void 0 : _callingPartyInfo$use3.$, "\""));
|
|
1265
1417
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
|
|
1266
1418
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
@@ -1269,15 +1421,15 @@ describe('resolveContact tests', function () {
|
|
|
1269
1421
|
scimResponse.totalResults = '1';
|
|
1270
1422
|
case 2:
|
|
1271
1423
|
case "end":
|
|
1272
|
-
return
|
|
1424
|
+
return _context13.stop();
|
|
1273
1425
|
}
|
|
1274
|
-
},
|
|
1426
|
+
}, _callee13);
|
|
1275
1427
|
})));
|
|
1276
|
-
it('Resolve by userExternalId - no primary number and no phone numbers', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1428
|
+
it('Resolve by userExternalId - no primary number and no phone numbers', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
1277
1429
|
var _callingPartyInfo$use4, _displayInfo, _displayInfo2;
|
|
1278
1430
|
var callingPartyInfo, scimResponse, webexSpy, displayInfo, query, phoneNumbers;
|
|
1279
|
-
return _regenerator.default.wrap(function (
|
|
1280
|
-
while (1) switch (
|
|
1431
|
+
return _regenerator.default.wrap(function (_context14) {
|
|
1432
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1281
1433
|
case 0:
|
|
1282
1434
|
callingPartyInfo = {};
|
|
1283
1435
|
scimResponse = (0, _testUtil.getSampleScimResponse)();
|
|
@@ -1289,10 +1441,10 @@ describe('resolveContact tests', function () {
|
|
|
1289
1441
|
callingPartyInfo.userExternalId = {
|
|
1290
1442
|
$: 'userExternalId'
|
|
1291
1443
|
};
|
|
1292
|
-
|
|
1444
|
+
_context14.next = 1;
|
|
1293
1445
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1294
1446
|
case 1:
|
|
1295
|
-
displayInfo =
|
|
1447
|
+
displayInfo = _context14.sent;
|
|
1296
1448
|
query = scimUrl + encodeURIComponent("id eq \"".concat((_callingPartyInfo$use4 = callingPartyInfo.userExternalId) === null || _callingPartyInfo$use4 === void 0 ? void 0 : _callingPartyInfo$use4.$, "\""));
|
|
1297
1449
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1298
1450
|
uri: query
|
|
@@ -1308,10 +1460,10 @@ describe('resolveContact tests', function () {
|
|
|
1308
1460
|
statusCode: 200,
|
|
1309
1461
|
body: scimResponse
|
|
1310
1462
|
});
|
|
1311
|
-
|
|
1463
|
+
_context14.next = 2;
|
|
1312
1464
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1313
1465
|
case 2:
|
|
1314
|
-
displayInfo =
|
|
1466
|
+
displayInfo = _context14.sent;
|
|
1315
1467
|
expect((_displayInfo2 = displayInfo) === null || _displayInfo2 === void 0 ? void 0 : _displayInfo2.num).toBeUndefined();
|
|
1316
1468
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1317
1469
|
uri: query
|
|
@@ -1319,9 +1471,9 @@ describe('resolveContact tests', function () {
|
|
|
1319
1471
|
scimResponse.Resources[0].phoneNumbers = phoneNumbers;
|
|
1320
1472
|
case 3:
|
|
1321
1473
|
case "end":
|
|
1322
|
-
return
|
|
1474
|
+
return _context14.stop();
|
|
1323
1475
|
}
|
|
1324
|
-
},
|
|
1476
|
+
}, _callee14);
|
|
1325
1477
|
})));
|
|
1326
1478
|
it('Resolve by userExternalId - no photo', function () {
|
|
1327
1479
|
var callingPartyInfo = {};
|
|
@@ -1346,6 +1498,63 @@ describe('resolveContact tests', function () {
|
|
|
1346
1498
|
}));
|
|
1347
1499
|
});
|
|
1348
1500
|
});
|
|
1501
|
+
it('resolveContact escapes SCIM filter injection in userExternalId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
1502
|
+
var callingPartyInfo, injectionPayload, webexSpy, escapedValue, expectedQuery;
|
|
1503
|
+
return _regenerator.default.wrap(function (_context15) {
|
|
1504
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1505
|
+
case 0:
|
|
1506
|
+
callingPartyInfo = {};
|
|
1507
|
+
injectionPayload = 'x" or userName pr "';
|
|
1508
|
+
webexSpy = jest.spyOn(webex, 'request').mockResolvedValueOnce({
|
|
1509
|
+
statusCode: 200,
|
|
1510
|
+
body: (0, _testUtil.getSampleScimResponse)()
|
|
1511
|
+
});
|
|
1512
|
+
callingPartyInfo.userExternalId = {
|
|
1513
|
+
$: injectionPayload
|
|
1514
|
+
};
|
|
1515
|
+
_context15.next = 1;
|
|
1516
|
+
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1517
|
+
case 1:
|
|
1518
|
+
// After escaping: backslash → \\ then double-quote → \"
|
|
1519
|
+
escapedValue = injectionPayload.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
1520
|
+
expectedQuery = scimUrl + encodeURIComponent("id eq \"".concat(escapedValue, "\""));
|
|
1521
|
+
expect(webexSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
1522
|
+
uri: expectedQuery
|
|
1523
|
+
}));
|
|
1524
|
+
case 2:
|
|
1525
|
+
case "end":
|
|
1526
|
+
return _context15.stop();
|
|
1527
|
+
}
|
|
1528
|
+
}, _callee15);
|
|
1529
|
+
})));
|
|
1530
|
+
it('legitimate externalId still resolves', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
1531
|
+
var callingPartyInfo, legitimateId, webexSpy, expectedQuery;
|
|
1532
|
+
return _regenerator.default.wrap(function (_context16) {
|
|
1533
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1534
|
+
case 0:
|
|
1535
|
+
callingPartyInfo = {};
|
|
1536
|
+
legitimateId = '69fde5ad-fb8b-4a1b-9998-b0999e95719b';
|
|
1537
|
+
webexSpy = jest.spyOn(webex, 'request').mockResolvedValueOnce({
|
|
1538
|
+
statusCode: 200,
|
|
1539
|
+
body: (0, _testUtil.getSampleScimResponse)()
|
|
1540
|
+
});
|
|
1541
|
+
callingPartyInfo.userExternalId = {
|
|
1542
|
+
$: legitimateId
|
|
1543
|
+
};
|
|
1544
|
+
_context16.next = 1;
|
|
1545
|
+
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1546
|
+
case 1:
|
|
1547
|
+
// A UUID contains no SCIM metacharacters; the query string is unchanged
|
|
1548
|
+
expectedQuery = scimUrl + encodeURIComponent("id eq \"".concat(legitimateId, "\""));
|
|
1549
|
+
expect(webexSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
1550
|
+
uri: expectedQuery
|
|
1551
|
+
}));
|
|
1552
|
+
case 2:
|
|
1553
|
+
case "end":
|
|
1554
|
+
return _context16.stop();
|
|
1555
|
+
}
|
|
1556
|
+
}, _callee16);
|
|
1557
|
+
})));
|
|
1349
1558
|
it('Resolve with minimal response from SCIM', function () {
|
|
1350
1559
|
var callingPartyInfo = {};
|
|
1351
1560
|
var scimResponse = (0, _testUtil.getSampleMinimumScimResponse)();
|
|
@@ -1386,10 +1595,10 @@ describe('resolveContact tests', function () {
|
|
|
1386
1595
|
}));
|
|
1387
1596
|
});
|
|
1388
1597
|
});
|
|
1389
|
-
it('Resolve by name - Empty Info', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1598
|
+
it('Resolve by name - Empty Info', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
1390
1599
|
var callingPartyInfo, peopleListResponse, items, webexSpy, displayInfo;
|
|
1391
|
-
return _regenerator.default.wrap(function (
|
|
1392
|
-
while (1) switch (
|
|
1600
|
+
return _regenerator.default.wrap(function (_context17) {
|
|
1601
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1393
1602
|
case 0:
|
|
1394
1603
|
callingPartyInfo = {};
|
|
1395
1604
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1399,10 +1608,10 @@ describe('resolveContact tests', function () {
|
|
|
1399
1608
|
callingPartyInfo.name = {
|
|
1400
1609
|
$: 'Name'
|
|
1401
1610
|
};
|
|
1402
|
-
|
|
1611
|
+
_context17.next = 1;
|
|
1403
1612
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1404
1613
|
case 1:
|
|
1405
|
-
displayInfo =
|
|
1614
|
+
displayInfo = _context17.sent;
|
|
1406
1615
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
|
|
1407
1616
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1408
1617
|
displayName: 'Name'
|
|
@@ -1410,15 +1619,15 @@ describe('resolveContact tests', function () {
|
|
|
1410
1619
|
peopleListResponse.items = items;
|
|
1411
1620
|
case 2:
|
|
1412
1621
|
case "end":
|
|
1413
|
-
return
|
|
1622
|
+
return _context17.stop();
|
|
1414
1623
|
}
|
|
1415
|
-
},
|
|
1624
|
+
}, _callee17);
|
|
1416
1625
|
})));
|
|
1417
|
-
it('Resolve by name - ID as plain UUID instead of part of URI', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1626
|
+
it('Resolve by name - ID as plain UUID instead of part of URI', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
1418
1627
|
var _displayInfo3, _displayInfo4, _displayInfo5, _displayInfo6, _displayInfo7, _displayInfo8;
|
|
1419
1628
|
var callingPartyInfo, peopleListResponse, id, webexSpy, displayInfo;
|
|
1420
|
-
return _regenerator.default.wrap(function (
|
|
1421
|
-
while (1) switch (
|
|
1629
|
+
return _regenerator.default.wrap(function (_context18) {
|
|
1630
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1422
1631
|
case 0:
|
|
1423
1632
|
callingPartyInfo = {};
|
|
1424
1633
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1429,10 +1638,10 @@ describe('resolveContact tests', function () {
|
|
|
1429
1638
|
callingPartyInfo.name = {
|
|
1430
1639
|
$: 'Name'
|
|
1431
1640
|
};
|
|
1432
|
-
|
|
1641
|
+
_context18.next = 1;
|
|
1433
1642
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1434
1643
|
case 1:
|
|
1435
|
-
displayInfo =
|
|
1644
|
+
displayInfo = _context18.sent;
|
|
1436
1645
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1437
1646
|
displayName: 'Name'
|
|
1438
1647
|
}));
|
|
@@ -1445,10 +1654,10 @@ describe('resolveContact tests', function () {
|
|
|
1445
1654
|
/* Also test empty id */
|
|
1446
1655
|
peopleListResponse.items[0].id = '';
|
|
1447
1656
|
webex.people.list.mockResolvedValueOnce(peopleListResponse);
|
|
1448
|
-
|
|
1657
|
+
_context18.next = 2;
|
|
1449
1658
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1450
1659
|
case 2:
|
|
1451
|
-
displayInfo =
|
|
1660
|
+
displayInfo = _context18.sent;
|
|
1452
1661
|
expect((_displayInfo7 = displayInfo) === null || _displayInfo7 === void 0 ? void 0 : _displayInfo7.id).toStrictEqual('');
|
|
1453
1662
|
expect((_displayInfo8 = displayInfo) === null || _displayInfo8 === void 0 ? void 0 : _displayInfo8.name).toStrictEqual(peopleListResponse.items[0].displayName);
|
|
1454
1663
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
@@ -1457,14 +1666,14 @@ describe('resolveContact tests', function () {
|
|
|
1457
1666
|
peopleListResponse.items[0].id = id;
|
|
1458
1667
|
case 3:
|
|
1459
1668
|
case "end":
|
|
1460
|
-
return
|
|
1669
|
+
return _context18.stop();
|
|
1461
1670
|
}
|
|
1462
|
-
},
|
|
1671
|
+
}, _callee18);
|
|
1463
1672
|
})));
|
|
1464
|
-
it('Resolve by name - Phone numbers no match for type - work', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1673
|
+
it('Resolve by name - Phone numbers no match for type - work', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
1465
1674
|
var callingPartyInfo, peopleListResponse, phoneNumbers, webexSpy, displayInfo;
|
|
1466
|
-
return _regenerator.default.wrap(function (
|
|
1467
|
-
while (1) switch (
|
|
1675
|
+
return _regenerator.default.wrap(function (_context19) {
|
|
1676
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1468
1677
|
case 0:
|
|
1469
1678
|
callingPartyInfo = {};
|
|
1470
1679
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1475,10 +1684,10 @@ describe('resolveContact tests', function () {
|
|
|
1475
1684
|
callingPartyInfo.name = {
|
|
1476
1685
|
$: 'Name'
|
|
1477
1686
|
};
|
|
1478
|
-
|
|
1687
|
+
_context19.next = 1;
|
|
1479
1688
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1480
1689
|
case 1:
|
|
1481
|
-
displayInfo =
|
|
1690
|
+
displayInfo = _context19.sent;
|
|
1482
1691
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toStrictEqual(peopleListResponse.items[0].displayName);
|
|
1483
1692
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.num).toStrictEqual(peopleListResponse.items[0].phoneNumbers[0].value);
|
|
1484
1693
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.avatarSrc).toStrictEqual(peopleListResponse.items[0].avatar);
|
|
@@ -1488,14 +1697,14 @@ describe('resolveContact tests', function () {
|
|
|
1488
1697
|
peopleListResponse.items[0].phoneNumbers = phoneNumbers;
|
|
1489
1698
|
case 2:
|
|
1490
1699
|
case "end":
|
|
1491
|
-
return
|
|
1700
|
+
return _context19.stop();
|
|
1492
1701
|
}
|
|
1493
|
-
},
|
|
1702
|
+
}, _callee19);
|
|
1494
1703
|
})));
|
|
1495
|
-
it('Resolve by name - Phone numbers empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1704
|
+
it('Resolve by name - Phone numbers empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
1496
1705
|
var callingPartyInfo, peopleListResponse, phoneNumbers, webexSpy, displayInfo;
|
|
1497
|
-
return _regenerator.default.wrap(function (
|
|
1498
|
-
while (1) switch (
|
|
1706
|
+
return _regenerator.default.wrap(function (_context20) {
|
|
1707
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1499
1708
|
case 0:
|
|
1500
1709
|
callingPartyInfo = {};
|
|
1501
1710
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1505,10 +1714,10 @@ describe('resolveContact tests', function () {
|
|
|
1505
1714
|
callingPartyInfo.name = {
|
|
1506
1715
|
$: 'Name'
|
|
1507
1716
|
};
|
|
1508
|
-
|
|
1717
|
+
_context20.next = 1;
|
|
1509
1718
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1510
1719
|
case 1:
|
|
1511
|
-
displayInfo =
|
|
1720
|
+
displayInfo = _context20.sent;
|
|
1512
1721
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1513
1722
|
displayName: 'Name'
|
|
1514
1723
|
}));
|
|
@@ -1518,9 +1727,9 @@ describe('resolveContact tests', function () {
|
|
|
1518
1727
|
peopleListResponse.items[0].phoneNumbers = phoneNumbers;
|
|
1519
1728
|
case 2:
|
|
1520
1729
|
case "end":
|
|
1521
|
-
return
|
|
1730
|
+
return _context20.stop();
|
|
1522
1731
|
}
|
|
1523
|
-
},
|
|
1732
|
+
}, _callee20);
|
|
1524
1733
|
})));
|
|
1525
1734
|
});
|
|
1526
1735
|
describe('Store and Fetch voicemail tests', function () {
|
|
@@ -1547,6 +1756,30 @@ describe('Store and Fetch voicemail tests', function () {
|
|
|
1547
1756
|
return vmListStorage[key];
|
|
1548
1757
|
});
|
|
1549
1758
|
});
|
|
1759
|
+
it('storeVoicemailList/fetchVoicemailList JSDoc omits encrypted/decrypted labeling', function () {
|
|
1760
|
+
var utilsSource = _fs.default.readFileSync(_path.default.resolve(__dirname, 'Utils.ts'), 'utf8');
|
|
1761
|
+
var extractJsDoc = function extractJsDoc(functionName) {
|
|
1762
|
+
var exportIndex = utilsSource.indexOf("export function ".concat(functionName, "("));
|
|
1763
|
+
if (exportIndex === -1) {
|
|
1764
|
+
return '';
|
|
1765
|
+
}
|
|
1766
|
+
var beforeExport = utilsSource.slice(0, exportIndex);
|
|
1767
|
+
var jsDocStart = beforeExport.lastIndexOf('/**');
|
|
1768
|
+
var jsDocEnd = beforeExport.lastIndexOf('*/');
|
|
1769
|
+
if (jsDocStart === -1 || jsDocEnd === -1 || jsDocEnd < jsDocStart) {
|
|
1770
|
+
return '';
|
|
1771
|
+
}
|
|
1772
|
+
return beforeExport.slice(jsDocStart, jsDocEnd + 2);
|
|
1773
|
+
};
|
|
1774
|
+
var storeJsDoc = extractJsDoc('storeVoicemailList');
|
|
1775
|
+
var fetchJsDoc = extractJsDoc('fetchVoicemailList');
|
|
1776
|
+
expect(storeJsDoc).not.toEqual('');
|
|
1777
|
+
expect(fetchJsDoc).not.toEqual('');
|
|
1778
|
+
expect(storeJsDoc.toLowerCase()).not.toContain('encrypted');
|
|
1779
|
+
expect(storeJsDoc.toLowerCase()).not.toContain('decrypted');
|
|
1780
|
+
expect(fetchJsDoc.toLowerCase()).not.toContain('encrypted');
|
|
1781
|
+
expect(fetchJsDoc.toLowerCase()).not.toContain('decrypted');
|
|
1782
|
+
});
|
|
1550
1783
|
it('verify saving Voicemails in session storage', function () {
|
|
1551
1784
|
var voicemailList = _voicemailFixture.getVoicemailListJsonWXC.body.VoiceMessagingMessages.messageInfoList.messageInfo;
|
|
1552
1785
|
(0, _Utils.storeVoicemailList)(dummyContext, voicemailList);
|
|
@@ -1638,40 +1871,40 @@ describe('Infer id from UUID Tests', function () {
|
|
|
1638
1871
|
});
|
|
1639
1872
|
});
|
|
1640
1873
|
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
|
|
1874
|
+
it('verify invalid calling backend ucm for xsi endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
1642
1875
|
var _t;
|
|
1643
|
-
return _regenerator.default.wrap(function (
|
|
1644
|
-
while (1) switch (
|
|
1876
|
+
return _regenerator.default.wrap(function (_context21) {
|
|
1877
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1645
1878
|
case 0:
|
|
1646
1879
|
_t = expect;
|
|
1647
|
-
|
|
1880
|
+
_context21.next = 1;
|
|
1648
1881
|
return (0, _Utils.getXsiActionEndpoint)(webex, {
|
|
1649
1882
|
file: 'testFile',
|
|
1650
1883
|
method: 'testMethod'
|
|
1651
1884
|
}, _types.CALLING_BACKEND.UCM);
|
|
1652
1885
|
case 1:
|
|
1653
|
-
_t(
|
|
1886
|
+
_t(_context21.sent).toBeInstanceOf(Error);
|
|
1654
1887
|
case 2:
|
|
1655
1888
|
case "end":
|
|
1656
|
-
return
|
|
1889
|
+
return _context21.stop();
|
|
1657
1890
|
}
|
|
1658
|
-
},
|
|
1891
|
+
}, _callee21);
|
|
1659
1892
|
})));
|
|
1660
|
-
it('verify invalid calling backend wxc for vg endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1893
|
+
it('verify invalid calling backend wxc for vg endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
1661
1894
|
var _t2;
|
|
1662
|
-
return _regenerator.default.wrap(function (
|
|
1663
|
-
while (1) switch (
|
|
1895
|
+
return _regenerator.default.wrap(function (_context22) {
|
|
1896
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1664
1897
|
case 0:
|
|
1665
1898
|
_t2 = expect;
|
|
1666
|
-
|
|
1899
|
+
_context22.next = 1;
|
|
1667
1900
|
return (0, _Utils.getVgActionEndpoint)(webex, _types.CALLING_BACKEND.WXC);
|
|
1668
1901
|
case 1:
|
|
1669
|
-
_t2(
|
|
1902
|
+
_t2(_context22.sent).toBeInstanceOf(Error);
|
|
1670
1903
|
case 2:
|
|
1671
1904
|
case "end":
|
|
1672
|
-
return
|
|
1905
|
+
return _context22.stop();
|
|
1673
1906
|
}
|
|
1674
|
-
},
|
|
1907
|
+
}, _callee22);
|
|
1675
1908
|
})));
|
|
1676
1909
|
});
|
|
1677
1910
|
describe('Get XSI Action Endpoint tests', function () {
|
|
@@ -1689,10 +1922,91 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1689
1922
|
file: 'testFile',
|
|
1690
1923
|
method: 'testMethod'
|
|
1691
1924
|
};
|
|
1692
|
-
|
|
1925
|
+
var expectedXsiEndpoint = 'https://api-proxy-si.broadcloudpbx.net/com.broadsoft.xsi-actions';
|
|
1926
|
+
beforeEach(function () {
|
|
1927
|
+
mockWebex.request.mockClear();
|
|
1928
|
+
});
|
|
1929
|
+
it('should return xsiEndpoint for WXC backend using _serviceUrls.hydra', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
1930
|
+
var hydraEndpoint, wxcWebex, result;
|
|
1931
|
+
return _regenerator.default.wrap(function (_context23) {
|
|
1932
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1933
|
+
case 0:
|
|
1934
|
+
hydraEndpoint = 'https://hydra-a.wbx2.com/v1/';
|
|
1935
|
+
wxcWebex = {
|
|
1936
|
+
request: jest.fn().mockResolvedValue({
|
|
1937
|
+
statusCode: 200,
|
|
1938
|
+
body: _testFixtures.xsiEndpointUrlResponse
|
|
1939
|
+
}),
|
|
1940
|
+
internal: {
|
|
1941
|
+
services: {
|
|
1942
|
+
_serviceUrls: {
|
|
1943
|
+
hydra: hydraEndpoint
|
|
1944
|
+
},
|
|
1945
|
+
_activeServices: {
|
|
1946
|
+
hydra: 'urn:TEAM:us-east-2_a:hydra'
|
|
1947
|
+
},
|
|
1948
|
+
get: jest.fn()
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
};
|
|
1952
|
+
_context23.next = 1;
|
|
1953
|
+
return (0, _Utils.getXsiActionEndpoint)(wxcWebex, loggerContext, _types.CALLING_BACKEND.WXC);
|
|
1954
|
+
case 1:
|
|
1955
|
+
result = _context23.sent;
|
|
1956
|
+
expect(wxcWebex.request).toBeCalledOnceWith({
|
|
1957
|
+
method: _types.HTTP_METHODS.GET,
|
|
1958
|
+
uri: "".concat(hydraEndpoint, "/").concat(_constants2.XSI_ACTION_ENDPOINT_ORG_URL_PARAM)
|
|
1959
|
+
});
|
|
1960
|
+
expect(result).toBe(expectedXsiEndpoint);
|
|
1961
|
+
expect(wxcWebex.internal.services.get).not.toHaveBeenCalled();
|
|
1962
|
+
case 2:
|
|
1963
|
+
case "end":
|
|
1964
|
+
return _context23.stop();
|
|
1965
|
+
}
|
|
1966
|
+
}, _callee23);
|
|
1967
|
+
})));
|
|
1968
|
+
it('should return xsiEndpoint for WXC backend using services.get when _serviceUrls is undefined', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
1969
|
+
var hydraEndpoint, activeHydraCluster, wxcWebex, result;
|
|
1970
|
+
return _regenerator.default.wrap(function (_context24) {
|
|
1971
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1972
|
+
case 0:
|
|
1973
|
+
hydraEndpoint = 'https://hydra-a.wbx2.com/v1/';
|
|
1974
|
+
activeHydraCluster = 'urn:TEAM:us-east-2_a:hydra';
|
|
1975
|
+
wxcWebex = {
|
|
1976
|
+
request: jest.fn().mockResolvedValue({
|
|
1977
|
+
statusCode: 200,
|
|
1978
|
+
body: _testFixtures.xsiEndpointUrlResponse
|
|
1979
|
+
}),
|
|
1980
|
+
internal: {
|
|
1981
|
+
services: {
|
|
1982
|
+
_serviceUrls: undefined,
|
|
1983
|
+
_activeServices: {
|
|
1984
|
+
hydra: activeHydraCluster
|
|
1985
|
+
},
|
|
1986
|
+
get: jest.fn().mockReturnValue(hydraEndpoint)
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
};
|
|
1990
|
+
_context24.next = 1;
|
|
1991
|
+
return (0, _Utils.getXsiActionEndpoint)(wxcWebex, loggerContext, _types.CALLING_BACKEND.WXC);
|
|
1992
|
+
case 1:
|
|
1993
|
+
result = _context24.sent;
|
|
1994
|
+
expect(wxcWebex.internal.services.get).toBeCalledOnceWith(activeHydraCluster);
|
|
1995
|
+
expect(wxcWebex.request).toBeCalledOnceWith({
|
|
1996
|
+
method: _types.HTTP_METHODS.GET,
|
|
1997
|
+
uri: "".concat(hydraEndpoint, "/").concat(_constants2.XSI_ACTION_ENDPOINT_ORG_URL_PARAM)
|
|
1998
|
+
});
|
|
1999
|
+
expect(result).toBe(expectedXsiEndpoint);
|
|
2000
|
+
case 2:
|
|
2001
|
+
case "end":
|
|
2002
|
+
return _context24.stop();
|
|
2003
|
+
}
|
|
2004
|
+
}, _callee24);
|
|
2005
|
+
})));
|
|
2006
|
+
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
1693
2007
|
var mockResponse, xsiEndpoint;
|
|
1694
|
-
return _regenerator.default.wrap(function (
|
|
1695
|
-
while (1) switch (
|
|
2008
|
+
return _regenerator.default.wrap(function (_context25) {
|
|
2009
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1696
2010
|
case 0:
|
|
1697
2011
|
mockResponse = {
|
|
1698
2012
|
body: {
|
|
@@ -1704,22 +2018,22 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1704
2018
|
}
|
|
1705
2019
|
};
|
|
1706
2020
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1707
|
-
|
|
2021
|
+
_context25.next = 1;
|
|
1708
2022
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1709
2023
|
case 1:
|
|
1710
|
-
xsiEndpoint =
|
|
2024
|
+
xsiEndpoint = _context25.sent;
|
|
1711
2025
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1712
2026
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1713
2027
|
case 2:
|
|
1714
2028
|
case "end":
|
|
1715
|
-
return
|
|
2029
|
+
return _context25.stop();
|
|
1716
2030
|
}
|
|
1717
|
-
},
|
|
2031
|
+
}, _callee25);
|
|
1718
2032
|
})));
|
|
1719
|
-
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2033
|
+
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
1720
2034
|
var mockResponse, xsiEndpoint;
|
|
1721
|
-
return _regenerator.default.wrap(function (
|
|
1722
|
-
while (1) switch (
|
|
2035
|
+
return _regenerator.default.wrap(function (_context26) {
|
|
2036
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1723
2037
|
case 0:
|
|
1724
2038
|
mockResponse = {
|
|
1725
2039
|
body: {
|
|
@@ -1731,22 +2045,22 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1731
2045
|
}
|
|
1732
2046
|
};
|
|
1733
2047
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1734
|
-
|
|
2048
|
+
_context26.next = 1;
|
|
1735
2049
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1736
2050
|
case 1:
|
|
1737
|
-
xsiEndpoint =
|
|
2051
|
+
xsiEndpoint = _context26.sent;
|
|
1738
2052
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1739
2053
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1740
2054
|
case 2:
|
|
1741
2055
|
case "end":
|
|
1742
|
-
return
|
|
2056
|
+
return _context26.stop();
|
|
1743
2057
|
}
|
|
1744
|
-
},
|
|
2058
|
+
}, _callee26);
|
|
1745
2059
|
})));
|
|
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
|
|
2060
|
+
it('should return xsiEndpoint for BWRKS backend when URL does not end with any version', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
|
|
1747
2061
|
var mockResponse, xsiEndpoint;
|
|
1748
|
-
return _regenerator.default.wrap(function (
|
|
1749
|
-
while (1) switch (
|
|
2062
|
+
return _regenerator.default.wrap(function (_context27) {
|
|
2063
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1750
2064
|
case 0:
|
|
1751
2065
|
mockResponse = {
|
|
1752
2066
|
body: {
|
|
@@ -1758,67 +2072,19 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1758
2072
|
}
|
|
1759
2073
|
};
|
|
1760
2074
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1761
|
-
|
|
2075
|
+
_context27.next = 1;
|
|
1762
2076
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1763
2077
|
case 1:
|
|
1764
|
-
xsiEndpoint =
|
|
2078
|
+
xsiEndpoint = _context27.sent;
|
|
1765
2079
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1766
2080
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1767
2081
|
case 2:
|
|
1768
2082
|
case "end":
|
|
1769
|
-
return
|
|
2083
|
+
return _context27.stop();
|
|
1770
2084
|
}
|
|
1771
|
-
},
|
|
2085
|
+
}, _callee27);
|
|
1772
2086
|
})));
|
|
1773
2087
|
});
|
|
1774
|
-
describe('modifySdpForIPv4', function () {
|
|
1775
|
-
it('should return original SDP if input is empty', function () {
|
|
1776
|
-
expect((0, _Utils.modifySdpForIPv4)('')).toBe('');
|
|
1777
|
-
});
|
|
1778
|
-
it('should return original SDP if there is no IPv6 c= line', function () {
|
|
1779
|
-
var sdp = "v=0\no=- 12345 67890 IN IP4 192.168.1.1\n\ns=Test Session";
|
|
1780
|
-
expect((0, _Utils.modifySdpForIPv4)(sdp)).toEqual(sdp);
|
|
1781
|
-
});
|
|
1782
|
-
it('should replace IPv6 c= line with default IPv4 if no IPv4 candidate exists', function () {
|
|
1783
|
-
var sdp = "v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n a=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host";
|
|
1784
|
-
var expectedSdp = "v=0\no=- 12345 67890 IN IP6 2001:db8::1\ns=Test Session\nc=IN IP4 192.1.1.1\na=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host\na=candidate:2 1 UDP 2122260223 192.1.1.1 3478 typ host generation 0 network-id 1 network-cost 10";
|
|
1785
|
-
var result = (0, _Utils.modifySdpForIPv4)(sdp);
|
|
1786
|
-
expect(result).toEqual(expectedSdp);
|
|
1787
|
-
});
|
|
1788
|
-
it('should replace IPv6 c= line with an existing IPv4 candidate address', function () {
|
|
1789
|
-
var sdp = "v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n a=candidate:1 1 UDP 2122260223 192.168.1.2 3478 typ host";
|
|
1790
|
-
var expectedSdp = "v=0\no=- 12345 67890 IN IP6 2001:db8::1\ns=Test Session\nc=IN IP4 192.168.1.2\na=candidate:1 1 UDP 2122260223 192.168.1.2 3478 typ host";
|
|
1791
|
-
expect((0, _Utils.modifySdpForIPv4)(sdp).trim()).toEqual(expectedSdp.trim());
|
|
1792
|
-
});
|
|
1793
|
-
it('should correctly handle both UDP and TCP candidates by adding only one IPv4 candidate UDP first', function () {
|
|
1794
|
-
var sdp = "v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n a=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host\n a=candidate:2 1 TCP 2122260223 2001:db8::2 3479 typ host";
|
|
1795
|
-
var expectedSdp = "v=0\no=- 12345 67890 IN IP6 2001:db8::1\ns=Test Session\nc=IN IP4 192.1.1.1\na=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host\na=candidate:2 1 UDP 2122260223 192.1.1.1 3478 typ host generation 0 network-id 1 network-cost 10\na=candidate:2 1 TCP 2122260223 2001:db8::2 3479 typ host\n";
|
|
1796
|
-
expect((0, _Utils.modifySdpForIPv4)(sdp).trim()).toEqual(expectedSdp.trim());
|
|
1797
|
-
});
|
|
1798
|
-
it('should correctly handle both UDP and TCP candidates by adding only one IPv4 candidate TCP first', function () {
|
|
1799
|
-
var sdp = "v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n a=candidate:1 1 TCP 2122260223 2001:db8::2 3479 typ host\n a=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host";
|
|
1800
|
-
var expectedSdp = "v=0\no=- 12345 67890 IN IP6 2001:db8::1\ns=Test Session\nc=IN IP4 192.1.1.1\na=candidate:1 1 TCP 2122260223 2001:db8::2 3479 typ host\na=candidate:2 1 TCP 2122260223 192.1.1.1 3479 typ host generation 0 network-id 1 network-cost 10\na=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host";
|
|
1801
|
-
expect((0, _Utils.modifySdpForIPv4)(sdp).trim()).toEqual(expectedSdp.trim());
|
|
1802
|
-
});
|
|
1803
|
-
it('should replace all IPv6 c= line if multiple exist', function () {
|
|
1804
|
-
var sdp = "v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n c=IN IP6 2001:db8::2\n a=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host";
|
|
1805
|
-
var expectedSdp = "v=0\no=- 12345 67890 IN IP6 2001:db8::1\ns=Test Session\nc=IN IP4 192.1.1.1\nc=IN IP4 192.1.1.1\na=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host\na=candidate:2 1 UDP 2122260223 192.1.1.1 3478 typ host generation 0 network-id 1 network-cost 10";
|
|
1806
|
-
expect((0, _Utils.modifySdpForIPv4)(sdp).trim()).toEqual(expectedSdp.trim());
|
|
1807
|
-
});
|
|
1808
|
-
it('should not modify SDP if IPv6 c= line is absent and IPv4 candidate already exists', function () {
|
|
1809
|
-
var sdp = "v=0\no=- 12345 67890 IN IP4 192.168.1.1\ns=Test Session\nc=IN IP4 192.168.1.1\na=candidate:1 1 UDP 2122260223 192.168.1.1 3478 typ host";
|
|
1810
|
-
expect((0, _Utils.modifySdpForIPv4)(sdp).trim()).toEqual(sdp.trim());
|
|
1811
|
-
});
|
|
1812
|
-
it('should handle malformed SDP gracefully and return unmodified input', function () {
|
|
1813
|
-
var malformedSdp = "random text without proper format";
|
|
1814
|
-
expect((0, _Utils.modifySdpForIPv4)(malformedSdp).trim()).toEqual(malformedSdp.trim());
|
|
1815
|
-
});
|
|
1816
|
-
it('should handle an SDP with both IP6 and IP4 c= lines correctly', function () {
|
|
1817
|
-
var sdp = "v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n c=IN IP4 192.168.1.3\n a=candidate:1 1 UDP 2122260223 192.168.1.3 3478 typ host";
|
|
1818
|
-
var expectedSdp = "v=0\no=- 12345 67890 IN IP6 2001:db8::1\ns=Test Session\nc=IN IP4 192.168.1.3\nc=IN IP4 192.168.1.3\na=candidate:1 1 UDP 2122260223 192.168.1.3 3478 typ host";
|
|
1819
|
-
expect((0, _Utils.modifySdpForIPv4)(sdp).trim()).toEqual(expectedSdp.trim());
|
|
1820
|
-
});
|
|
1821
|
-
});
|
|
1822
2088
|
describe('uploadLogs', function () {
|
|
1823
2089
|
var submitLogsMock;
|
|
1824
2090
|
beforeEach(function () {
|
|
@@ -1838,19 +2104,19 @@ describe('uploadLogs', function () {
|
|
|
1838
2104
|
afterEach(function () {
|
|
1839
2105
|
jest.clearAllMocks();
|
|
1840
2106
|
});
|
|
1841
|
-
it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2107
|
+
it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
|
|
1842
2108
|
var mockMetaData, logSpy, result;
|
|
1843
|
-
return _regenerator.default.wrap(function (
|
|
1844
|
-
while (1) switch (
|
|
2109
|
+
return _regenerator.default.wrap(function (_context28) {
|
|
2110
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1845
2111
|
case 0:
|
|
1846
2112
|
mockMetaData = {
|
|
1847
2113
|
correlationId: 'test-correlation'
|
|
1848
2114
|
};
|
|
1849
2115
|
logSpy = jest.spyOn(_Logger.default, 'info');
|
|
1850
|
-
|
|
2116
|
+
_context28.next = 1;
|
|
1851
2117
|
return (0, _Utils.uploadLogs)(mockMetaData, true);
|
|
1852
2118
|
case 1:
|
|
1853
|
-
result =
|
|
2119
|
+
result = _context28.sent;
|
|
1854
2120
|
expect(result).toEqual({
|
|
1855
2121
|
trackingid: '1234',
|
|
1856
2122
|
feedbackId: 'mocked-uuid-12345'
|
|
@@ -1883,14 +2149,14 @@ describe('uploadLogs', function () {
|
|
|
1883
2149
|
});
|
|
1884
2150
|
case 2:
|
|
1885
2151
|
case "end":
|
|
1886
|
-
return
|
|
2152
|
+
return _context28.stop();
|
|
1887
2153
|
}
|
|
1888
|
-
},
|
|
2154
|
+
}, _callee28);
|
|
1889
2155
|
})));
|
|
1890
|
-
it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2156
|
+
it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
|
|
1891
2157
|
var mockMetaData, mockError, logSpy, _t3;
|
|
1892
|
-
return _regenerator.default.wrap(function (
|
|
1893
|
-
while (1) switch (
|
|
2158
|
+
return _regenerator.default.wrap(function (_context29) {
|
|
2159
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1894
2160
|
case 0:
|
|
1895
2161
|
mockMetaData = {
|
|
1896
2162
|
correlationId: 'test-correlation'
|
|
@@ -1898,17 +2164,17 @@ describe('uploadLogs', function () {
|
|
|
1898
2164
|
mockError = new Error('Upload failed'); // Mock the submitLogs to fail
|
|
1899
2165
|
submitLogsMock.mockRejectedValueOnce(mockError);
|
|
1900
2166
|
logSpy = jest.spyOn(_Logger.default, 'error');
|
|
1901
|
-
|
|
1902
|
-
|
|
2167
|
+
_context29.prev = 1;
|
|
2168
|
+
_context29.next = 2;
|
|
1903
2169
|
return (0, _Utils.uploadLogs)(mockMetaData, true);
|
|
1904
2170
|
case 2:
|
|
1905
2171
|
// If we get here, the test should fail since we expected an exception
|
|
1906
2172
|
expect(true).toBe(false); // This will fail the test if no exception is thrown
|
|
1907
|
-
|
|
2173
|
+
_context29.next = 4;
|
|
1908
2174
|
break;
|
|
1909
2175
|
case 3:
|
|
1910
|
-
|
|
1911
|
-
_t3 =
|
|
2176
|
+
_context29.prev = 3;
|
|
2177
|
+
_t3 = _context29["catch"](1);
|
|
1912
2178
|
expect(_t3).toBe(mockError);
|
|
1913
2179
|
expect(logSpy).toHaveBeenCalledWith("Failed to upload Logs ".concat((0, _stringify.default)(_t3)), {
|
|
1914
2180
|
file: _constants.UTILS_FILE,
|
|
@@ -1935,14 +2201,14 @@ describe('uploadLogs', function () {
|
|
|
1935
2201
|
});
|
|
1936
2202
|
case 4:
|
|
1937
2203
|
case "end":
|
|
1938
|
-
return
|
|
2204
|
+
return _context29.stop();
|
|
1939
2205
|
}
|
|
1940
|
-
},
|
|
2206
|
+
}, _callee29, null, [[1, 3]]);
|
|
1941
2207
|
})));
|
|
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
|
|
2208
|
+
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 _callee30() {
|
|
1943
2209
|
var mockMetaData, mockError, logSpy, result;
|
|
1944
|
-
return _regenerator.default.wrap(function (
|
|
1945
|
-
while (1) switch (
|
|
2210
|
+
return _regenerator.default.wrap(function (_context30) {
|
|
2211
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
1946
2212
|
case 0:
|
|
1947
2213
|
mockMetaData = {
|
|
1948
2214
|
correlationId: 'test-correlation',
|
|
@@ -1951,10 +2217,10 @@ describe('uploadLogs', function () {
|
|
|
1951
2217
|
mockError = new Error('Upload failed'); // Mock the submitLogs to fail
|
|
1952
2218
|
submitLogsMock.mockRejectedValueOnce(mockError);
|
|
1953
2219
|
logSpy = jest.spyOn(_Logger.default, 'error');
|
|
1954
|
-
|
|
2220
|
+
_context30.next = 1;
|
|
1955
2221
|
return (0, _Utils.uploadLogs)(mockMetaData, false);
|
|
1956
2222
|
case 1:
|
|
1957
|
-
result =
|
|
2223
|
+
result = _context30.sent;
|
|
1958
2224
|
expect(result).toBeUndefined();
|
|
1959
2225
|
expect(logSpy).toHaveBeenCalledWith("Failed to upload Logs ".concat((0, _stringify.default)(mockError)), {
|
|
1960
2226
|
file: _constants.UTILS_FILE,
|
|
@@ -1981,9 +2247,88 @@ describe('uploadLogs', function () {
|
|
|
1981
2247
|
});
|
|
1982
2248
|
case 2:
|
|
1983
2249
|
case "end":
|
|
1984
|
-
return
|
|
2250
|
+
return _context30.stop();
|
|
1985
2251
|
}
|
|
1986
|
-
},
|
|
2252
|
+
}, _callee30);
|
|
1987
2253
|
})));
|
|
1988
2254
|
});
|
|
2255
|
+
describe('resolveCallingBackend', function () {
|
|
2256
|
+
var createDevice = function createDevice(callingBehavior, entitlementKeys) {
|
|
2257
|
+
return {
|
|
2258
|
+
url: 'https://wdm.example.com/devices/123',
|
|
2259
|
+
userId: 'user-id',
|
|
2260
|
+
orgId: 'org-id',
|
|
2261
|
+
version: '1.0',
|
|
2262
|
+
callingBehavior: callingBehavior,
|
|
2263
|
+
features: {
|
|
2264
|
+
developer: {
|
|
2265
|
+
models: [],
|
|
2266
|
+
get: jest.fn()
|
|
2267
|
+
},
|
|
2268
|
+
entitlement: {
|
|
2269
|
+
models: entitlementKeys.map(function (key) {
|
|
2270
|
+
return {
|
|
2271
|
+
_values: {
|
|
2272
|
+
key: key
|
|
2273
|
+
}
|
|
2274
|
+
};
|
|
2275
|
+
})
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
};
|
|
2279
|
+
};
|
|
2280
|
+
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) {
|
|
2281
|
+
var device = createDevice('NATIVE_WEBEX_TEAMS_CALLING', [entitlement]);
|
|
2282
|
+
expect((0, _Utils.resolveCallingBackend)(device)).toBe(expected);
|
|
2283
|
+
});
|
|
2284
|
+
it('returns BWRKS when callingBehavior is NATIVE_WEBEX_TEAMS_CALLING and entitlement is broadworks-connector', function () {
|
|
2285
|
+
var device = createDevice('NATIVE_WEBEX_TEAMS_CALLING', ['broadworks-connector']);
|
|
2286
|
+
expect((0, _Utils.resolveCallingBackend)(device)).toBe(_types.CALLING_BACKEND.BWRKS);
|
|
2287
|
+
});
|
|
2288
|
+
it('returns UCM when callingBehavior is NATIVE_SIP_CALL_TO_UCM', function () {
|
|
2289
|
+
var device = createDevice('NATIVE_SIP_CALL_TO_UCM', []);
|
|
2290
|
+
expect((0, _Utils.resolveCallingBackend)(device)).toBe(_types.CALLING_BACKEND.UCM);
|
|
2291
|
+
});
|
|
2292
|
+
it('returns INVALID when callingBehavior is unknown', function () {
|
|
2293
|
+
var device = createDevice('UNKNOWN_BEHAVIOR', []);
|
|
2294
|
+
expect((0, _Utils.resolveCallingBackend)(device)).toBe(_types.CALLING_BACKEND.INVALID);
|
|
2295
|
+
});
|
|
2296
|
+
it('returns INVALID when callingBehavior is NATIVE_WEBEX_TEAMS_CALLING but no matching entitlement', function () {
|
|
2297
|
+
var device = createDevice('NATIVE_WEBEX_TEAMS_CALLING', ['some-other-entitlement']);
|
|
2298
|
+
expect((0, _Utils.resolveCallingBackend)(device)).toBe(_types.CALLING_BACKEND.INVALID);
|
|
2299
|
+
});
|
|
2300
|
+
it('matches the first qualifying entitlement when multiple are present', function () {
|
|
2301
|
+
var device = createDevice('NATIVE_WEBEX_TEAMS_CALLING', ['broadworks-connector', 'bc-sp-basic']);
|
|
2302
|
+
expect((0, _Utils.resolveCallingBackend)(device)).toBe(_types.CALLING_BACKEND.BWRKS);
|
|
2303
|
+
});
|
|
2304
|
+
});
|
|
2305
|
+
describe('getCallingBackEnd', function () {
|
|
2306
|
+
it('passes webex.internal.device to resolveCallingBackend and returns its result', function () {
|
|
2307
|
+
var device = {
|
|
2308
|
+
url: 'https://wdm.example.com/devices/123',
|
|
2309
|
+
userId: 'user-id',
|
|
2310
|
+
orgId: 'org-id',
|
|
2311
|
+
version: '1.0',
|
|
2312
|
+
callingBehavior: 'NATIVE_SIP_CALL_TO_UCM',
|
|
2313
|
+
features: {
|
|
2314
|
+
developer: {
|
|
2315
|
+
models: [],
|
|
2316
|
+
get: jest.fn()
|
|
2317
|
+
},
|
|
2318
|
+
entitlement: {
|
|
2319
|
+
models: []
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2322
|
+
};
|
|
2323
|
+
var mockWebex = {
|
|
2324
|
+
internal: {
|
|
2325
|
+
device: device
|
|
2326
|
+
}
|
|
2327
|
+
};
|
|
2328
|
+
var result = (0, _Utils.getCallingBackEnd)(mockWebex);
|
|
2329
|
+
expect(result).toBe((0, _Utils.resolveCallingBackend)(device));
|
|
2330
|
+
expect((0, _Utils.resolveCallingBackend)(device)).toBe(_types.CALLING_BACKEND.UCM);
|
|
2331
|
+
expect(result).toBe(_types.CALLING_BACKEND.UCM);
|
|
2332
|
+
});
|
|
2333
|
+
});
|
|
1989
2334
|
//# sourceMappingURL=Utils.test.js.map
|