@webex/calling 3.12.0-next.12 → 3.12.0-next.121
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 +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 +33 -3
- 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 +946 -61
- 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 +252 -127
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +493 -229
- 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 +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 +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/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 +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 +28 -0
- 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 +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 +103 -58
- 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 +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 +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/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/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 +28 -0
- 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 +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 +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 +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
|
@@ -12,6 +12,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequ
|
|
|
12
12
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
13
13
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
14
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
15
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
|
|
15
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
16
17
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
17
18
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
@@ -31,14 +32,27 @@ var _callManager = require("./calling/callManager");
|
|
|
31
32
|
var _constants = require("./constants");
|
|
32
33
|
var _callRecordFixtures = require("./callRecordFixtures");
|
|
33
34
|
var _callingClientFixtures = require("./callingClientFixtures");
|
|
34
|
-
var _line =
|
|
35
|
+
var _line = _interopRequireWildcard(require("./line"));
|
|
36
|
+
var LineModule = _line;
|
|
35
37
|
var _registerFixtures = require("./registration/registerFixtures");
|
|
36
38
|
var _constants2 = require("../common/constants");
|
|
37
39
|
var _types4 = require("../Metrics/types");
|
|
38
40
|
var _windowsChromiumIceWarmupUtils = _interopRequireDefault(require("./windowsChromiumIceWarmupUtils"));
|
|
39
|
-
|
|
41
|
+
var _request = require("./utils/request");
|
|
42
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t4 in e) "default" !== _t4 && {}.hasOwnProperty.call(e, _t4) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t4)) && (i.get || i.set) ? o(f, _t4, i) : f[_t4] = e[_t4]); return f; })(e, t); }
|
|
40
43
|
function ownKeys(e, r) { var t = _Object$keys2(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; }
|
|
41
44
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } /* eslint-disable dot-notation */
|
|
45
|
+
jest.mock('../mobius-socket', function () {
|
|
46
|
+
return {
|
|
47
|
+
getMobiusSocketInstance: jest.fn().mockReturnValue({
|
|
48
|
+
sendWssRequest: jest.fn(),
|
|
49
|
+
connect: jest.fn(),
|
|
50
|
+
isConnected: jest.fn().mockReturnValue(false),
|
|
51
|
+
on: jest.fn(),
|
|
52
|
+
off: jest.fn()
|
|
53
|
+
})
|
|
54
|
+
};
|
|
55
|
+
});
|
|
42
56
|
global.crypto = {
|
|
43
57
|
randomUUID: function randomUUID() {
|
|
44
58
|
return '12345678-1234-5678-1234-567812345678';
|
|
@@ -64,6 +78,12 @@ describe('CallingClient Tests', function () {
|
|
|
64
78
|
originalProcessNextTick(resolve);
|
|
65
79
|
});
|
|
66
80
|
}
|
|
81
|
+
beforeEach(function () {
|
|
82
|
+
_request.APIRequest.resetInstance();
|
|
83
|
+
_request.APIRequest.getInstance({
|
|
84
|
+
webex: webex
|
|
85
|
+
});
|
|
86
|
+
});
|
|
67
87
|
describe('CallingClient pick Mobius cluster using Service Host Tests', function () {
|
|
68
88
|
afterAll(function () {
|
|
69
89
|
callManager.removeAllListeners();
|
|
@@ -316,81 +336,80 @@ describe('CallingClient Tests', function () {
|
|
|
316
336
|
}
|
|
317
337
|
}, _callee0);
|
|
318
338
|
})));
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
* Input sdk config to callingClient with serviceData carrying valid value for indicator
|
|
322
|
-
* 'contactcenter', but an empty string for domain field in it.
|
|
323
|
-
*
|
|
324
|
-
* It should throw error and abort execution as domain value is invalid.
|
|
325
|
-
*
|
|
326
|
-
* DOMAIN field for service type 'contactcenter' must carry a non-empty valid domain type string.
|
|
327
|
-
*/
|
|
328
|
-
it('ContactCenter: verify empty invalid service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
329
|
-
var serviceDataObj, _t3;
|
|
339
|
+
it('ContactCenter: uses config domain and does not fetch RTMS domain from catalog', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
340
|
+
var serviceDataObj;
|
|
330
341
|
return _regenerator.default.wrap(function (_context1) {
|
|
331
342
|
while (1) switch (_context1.prev = _context1.next) {
|
|
332
343
|
case 0:
|
|
333
344
|
serviceDataObj = {
|
|
334
345
|
indicator: _types2.ServiceIndicator.CONTACT_CENTER,
|
|
335
|
-
domain: ''
|
|
346
|
+
domain: 'test.example.com'
|
|
336
347
|
};
|
|
337
|
-
|
|
338
|
-
_context1.next =
|
|
348
|
+
webex.internal.services.get = jest.fn();
|
|
349
|
+
_context1.next = 1;
|
|
339
350
|
return (0, _CallingClient.createClient)(webex, {
|
|
340
351
|
serviceData: serviceDataObj
|
|
341
352
|
});
|
|
342
|
-
case
|
|
353
|
+
case 1:
|
|
343
354
|
callingClient = _context1.sent;
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
case
|
|
347
|
-
_context1.prev = 3;
|
|
348
|
-
_t3 = _context1["catch"](1);
|
|
349
|
-
expect(_t3.message).toEqual('Invalid service domain.');
|
|
350
|
-
case 4:
|
|
351
|
-
expect.assertions(1);
|
|
352
|
-
case 5:
|
|
355
|
+
expect(callingClient).toBeTruthy();
|
|
356
|
+
expect(webex.internal.services.get).not.toHaveBeenCalled();
|
|
357
|
+
case 2:
|
|
353
358
|
case "end":
|
|
354
359
|
return _context1.stop();
|
|
355
360
|
}
|
|
356
|
-
}, _callee1
|
|
361
|
+
}, _callee1);
|
|
357
362
|
})));
|
|
358
363
|
|
|
359
364
|
/**
|
|
360
365
|
* Input sdk config to callingClient with serviceData carrying valid value for indicator
|
|
361
366
|
* 'contactcenter' , and a valid domain type string for domain field in it.
|
|
362
|
-
*
|
|
363
|
-
* Execution should proceed properly and createRegistration should be called with same serviceData.
|
|
364
|
-
*
|
|
365
|
-
* DOMAIN field for service type 'contactcenter' must carry a non-empty valid domain type string.
|
|
366
367
|
*/
|
|
367
|
-
it('ContactCenter:
|
|
368
|
+
it('ContactCenter: fetches RTMS domain from catalog when config domain is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
368
369
|
var serviceDataObj;
|
|
370
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
371
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
372
|
+
case 0:
|
|
373
|
+
serviceDataObj = {
|
|
374
|
+
indicator: _types2.ServiceIndicator.CONTACT_CENTER,
|
|
375
|
+
domain: ''
|
|
376
|
+
};
|
|
377
|
+
webex.internal.services.get = jest.fn().mockReturnValue('https://cc-rtms.example.com/calling/web/rtms');
|
|
378
|
+
_context10.next = 1;
|
|
379
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
380
|
+
serviceData: serviceDataObj
|
|
381
|
+
});
|
|
382
|
+
case 1:
|
|
383
|
+
callingClient = _context10.sent;
|
|
384
|
+
expect(callingClient).toBeTruthy();
|
|
385
|
+
expect(webex.internal.services.get).toHaveBeenCalledWith('wcc-calling-rtms-domain');
|
|
386
|
+
case 2:
|
|
387
|
+
case "end":
|
|
388
|
+
return _context10.stop();
|
|
389
|
+
}
|
|
390
|
+
}, _callee10);
|
|
391
|
+
})));
|
|
392
|
+
it('ContactCenter: init fails when config domain is empty and catalog fetch fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
393
|
+
var serviceDataObj, createLineSpy;
|
|
369
394
|
return _regenerator.default.wrap(function (_context11) {
|
|
370
395
|
while (1) switch (_context11.prev = _context11.next) {
|
|
371
396
|
case 0:
|
|
372
397
|
serviceDataObj = {
|
|
373
398
|
indicator: _types2.ServiceIndicator.CONTACT_CENTER,
|
|
374
|
-
domain: '
|
|
399
|
+
domain: ''
|
|
375
400
|
};
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
case 1:
|
|
385
|
-
callingClient = _context10.sent;
|
|
386
|
-
expect(callingClient).toBeTruthy();
|
|
387
|
-
case 2:
|
|
388
|
-
case "end":
|
|
389
|
-
return _context10.stop();
|
|
390
|
-
}
|
|
391
|
-
}, _callee10);
|
|
392
|
-
}))).not.toThrow(Error);
|
|
401
|
+
createLineSpy = jest.spyOn(_CallingClient.CallingClient.prototype, 'createLine');
|
|
402
|
+
webex.internal.services.get = jest.fn(function () {
|
|
403
|
+
throw new Error('catalog unavailable');
|
|
404
|
+
});
|
|
405
|
+
_context11.next = 1;
|
|
406
|
+
return expect((0, _CallingClient.createClient)(webex, {
|
|
407
|
+
serviceData: serviceDataObj
|
|
408
|
+
})).rejects.toThrow('Invalid service domain.');
|
|
393
409
|
case 1:
|
|
410
|
+
expect(createLineSpy).not.toHaveBeenCalled();
|
|
411
|
+
createLineSpy.mockRestore();
|
|
412
|
+
case 2:
|
|
394
413
|
case "end":
|
|
395
414
|
return _context11.stop();
|
|
396
415
|
}
|
|
@@ -420,9 +439,24 @@ describe('CallingClient Tests', function () {
|
|
|
420
439
|
});
|
|
421
440
|
describe('Mobius Server discovery tests', function () {
|
|
422
441
|
var callingClient;
|
|
442
|
+
var defaultMobiusServiceUrl = webex.internal.services._serviceUrls.mobius;
|
|
443
|
+
var usMobiusServiceLink = 'https://mobius-us-east-1.prod.infra.webex.com/api/v1';
|
|
444
|
+
var usRegionPayload = {
|
|
445
|
+
statusCode: 200,
|
|
446
|
+
body: _objectSpread(_objectSpread({}, _callingClientFixtures.regionBody), {}, {
|
|
447
|
+
clientRegion: 'US-EAST',
|
|
448
|
+
countryCode: 'US',
|
|
449
|
+
regionCode: 'US-EAST'
|
|
450
|
+
})
|
|
451
|
+
};
|
|
452
|
+
var networkBlockedPayload = {
|
|
453
|
+
statusCode: 500
|
|
454
|
+
};
|
|
423
455
|
afterEach(function () {
|
|
424
456
|
jest.clearAllTimers();
|
|
425
457
|
jest.clearAllMocks();
|
|
458
|
+
webex.internal.services._serviceUrls.mobius = defaultMobiusServiceUrl;
|
|
459
|
+
webex.internal.services.getMobiusClusters = jest.fn().mockReturnValue(_callingClientFixtures.mockUSServiceHosts);
|
|
426
460
|
callingClient.removeAllListeners();
|
|
427
461
|
callManager.removeAllListeners();
|
|
428
462
|
callingClient = undefined;
|
|
@@ -534,84 +568,266 @@ describe('CallingClient Tests', function () {
|
|
|
534
568
|
}
|
|
535
569
|
}, _callee15);
|
|
536
570
|
})));
|
|
571
|
+
it('US account connects using the U2C serviceLinks mobius URL and does not query catalog clusters', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
572
|
+
var requestedUris;
|
|
573
|
+
return _regenerator.default.wrap(function (_context16) {
|
|
574
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
575
|
+
case 0:
|
|
576
|
+
webex.internal.services._serviceUrls.mobius = usMobiusServiceLink;
|
|
577
|
+
webex.internal.services.getMobiusClusters = jest.fn().mockReturnValue(_callingClientFixtures.mockUSServiceHosts);
|
|
578
|
+
webex.request.mockResolvedValueOnce(usRegionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload);
|
|
579
|
+
_context16.next = 1;
|
|
580
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
581
|
+
logger: {
|
|
582
|
+
level: _types.LOGGER.INFO
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
case 1:
|
|
586
|
+
callingClient = _context16.sent;
|
|
587
|
+
expect(webex.request).toBeCalledTimes(2);
|
|
588
|
+
expect(callingClient['mobiusHost']).toBe(usMobiusServiceLink);
|
|
589
|
+
expect(webex.request).nthCalledWith(2, _objectSpread(_objectSpread({
|
|
590
|
+
method: 'GET'
|
|
591
|
+
}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
592
|
+
uri: "".concat(usMobiusServiceLink).concat(_constants.URL_ENDPOINT, "?regionCode=US-EAST&countryCode=US")
|
|
593
|
+
}));
|
|
594
|
+
requestedUris = webex.request.mock.calls.map(function (_ref17) {
|
|
595
|
+
var _ref18 = (0, _slicedToArray2.default)(_ref17, 1),
|
|
596
|
+
uri = _ref18[0].uri;
|
|
597
|
+
return uri;
|
|
598
|
+
});
|
|
599
|
+
expect(requestedUris.some(function (uri) {
|
|
600
|
+
return uri === null || uri === void 0 ? void 0 : uri.includes('mobius-eu-central-1');
|
|
601
|
+
})).toBe(false);
|
|
602
|
+
expect(requestedUris.some(function (uri) {
|
|
603
|
+
return uri === null || uri === void 0 ? void 0 : uri.includes('mobius-ca-central-1');
|
|
604
|
+
})).toBe(false);
|
|
605
|
+
expect(callingClient.primaryMobiusUris).toEqual([_callingClientFixtures.primaryUrl]);
|
|
606
|
+
case 2:
|
|
607
|
+
case "end":
|
|
608
|
+
return _context16.stop();
|
|
609
|
+
}
|
|
610
|
+
}, _callee16);
|
|
611
|
+
})));
|
|
612
|
+
it('SDK config for a different region still uses the U2C mobius link as host and connects to the config cluster', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
613
|
+
var euDiscoveryPayload;
|
|
614
|
+
return _regenerator.default.wrap(function (_context17) {
|
|
615
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
616
|
+
case 0:
|
|
617
|
+
webex.internal.services._serviceUrls.mobius = usMobiusServiceLink;
|
|
618
|
+
webex.internal.services.getMobiusClusters = jest.fn().mockReturnValue(_callingClientFixtures.mockUSServiceHosts);
|
|
619
|
+
euDiscoveryPayload = {
|
|
620
|
+
statusCode: 200,
|
|
621
|
+
body: {
|
|
622
|
+
primary: {
|
|
623
|
+
region: 'EU-CENTRAL',
|
|
624
|
+
uris: ['https://mobius-fra.webex.com/api/v1']
|
|
625
|
+
},
|
|
626
|
+
backup: {
|
|
627
|
+
region: 'EU-WEST',
|
|
628
|
+
uris: ['https://mobius-lon.webex.com/api/v1']
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
webex.request.mockResolvedValueOnce(euDiscoveryPayload);
|
|
633
|
+
_context17.next = 1;
|
|
634
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
635
|
+
discovery: {
|
|
636
|
+
region: 'EU-CENTRAL',
|
|
637
|
+
country: 'DE'
|
|
638
|
+
},
|
|
639
|
+
logger: {
|
|
640
|
+
level: _types.LOGGER.INFO
|
|
641
|
+
}
|
|
642
|
+
});
|
|
643
|
+
case 1:
|
|
644
|
+
callingClient = _context17.sent;
|
|
645
|
+
expect(webex.request).toBeCalledOnceWith(_objectSpread(_objectSpread({
|
|
646
|
+
method: 'GET'
|
|
647
|
+
}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
648
|
+
uri: "".concat(usMobiusServiceLink).concat(_constants.URL_ENDPOINT, "?regionCode=EU-CENTRAL&countryCode=DE")
|
|
649
|
+
}));
|
|
650
|
+
expect(callingClient['mobiusHost']).toBe(usMobiusServiceLink);
|
|
651
|
+
expect(callingClient.primaryMobiusUris).toEqual(['https://mobius-fra.webex.com/api/v1/calling/web/']);
|
|
652
|
+
expect(handleErrorSpy).not.toHaveBeenCalled();
|
|
653
|
+
case 2:
|
|
654
|
+
case "end":
|
|
655
|
+
return _context17.stop();
|
|
656
|
+
}
|
|
657
|
+
}, _callee17);
|
|
658
|
+
})));
|
|
659
|
+
it('when the U2C service link has no region, discovery uses SDK config region and country', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
660
|
+
var regionlessServiceLink, apDiscoveryPayload, requestedUris;
|
|
661
|
+
return _regenerator.default.wrap(function (_context18) {
|
|
662
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
663
|
+
case 0:
|
|
664
|
+
regionlessServiceLink = 'https://mobius.webex.com/api/v1';
|
|
665
|
+
webex.internal.services._serviceUrls.mobius = regionlessServiceLink;
|
|
666
|
+
webex.internal.services.getMobiusClusters = jest.fn().mockReturnValue(_callingClientFixtures.mockUSServiceHosts);
|
|
667
|
+
apDiscoveryPayload = {
|
|
668
|
+
statusCode: 200,
|
|
669
|
+
body: {
|
|
670
|
+
primary: {
|
|
671
|
+
region: 'AP-SOUTHEAST',
|
|
672
|
+
uris: ['https://mobius-sin.webex.com/api/v1']
|
|
673
|
+
},
|
|
674
|
+
backup: {
|
|
675
|
+
region: 'AP-NORTHEAST',
|
|
676
|
+
uris: ['https://mobius-nrt.webex.com/api/v1']
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
};
|
|
680
|
+
webex.request.mockResolvedValueOnce(apDiscoveryPayload);
|
|
681
|
+
_context18.next = 1;
|
|
682
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
683
|
+
discovery: {
|
|
684
|
+
region: 'AP-SOUTHEAST',
|
|
685
|
+
country: 'SG'
|
|
686
|
+
},
|
|
687
|
+
logger: {
|
|
688
|
+
level: _types.LOGGER.INFO
|
|
689
|
+
}
|
|
690
|
+
});
|
|
691
|
+
case 1:
|
|
692
|
+
callingClient = _context18.sent;
|
|
693
|
+
requestedUris = webex.request.mock.calls.map(function (_ref21) {
|
|
694
|
+
var _ref22 = (0, _slicedToArray2.default)(_ref21, 1),
|
|
695
|
+
uri = _ref22[0].uri;
|
|
696
|
+
return uri;
|
|
697
|
+
});
|
|
698
|
+
expect(requestedUris.some(function (uri) {
|
|
699
|
+
return uri === null || uri === void 0 ? void 0 : uri.includes(_constants.DISCOVERY_URL);
|
|
700
|
+
})).toBe(false);
|
|
701
|
+
expect(webex.request).toBeCalledOnceWith(_objectSpread(_objectSpread({
|
|
702
|
+
method: 'GET'
|
|
703
|
+
}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
704
|
+
uri: "".concat(regionlessServiceLink).concat(_constants.URL_ENDPOINT, "?regionCode=AP-SOUTHEAST&countryCode=SG")
|
|
705
|
+
}));
|
|
706
|
+
expect(callingClient['mobiusHost']).toBe(regionlessServiceLink);
|
|
707
|
+
expect(callingClient.primaryMobiusUris).toEqual(['https://mobius-sin.webex.com/api/v1/calling/web/']);
|
|
708
|
+
case 2:
|
|
709
|
+
case "end":
|
|
710
|
+
return _context18.stop();
|
|
711
|
+
}
|
|
712
|
+
}, _callee18);
|
|
713
|
+
})));
|
|
714
|
+
it('when the primary U2C mobius link is blocked, discovery walks remaining catalog clusters', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
715
|
+
return _regenerator.default.wrap(function (_context19) {
|
|
716
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
717
|
+
case 0:
|
|
718
|
+
webex.internal.services._serviceUrls.mobius = usMobiusServiceLink;
|
|
719
|
+
webex.internal.services.getMobiusClusters = jest.fn().mockReturnValue(_callingClientFixtures.mockUSServiceHosts);
|
|
720
|
+
webex.request.mockResolvedValueOnce(usRegionPayload).mockRejectedValueOnce(networkBlockedPayload).mockRejectedValueOnce(networkBlockedPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload);
|
|
721
|
+
_context19.next = 1;
|
|
722
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
723
|
+
logger: {
|
|
724
|
+
level: _types.LOGGER.INFO
|
|
725
|
+
}
|
|
726
|
+
});
|
|
727
|
+
case 1:
|
|
728
|
+
callingClient = _context19.sent;
|
|
729
|
+
expect(webex.request).toBeCalledTimes(4);
|
|
730
|
+
expect(webex.request).nthCalledWith(2, _objectSpread(_objectSpread({
|
|
731
|
+
method: 'GET'
|
|
732
|
+
}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
733
|
+
uri: "".concat(usMobiusServiceLink).concat(_constants.URL_ENDPOINT, "?regionCode=US-EAST&countryCode=US")
|
|
734
|
+
}));
|
|
735
|
+
expect(webex.request).nthCalledWith(3, _objectSpread(_objectSpread({
|
|
736
|
+
method: 'GET'
|
|
737
|
+
}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
738
|
+
uri: "https://mobius-ca-central-1.prod.infra.webex.com/api/v1".concat(_constants.URL_ENDPOINT, "?regionCode=US-EAST&countryCode=US")
|
|
739
|
+
}));
|
|
740
|
+
expect(webex.request).nthCalledWith(4, _objectSpread(_objectSpread({
|
|
741
|
+
method: 'GET'
|
|
742
|
+
}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
743
|
+
uri: "https://mobius-eu-central-1.prod.infra.webex.com/api/v1".concat(_constants.URL_ENDPOINT, "?regionCode=US-EAST&countryCode=US")
|
|
744
|
+
}));
|
|
745
|
+
expect(callingClient['mobiusHost']).toBe('https://mobius-eu-central-1.prod.infra.webex.com/api/v1');
|
|
746
|
+
expect(callingClient.primaryMobiusUris).toEqual([_callingClientFixtures.primaryUrl]);
|
|
747
|
+
case 2:
|
|
748
|
+
case "end":
|
|
749
|
+
return _context19.stop();
|
|
750
|
+
}
|
|
751
|
+
}, _callee19);
|
|
752
|
+
})));
|
|
537
753
|
});
|
|
538
754
|
describe('Testing each cluster present withing host catalog', function () {
|
|
539
755
|
var mobiusCluster = ['mobius-eu-central-1.prod.infra.webex.com', 'mobius-us-east-1.int.infra.webex.com', 'mobius-eu-central-1.int.infra.webex.com'];
|
|
540
756
|
var checkCluster = /*#__PURE__*/function () {
|
|
541
|
-
var
|
|
757
|
+
var _ref24 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20(mockServiceHosts, mockCatalog) {
|
|
542
758
|
var callingClient;
|
|
543
|
-
return _regenerator.default.wrap(function (
|
|
544
|
-
while (1) switch (
|
|
759
|
+
return _regenerator.default.wrap(function (_context20) {
|
|
760
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
545
761
|
case 0:
|
|
546
762
|
webex.internal.services._hostCatalog = mockCatalog;
|
|
547
763
|
webex.internal.services.getMobiusClusters = jest.fn().mockReturnValue(mockServiceHosts);
|
|
548
|
-
|
|
764
|
+
_context20.next = 1;
|
|
549
765
|
return (0, _CallingClient.createClient)(webex, {
|
|
550
766
|
logger: {
|
|
551
767
|
level: _types.LOGGER.INFO
|
|
552
768
|
}
|
|
553
769
|
});
|
|
554
770
|
case 1:
|
|
555
|
-
callingClient =
|
|
771
|
+
callingClient = _context20.sent;
|
|
556
772
|
expect(callingClient['mobiusClusters']).toStrictEqual(mockServiceHosts);
|
|
557
773
|
case 2:
|
|
558
774
|
case "end":
|
|
559
|
-
return
|
|
775
|
+
return _context20.stop();
|
|
560
776
|
}
|
|
561
|
-
},
|
|
777
|
+
}, _callee20);
|
|
562
778
|
}));
|
|
563
779
|
return function checkCluster(_x, _x2) {
|
|
564
|
-
return
|
|
780
|
+
return _ref24.apply(this, arguments);
|
|
565
781
|
};
|
|
566
782
|
}();
|
|
567
783
|
it.each(mobiusCluster)('%s', /*#__PURE__*/function () {
|
|
568
|
-
var
|
|
569
|
-
var
|
|
570
|
-
return _regenerator.default.wrap(function (
|
|
571
|
-
while (1) switch (
|
|
784
|
+
var _ref25 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21(clusterName) {
|
|
785
|
+
var _t3;
|
|
786
|
+
return _regenerator.default.wrap(function (_context21) {
|
|
787
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
572
788
|
case 0:
|
|
573
|
-
|
|
574
|
-
|
|
789
|
+
_t3 = clusterName;
|
|
790
|
+
_context21.next = _t3 === 'mobius-eu-central-1.prod.infra.webex.com' ? 1 : _t3 === 'mobius-us-east-1.int.infra.webex.com' ? 2 : _t3 === 'mobius-eu-central-1.int.infra.webex.com' ? 3 : 4;
|
|
575
791
|
break;
|
|
576
792
|
case 1:
|
|
577
793
|
checkCluster(_callingClientFixtures.mockEUServiceHosts, _callingClientFixtures.mockCatalogEU);
|
|
578
|
-
return
|
|
794
|
+
return _context21.abrupt("continue", 5);
|
|
579
795
|
case 2:
|
|
580
796
|
checkCluster(_callingClientFixtures.mockIntServiceHosts, _callingClientFixtures.mockCatalogUSInt);
|
|
581
|
-
return
|
|
797
|
+
return _context21.abrupt("continue", 5);
|
|
582
798
|
case 3:
|
|
583
799
|
checkCluster(_callingClientFixtures.mockEUIntServiceHosts, _callingClientFixtures.mockCatalogEUInt);
|
|
584
|
-
return
|
|
800
|
+
return _context21.abrupt("continue", 5);
|
|
585
801
|
case 4:
|
|
586
|
-
return
|
|
802
|
+
return _context21.abrupt("continue", 5);
|
|
587
803
|
case 5:
|
|
588
804
|
case "end":
|
|
589
|
-
return
|
|
805
|
+
return _context21.stop();
|
|
590
806
|
}
|
|
591
|
-
},
|
|
807
|
+
}, _callee21);
|
|
592
808
|
}));
|
|
593
809
|
return function (_x3) {
|
|
594
|
-
return
|
|
810
|
+
return _ref25.apply(this, arguments);
|
|
595
811
|
};
|
|
596
812
|
}());
|
|
597
813
|
});
|
|
598
814
|
describe('Line creation tests', function () {
|
|
599
815
|
var callingClient;
|
|
600
816
|
var line;
|
|
601
|
-
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
602
|
-
return _regenerator.default.wrap(function (
|
|
603
|
-
while (1) switch (
|
|
817
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
818
|
+
return _regenerator.default.wrap(function (_context22) {
|
|
819
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
604
820
|
case 0:
|
|
605
|
-
|
|
821
|
+
_context22.next = 1;
|
|
606
822
|
return (0, _CallingClient.createClient)(webex);
|
|
607
823
|
case 1:
|
|
608
|
-
callingClient =
|
|
824
|
+
callingClient = _context22.sent;
|
|
609
825
|
line = (0, _values.default)(callingClient.lineDict)[0];
|
|
610
826
|
case 2:
|
|
611
827
|
case "end":
|
|
612
|
-
return
|
|
828
|
+
return _context22.stop();
|
|
613
829
|
}
|
|
614
|
-
},
|
|
830
|
+
}, _callee22);
|
|
615
831
|
})));
|
|
616
832
|
afterEach(function () {
|
|
617
833
|
jest.clearAllTimers();
|
|
@@ -631,6 +847,205 @@ describe('CallingClient Tests', function () {
|
|
|
631
847
|
expect(callingClient.getLines()).toEqual(callingClient.lineDict);
|
|
632
848
|
});
|
|
633
849
|
});
|
|
850
|
+
describe('createLine transport URI selection', function () {
|
|
851
|
+
var callingClient;
|
|
852
|
+
var lineCtorSpy;
|
|
853
|
+
var primaryHttp = ['https://primary.example.com/api/v1/calling/web/'];
|
|
854
|
+
var backupHttp = ['https://backup.example.com/api/v1/calling/web/'];
|
|
855
|
+
var primaryWss = ['wss://primary.example.com/api/v1/calling/web/'];
|
|
856
|
+
var backupWss = ['wss://backup.example.com/api/v1/calling/web/'];
|
|
857
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
858
|
+
return _regenerator.default.wrap(function (_context23) {
|
|
859
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
860
|
+
case 0:
|
|
861
|
+
_context23.next = 1;
|
|
862
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
863
|
+
logger: {
|
|
864
|
+
level: _types.LOGGER.INFO
|
|
865
|
+
}
|
|
866
|
+
});
|
|
867
|
+
case 1:
|
|
868
|
+
callingClient = _context23.sent;
|
|
869
|
+
callingClient.primaryMobiusUris = primaryHttp;
|
|
870
|
+
callingClient.backupMobiusUris = backupHttp;
|
|
871
|
+
lineCtorSpy = jest.spyOn(LineModule, 'default').mockImplementation(function () {
|
|
872
|
+
return {
|
|
873
|
+
lineId: 'mock-line-id'
|
|
874
|
+
};
|
|
875
|
+
});
|
|
876
|
+
case 2:
|
|
877
|
+
case "end":
|
|
878
|
+
return _context23.stop();
|
|
879
|
+
}
|
|
880
|
+
}, _callee23);
|
|
881
|
+
})));
|
|
882
|
+
afterEach(function () {
|
|
883
|
+
lineCtorSpy.mockRestore();
|
|
884
|
+
jest.clearAllMocks();
|
|
885
|
+
callingClient.removeAllListeners();
|
|
886
|
+
callManager.removeAllListeners();
|
|
887
|
+
callingClient = undefined;
|
|
888
|
+
});
|
|
889
|
+
var getLineUris = function getLineUris() {
|
|
890
|
+
var ctorArgs = lineCtorSpy.mock.calls[0];
|
|
891
|
+
return {
|
|
892
|
+
primary: ctorArgs[3],
|
|
893
|
+
backup: ctorArgs[4]
|
|
894
|
+
};
|
|
895
|
+
};
|
|
896
|
+
it('uses normalized WSS URIs for both groups when socket is enabled and WSS URIs are present', function () {
|
|
897
|
+
jest.spyOn(callingClient['apiRequest'], 'isSocketEnabled').mockReturnValue(true);
|
|
898
|
+
callingClient.primaryWssMobiusUris = primaryWss;
|
|
899
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
900
|
+
callingClient['createLine']();
|
|
901
|
+
var _getLineUris = getLineUris(),
|
|
902
|
+
primary = _getLineUris.primary,
|
|
903
|
+
backup = _getLineUris.backup;
|
|
904
|
+
expect(primary).toEqual((0, _Utils.normalizeMobiusUris)(primaryWss));
|
|
905
|
+
expect(backup).toEqual((0, _Utils.normalizeMobiusUris)(backupWss));
|
|
906
|
+
});
|
|
907
|
+
it('falls back to HTTP URIs for a group with no WSS URL even when the socket is enabled', function () {
|
|
908
|
+
jest.spyOn(callingClient['apiRequest'], 'isSocketEnabled').mockReturnValue(true);
|
|
909
|
+
// Primary has no WSS URL (HTTP fallback expected) while backup does.
|
|
910
|
+
callingClient.primaryWssMobiusUris = [];
|
|
911
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
912
|
+
callingClient['createLine']();
|
|
913
|
+
var _getLineUris2 = getLineUris(),
|
|
914
|
+
primary = _getLineUris2.primary,
|
|
915
|
+
backup = _getLineUris2.backup;
|
|
916
|
+
expect(primary).toEqual(primaryHttp);
|
|
917
|
+
expect(backup).toEqual((0, _Utils.normalizeMobiusUris)(backupWss));
|
|
918
|
+
});
|
|
919
|
+
it('uses HTTP URIs for both groups when the socket is enabled but no WSS URLs are present', function () {
|
|
920
|
+
jest.spyOn(callingClient['apiRequest'], 'isSocketEnabled').mockReturnValue(true);
|
|
921
|
+
callingClient.primaryWssMobiusUris = [];
|
|
922
|
+
callingClient.backupWssMobiusUris = [];
|
|
923
|
+
callingClient['createLine']();
|
|
924
|
+
var _getLineUris3 = getLineUris(),
|
|
925
|
+
primary = _getLineUris3.primary,
|
|
926
|
+
backup = _getLineUris3.backup;
|
|
927
|
+
expect(primary).toEqual(primaryHttp);
|
|
928
|
+
expect(backup).toEqual(backupHttp);
|
|
929
|
+
});
|
|
930
|
+
it('uses HTTP URIs for both groups when the socket is disabled', function () {
|
|
931
|
+
jest.spyOn(callingClient['apiRequest'], 'isSocketEnabled').mockReturnValue(false);
|
|
932
|
+
callingClient.primaryWssMobiusUris = primaryWss;
|
|
933
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
934
|
+
callingClient['createLine']();
|
|
935
|
+
var _getLineUris4 = getLineUris(),
|
|
936
|
+
primary = _getLineUris4.primary,
|
|
937
|
+
backup = _getLineUris4.backup;
|
|
938
|
+
expect(primary).toEqual(primaryHttp);
|
|
939
|
+
expect(backup).toEqual(backupHttp);
|
|
940
|
+
});
|
|
941
|
+
});
|
|
942
|
+
describe('connectToMobiusSocket', function () {
|
|
943
|
+
var callingClient;
|
|
944
|
+
var connectSpy;
|
|
945
|
+
var primaryWss = ['wss://primary-1.example.com/api/v1/calling/web/', 'wss://primary-2.example.com/api/v1/calling/web/'];
|
|
946
|
+
var backupWss = ['wss://backup.example.com/api/v1/calling/web/'];
|
|
947
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
948
|
+
return _regenerator.default.wrap(function (_context24) {
|
|
949
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
950
|
+
case 0:
|
|
951
|
+
_context24.next = 1;
|
|
952
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
953
|
+
logger: {
|
|
954
|
+
level: _types.LOGGER.INFO
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
case 1:
|
|
958
|
+
callingClient = _context24.sent;
|
|
959
|
+
connectSpy = jest.spyOn(callingClient['apiRequest'], 'connectToMobiusSocket');
|
|
960
|
+
warnSpy.mockClear();
|
|
961
|
+
case 2:
|
|
962
|
+
case "end":
|
|
963
|
+
return _context24.stop();
|
|
964
|
+
}
|
|
965
|
+
}, _callee24);
|
|
966
|
+
})));
|
|
967
|
+
afterEach(function () {
|
|
968
|
+
jest.clearAllMocks();
|
|
969
|
+
callingClient.removeAllListeners();
|
|
970
|
+
callManager.removeAllListeners();
|
|
971
|
+
callingClient = undefined;
|
|
972
|
+
});
|
|
973
|
+
it('skips the socket connection and warns when no primary WSS URIs are available', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
974
|
+
return _regenerator.default.wrap(function (_context25) {
|
|
975
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
976
|
+
case 0:
|
|
977
|
+
callingClient.primaryWssMobiusUris = [];
|
|
978
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
979
|
+
_context25.next = 1;
|
|
980
|
+
return callingClient['connectToMobiusSocket']();
|
|
981
|
+
case 1:
|
|
982
|
+
expect(connectSpy).not.toHaveBeenCalled();
|
|
983
|
+
expect(warnSpy).toHaveBeenCalledWith('No WSS URIs available from Mobius discovery for primary, skipping socket connection', {
|
|
984
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
985
|
+
method: 'connectToMobiusSocket'
|
|
986
|
+
});
|
|
987
|
+
case 2:
|
|
988
|
+
case "end":
|
|
989
|
+
return _context25.stop();
|
|
990
|
+
}
|
|
991
|
+
}, _callee25);
|
|
992
|
+
})));
|
|
993
|
+
it('connects using the first reachable primary WSS URI and stops on success', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
994
|
+
return _regenerator.default.wrap(function (_context26) {
|
|
995
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
996
|
+
case 0:
|
|
997
|
+
callingClient.primaryWssMobiusUris = primaryWss;
|
|
998
|
+
connectSpy.mockResolvedValue(undefined);
|
|
999
|
+
_context26.next = 1;
|
|
1000
|
+
return callingClient['connectToMobiusSocket']();
|
|
1001
|
+
case 1:
|
|
1002
|
+
expect(connectSpy).toHaveBeenCalledTimes(1);
|
|
1003
|
+
expect(connectSpy).toHaveBeenCalledWith(primaryWss[0]);
|
|
1004
|
+
case 2:
|
|
1005
|
+
case "end":
|
|
1006
|
+
return _context26.stop();
|
|
1007
|
+
}
|
|
1008
|
+
}, _callee26);
|
|
1009
|
+
})));
|
|
1010
|
+
it('tries each primary WSS URI and warns when all attempts fail', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
|
|
1011
|
+
return _regenerator.default.wrap(function (_context27) {
|
|
1012
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1013
|
+
case 0:
|
|
1014
|
+
callingClient.primaryWssMobiusUris = primaryWss;
|
|
1015
|
+
connectSpy.mockRejectedValue(new Error('connect failed'));
|
|
1016
|
+
_context27.next = 1;
|
|
1017
|
+
return callingClient['connectToMobiusSocket']();
|
|
1018
|
+
case 1:
|
|
1019
|
+
expect(connectSpy).toHaveBeenCalledTimes(primaryWss.length);
|
|
1020
|
+
expect(connectSpy).toHaveBeenNthCalledWith(1, primaryWss[0]);
|
|
1021
|
+
expect(connectSpy).toHaveBeenNthCalledWith(2, primaryWss[1]);
|
|
1022
|
+
expect(warnSpy).toHaveBeenCalledWith('All primary WSS URI connection attempts failed', {
|
|
1023
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
1024
|
+
method: 'connectToMobiusSocket'
|
|
1025
|
+
});
|
|
1026
|
+
case 2:
|
|
1027
|
+
case "end":
|
|
1028
|
+
return _context27.stop();
|
|
1029
|
+
}
|
|
1030
|
+
}, _callee27);
|
|
1031
|
+
})));
|
|
1032
|
+
it('does not attempt backup WSS URIs when primary WSS URIs are absent', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
|
|
1033
|
+
return _regenerator.default.wrap(function (_context28) {
|
|
1034
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1035
|
+
case 0:
|
|
1036
|
+
callingClient.primaryWssMobiusUris = [];
|
|
1037
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
1038
|
+
_context28.next = 1;
|
|
1039
|
+
return callingClient['connectToMobiusSocket']();
|
|
1040
|
+
case 1:
|
|
1041
|
+
expect(connectSpy).not.toHaveBeenCalled();
|
|
1042
|
+
case 2:
|
|
1043
|
+
case "end":
|
|
1044
|
+
return _context28.stop();
|
|
1045
|
+
}
|
|
1046
|
+
}, _callee28);
|
|
1047
|
+
})));
|
|
1048
|
+
});
|
|
634
1049
|
describe('Connectivity and Mercury event handlers', function () {
|
|
635
1050
|
var callingClient;
|
|
636
1051
|
var line;
|
|
@@ -641,24 +1056,24 @@ describe('CallingClient Tests', function () {
|
|
|
641
1056
|
var restartRegisterSpy;
|
|
642
1057
|
var registerSpy;
|
|
643
1058
|
var metricSpy;
|
|
644
|
-
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
645
|
-
return _regenerator.default.wrap(function (
|
|
646
|
-
while (1) switch (
|
|
1059
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
|
|
1060
|
+
return _regenerator.default.wrap(function (_context29) {
|
|
1061
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
647
1062
|
case 0:
|
|
648
1063
|
jest.useFakeTimers();
|
|
649
1064
|
webex.request.mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload).mockResolvedValueOnce(_callingClientFixtures.registrationPayload);
|
|
650
1065
|
windowEventSpy = jest.spyOn(window, 'addEventListener');
|
|
651
|
-
|
|
1066
|
+
_context29.next = 1;
|
|
652
1067
|
return (0, _CallingClient.createClient)(webex, {
|
|
653
1068
|
logger: {
|
|
654
1069
|
level: _types.LOGGER.INFO
|
|
655
1070
|
}
|
|
656
1071
|
});
|
|
657
1072
|
case 1:
|
|
658
|
-
callingClient =
|
|
1073
|
+
callingClient = _context29.sent;
|
|
659
1074
|
line = (0, _values.default)(callingClient.lineDict)[0];
|
|
660
1075
|
reg = line.registration;
|
|
661
|
-
|
|
1076
|
+
_context29.next = 2;
|
|
662
1077
|
return line.register();
|
|
663
1078
|
case 2:
|
|
664
1079
|
deRegSpy = jest.spyOn(reg, 'deregister');
|
|
@@ -668,9 +1083,9 @@ describe('CallingClient Tests', function () {
|
|
|
668
1083
|
metricSpy = jest.spyOn(callingClient['metricManager'], 'submitConnectionMetrics');
|
|
669
1084
|
case 3:
|
|
670
1085
|
case "end":
|
|
671
|
-
return
|
|
1086
|
+
return _context29.stop();
|
|
672
1087
|
}
|
|
673
|
-
},
|
|
1088
|
+
}, _callee29);
|
|
674
1089
|
})));
|
|
675
1090
|
afterEach(function () {
|
|
676
1091
|
jest.clearAllTimers();
|
|
@@ -681,16 +1096,16 @@ describe('CallingClient Tests', function () {
|
|
|
681
1096
|
callingClient = undefined;
|
|
682
1097
|
jest.useRealTimers();
|
|
683
1098
|
});
|
|
684
|
-
it('window offline handler sets networkDown and clears keepalive when network is unreachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1099
|
+
it('window offline handler sets networkDown and clears keepalive when network is unreachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
|
|
685
1100
|
var g, clearKeepaliveSpy, offlineCb;
|
|
686
|
-
return _regenerator.default.wrap(function (
|
|
687
|
-
while (1) switch (
|
|
1101
|
+
return _regenerator.default.wrap(function (_context30) {
|
|
1102
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
688
1103
|
case 0:
|
|
689
1104
|
g = global;
|
|
690
1105
|
g.fetch = jest.fn().mockRejectedValueOnce(new Error('network fail'));
|
|
691
1106
|
clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
692
1107
|
offlineCb = windowEventSpy.mock.calls[1][1];
|
|
693
|
-
|
|
1108
|
+
_context30.next = 1;
|
|
694
1109
|
return offlineCb();
|
|
695
1110
|
case 1:
|
|
696
1111
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Network connectivity probe failed'), {
|
|
@@ -701,20 +1116,20 @@ describe('CallingClient Tests', function () {
|
|
|
701
1116
|
expect(clearKeepaliveSpy).toHaveBeenCalled();
|
|
702
1117
|
case 2:
|
|
703
1118
|
case "end":
|
|
704
|
-
return
|
|
1119
|
+
return _context30.stop();
|
|
705
1120
|
}
|
|
706
|
-
},
|
|
1121
|
+
}, _callee30);
|
|
707
1122
|
})));
|
|
708
|
-
it('window offline handler does not clear keepalive when network is reachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1123
|
+
it('window offline handler does not clear keepalive when network is reachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
|
|
709
1124
|
var g, clearKeepaliveSpy, offlineCb;
|
|
710
|
-
return _regenerator.default.wrap(function (
|
|
711
|
-
while (1) switch (
|
|
1125
|
+
return _regenerator.default.wrap(function (_context31) {
|
|
1126
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
712
1127
|
case 0:
|
|
713
1128
|
g = global;
|
|
714
1129
|
g.fetch = jest.fn().mockResolvedValueOnce({});
|
|
715
1130
|
clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
716
1131
|
offlineCb = windowEventSpy.mock.calls[1][1];
|
|
717
|
-
|
|
1132
|
+
_context31.next = 1;
|
|
718
1133
|
return offlineCb();
|
|
719
1134
|
case 1:
|
|
720
1135
|
expect(g.fetch).toHaveBeenCalledWith('https://www.google.com/generate_204', expect.any(Object));
|
|
@@ -722,17 +1137,17 @@ describe('CallingClient Tests', function () {
|
|
|
722
1137
|
expect(clearKeepaliveSpy).not.toHaveBeenCalled();
|
|
723
1138
|
case 2:
|
|
724
1139
|
case "end":
|
|
725
|
-
return
|
|
1140
|
+
return _context31.stop();
|
|
726
1141
|
}
|
|
727
|
-
},
|
|
1142
|
+
}, _callee31);
|
|
728
1143
|
})));
|
|
729
|
-
it('window online handler sets networkUpTimestamp and logs', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1144
|
+
it('window online handler sets networkUpTimestamp and logs', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
|
|
730
1145
|
var onlineCb;
|
|
731
|
-
return _regenerator.default.wrap(function (
|
|
732
|
-
while (1) switch (
|
|
1146
|
+
return _regenerator.default.wrap(function (_context32) {
|
|
1147
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
733
1148
|
case 0:
|
|
734
1149
|
onlineCb = windowEventSpy.mock.calls[0][1];
|
|
735
|
-
|
|
1150
|
+
_context32.next = 1;
|
|
736
1151
|
return onlineCb();
|
|
737
1152
|
case 1:
|
|
738
1153
|
expect(callingClient['networkUpTimestamp']).toEqual(expect.any(String));
|
|
@@ -742,17 +1157,17 @@ describe('CallingClient Tests', function () {
|
|
|
742
1157
|
});
|
|
743
1158
|
case 2:
|
|
744
1159
|
case "end":
|
|
745
|
-
return
|
|
1160
|
+
return _context32.stop();
|
|
746
1161
|
}
|
|
747
|
-
},
|
|
1162
|
+
}, _callee32);
|
|
748
1163
|
})));
|
|
749
|
-
it('mercury offline submits metrics and sets timestamp', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1164
|
+
it('mercury offline submits metrics and sets timestamp', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
|
|
750
1165
|
var mercuryOfflineCb;
|
|
751
|
-
return _regenerator.default.wrap(function (
|
|
752
|
-
while (1) switch (
|
|
1166
|
+
return _regenerator.default.wrap(function (_context33) {
|
|
1167
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
753
1168
|
case 0:
|
|
754
1169
|
mercuryOfflineCb = webex.internal.mercury.on.mock.calls[1][1];
|
|
755
|
-
|
|
1170
|
+
_context33.next = 1;
|
|
756
1171
|
return mercuryOfflineCb();
|
|
757
1172
|
case 1:
|
|
758
1173
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Mercury down, waiting for connection to be up'), {
|
|
@@ -763,26 +1178,26 @@ describe('CallingClient Tests', function () {
|
|
|
763
1178
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.MERCURY_DOWN, _types4.METRIC_TYPE.BEHAVIORAL, expect.any(String), '');
|
|
764
1179
|
case 2:
|
|
765
1180
|
case "end":
|
|
766
|
-
return
|
|
1181
|
+
return _context33.stop();
|
|
767
1182
|
}
|
|
768
|
-
},
|
|
1183
|
+
}, _callee33);
|
|
769
1184
|
})));
|
|
770
|
-
it('handles reconnection with no active calls after network flap, once mercury comes back up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1185
|
+
it('handles reconnection with no active calls after network flap, once mercury comes back up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
|
|
771
1186
|
var handleConnectionRestoreSpy, mercuryOnlineCb;
|
|
772
|
-
return _regenerator.default.wrap(function (
|
|
773
|
-
while (1) switch (
|
|
1187
|
+
return _regenerator.default.wrap(function (_context34) {
|
|
1188
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
774
1189
|
case 0:
|
|
775
1190
|
handleConnectionRestoreSpy = jest.spyOn(reg, 'handleConnectionRestoration');
|
|
776
1191
|
callingClient['isNetworkDown'] = true;
|
|
777
1192
|
callingClient['networkDownTimestamp'] = '2023-01-01T00:00:00.000Z';
|
|
778
1193
|
callingClient['networkUpTimestamp'] = '2023-01-01T00:01:00.000Z';
|
|
779
1194
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
780
|
-
|
|
1195
|
+
_context34.next = 1;
|
|
781
1196
|
return mercuryOnlineCb();
|
|
782
1197
|
case 1:
|
|
783
1198
|
// Run the interval once
|
|
784
1199
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 100);
|
|
785
|
-
|
|
1200
|
+
_context34.next = 2;
|
|
786
1201
|
return flushPromises();
|
|
787
1202
|
case 2:
|
|
788
1203
|
expect(handleConnectionRestoreSpy).toHaveBeenCalledWith(true);
|
|
@@ -798,14 +1213,14 @@ describe('CallingClient Tests', function () {
|
|
|
798
1213
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.NETWORK_FLAP, _types4.METRIC_TYPE.BEHAVIORAL, '2023-01-01T00:00:00.000Z', '2023-01-01T00:01:00.000Z');
|
|
799
1214
|
case 3:
|
|
800
1215
|
case "end":
|
|
801
|
-
return
|
|
1216
|
+
return _context34.stop();
|
|
802
1217
|
}
|
|
803
|
-
},
|
|
1218
|
+
}, _callee34);
|
|
804
1219
|
})));
|
|
805
|
-
it('no reconnection for idle registration with no active calls after network flap, once mercury comes back up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1220
|
+
it('no reconnection for idle registration with no active calls after network flap, once mercury comes back up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
|
|
806
1221
|
var handleConnectionRestoreSpy, mercuryOnlineCb;
|
|
807
|
-
return _regenerator.default.wrap(function (
|
|
808
|
-
while (1) switch (
|
|
1222
|
+
return _regenerator.default.wrap(function (_context35) {
|
|
1223
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
809
1224
|
case 0:
|
|
810
1225
|
handleConnectionRestoreSpy = jest.spyOn(reg, 'handleConnectionRestoration');
|
|
811
1226
|
callingClient['isNetworkDown'] = true;
|
|
@@ -813,12 +1228,12 @@ describe('CallingClient Tests', function () {
|
|
|
813
1228
|
callingClient['networkUpTimestamp'] = '2023-01-01T00:01:00.000Z';
|
|
814
1229
|
reg.setStatus(_types2.RegistrationStatus.IDLE);
|
|
815
1230
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
816
|
-
|
|
1231
|
+
_context35.next = 1;
|
|
817
1232
|
return mercuryOnlineCb();
|
|
818
1233
|
case 1:
|
|
819
1234
|
// Run the interval once
|
|
820
1235
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 100);
|
|
821
|
-
|
|
1236
|
+
_context35.next = 2;
|
|
822
1237
|
return flushPromises();
|
|
823
1238
|
case 2:
|
|
824
1239
|
expect(handleConnectionRestoreSpy).not.toHaveBeenCalledWith(true);
|
|
@@ -834,14 +1249,14 @@ describe('CallingClient Tests', function () {
|
|
|
834
1249
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.NETWORK_FLAP, _types4.METRIC_TYPE.BEHAVIORAL, '2023-01-01T00:00:00.000Z', '2023-01-01T00:01:00.000Z');
|
|
835
1250
|
case 3:
|
|
836
1251
|
case "end":
|
|
837
|
-
return
|
|
1252
|
+
return _context35.stop();
|
|
838
1253
|
}
|
|
839
|
-
},
|
|
1254
|
+
}, _callee35);
|
|
840
1255
|
})));
|
|
841
|
-
it('handle calls status check once mercury comes back up after a network flap', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1256
|
+
it('handle calls status check once mercury comes back up after a network flap', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
|
|
842
1257
|
var call, callKeepaliveSpy, deleteSpy, mercuryOnlineCb;
|
|
843
|
-
return _regenerator.default.wrap(function (
|
|
844
|
-
while (1) switch (
|
|
1258
|
+
return _regenerator.default.wrap(function (_context36) {
|
|
1259
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
845
1260
|
case 0:
|
|
846
1261
|
callingClient['isNetworkDown'] = true;
|
|
847
1262
|
call = callingClient['callManager'].createCall();
|
|
@@ -849,11 +1264,11 @@ describe('CallingClient Tests', function () {
|
|
|
849
1264
|
deleteSpy = jest.spyOn(call, 'delete');
|
|
850
1265
|
expect((0, _keys.default)(callingClient['callManager'].getActiveCalls()).length).toBe(1);
|
|
851
1266
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
852
|
-
|
|
1267
|
+
_context36.next = 1;
|
|
853
1268
|
return mercuryOnlineCb();
|
|
854
1269
|
case 1:
|
|
855
1270
|
expect(callKeepaliveSpy).toHaveBeenCalled();
|
|
856
|
-
|
|
1271
|
+
_context36.next = 2;
|
|
857
1272
|
return flushPromises();
|
|
858
1273
|
case 2:
|
|
859
1274
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Call Keepalive failed'), {
|
|
@@ -866,25 +1281,25 @@ describe('CallingClient Tests', function () {
|
|
|
866
1281
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.NETWORK_FLAP, _types4.METRIC_TYPE.BEHAVIORAL, expect.any(String), expect.any(String));
|
|
867
1282
|
case 3:
|
|
868
1283
|
case "end":
|
|
869
|
-
return
|
|
1284
|
+
return _context36.stop();
|
|
870
1285
|
}
|
|
871
|
-
},
|
|
1286
|
+
}, _callee36);
|
|
872
1287
|
})));
|
|
873
|
-
it('handle calls status check once mercury comes back up with stable network', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1288
|
+
it('handle calls status check once mercury comes back up with stable network', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
|
|
874
1289
|
var call, callKeepaliveSpy, deleteSpy, mercuryOnlineCb;
|
|
875
|
-
return _regenerator.default.wrap(function (
|
|
876
|
-
while (1) switch (
|
|
1290
|
+
return _regenerator.default.wrap(function (_context37) {
|
|
1291
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
877
1292
|
case 0:
|
|
878
1293
|
call = callingClient['callManager'].createCall();
|
|
879
1294
|
callKeepaliveSpy = jest.spyOn(call, 'postStatus').mockRejectedValueOnce(new Error('keepalive fail'));
|
|
880
1295
|
deleteSpy = jest.spyOn(call, 'delete');
|
|
881
1296
|
expect((0, _keys.default)(callingClient['callManager'].getActiveCalls()).length).toBe(1);
|
|
882
1297
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
883
|
-
|
|
1298
|
+
_context37.next = 1;
|
|
884
1299
|
return mercuryOnlineCb();
|
|
885
1300
|
case 1:
|
|
886
1301
|
expect(callKeepaliveSpy).toHaveBeenCalled();
|
|
887
|
-
|
|
1302
|
+
_context37.next = 2;
|
|
888
1303
|
return flushPromises();
|
|
889
1304
|
case 2:
|
|
890
1305
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Call Keepalive failed'), {
|
|
@@ -897,9 +1312,9 @@ describe('CallingClient Tests', function () {
|
|
|
897
1312
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.MERCURY_UP, _types4.METRIC_TYPE.BEHAVIORAL, expect.any(String), expect.any(String));
|
|
898
1313
|
case 3:
|
|
899
1314
|
case "end":
|
|
900
|
-
return
|
|
1315
|
+
return _context37.stop();
|
|
901
1316
|
}
|
|
902
|
-
},
|
|
1317
|
+
}, _callee37);
|
|
903
1318
|
})));
|
|
904
1319
|
});
|
|
905
1320
|
|
|
@@ -917,15 +1332,15 @@ describe('CallingClient Tests', function () {
|
|
|
917
1332
|
});
|
|
918
1333
|
var callingClient;
|
|
919
1334
|
var line;
|
|
920
|
-
beforeAll(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1335
|
+
beforeAll(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
|
|
921
1336
|
var calls;
|
|
922
|
-
return _regenerator.default.wrap(function (
|
|
923
|
-
while (1) switch (
|
|
1337
|
+
return _regenerator.default.wrap(function (_context38) {
|
|
1338
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
924
1339
|
case 0:
|
|
925
|
-
|
|
1340
|
+
_context38.next = 1;
|
|
926
1341
|
return (0, _CallingClient.createClient)(webex);
|
|
927
1342
|
case 1:
|
|
928
|
-
callingClient =
|
|
1343
|
+
callingClient = _context38.sent;
|
|
929
1344
|
line = new _line.default(userId, clientDeviceUri, mutex, primaryMobiusUris(), backupMobiusUris(), _types.LOGGER.INFO);
|
|
930
1345
|
calls = (0, _values.default)(callManager.getActiveCalls());
|
|
931
1346
|
calls.forEach(function (call) {
|
|
@@ -933,9 +1348,9 @@ describe('CallingClient Tests', function () {
|
|
|
933
1348
|
});
|
|
934
1349
|
case 2:
|
|
935
1350
|
case "end":
|
|
936
|
-
return
|
|
1351
|
+
return _context38.stop();
|
|
937
1352
|
}
|
|
938
|
-
},
|
|
1353
|
+
}, _callee38);
|
|
939
1354
|
})));
|
|
940
1355
|
afterAll(function () {
|
|
941
1356
|
callingClient.removeAllListeners();
|
|
@@ -1018,23 +1433,23 @@ describe('CallingClient Tests', function () {
|
|
|
1018
1433
|
describe('Call Session Event test', function () {
|
|
1019
1434
|
var mockOn = webex.internal.mercury.on;
|
|
1020
1435
|
var callingClient;
|
|
1021
|
-
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1022
|
-
return _regenerator.default.wrap(function (
|
|
1023
|
-
while (1) switch (
|
|
1436
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39() {
|
|
1437
|
+
return _regenerator.default.wrap(function (_context39) {
|
|
1438
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
1024
1439
|
case 0:
|
|
1025
|
-
|
|
1440
|
+
_context39.next = 1;
|
|
1026
1441
|
return (0, _CallingClient.createClient)(webex, {
|
|
1027
1442
|
logger: {
|
|
1028
1443
|
level: _types.LOGGER.INFO
|
|
1029
1444
|
}
|
|
1030
1445
|
});
|
|
1031
1446
|
case 1:
|
|
1032
|
-
callingClient =
|
|
1447
|
+
callingClient = _context39.sent;
|
|
1033
1448
|
case 2:
|
|
1034
1449
|
case "end":
|
|
1035
|
-
return
|
|
1450
|
+
return _context39.stop();
|
|
1036
1451
|
}
|
|
1037
|
-
},
|
|
1452
|
+
}, _callee39);
|
|
1038
1453
|
})));
|
|
1039
1454
|
afterEach(function () {
|
|
1040
1455
|
callingClient.removeAllListeners();
|
|
@@ -1061,38 +1476,180 @@ describe('CallingClient Tests', function () {
|
|
|
1061
1476
|
callSessionCallback(_callRecordFixtures.MOCK_MULTIPLE_SESSIONS_EVENT);
|
|
1062
1477
|
});
|
|
1063
1478
|
});
|
|
1479
|
+
describe('Mobius async_event routing', function () {
|
|
1480
|
+
var callingClient;
|
|
1481
|
+
var asyncEventCallback;
|
|
1482
|
+
var mobiusSocketMock;
|
|
1483
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
|
|
1484
|
+
var asyncEventOnCall;
|
|
1485
|
+
return _regenerator.default.wrap(function (_context40) {
|
|
1486
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
1487
|
+
case 0:
|
|
1488
|
+
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1489
|
+
value: true
|
|
1490
|
+
});
|
|
1491
|
+
_request.APIRequest.resetInstance();
|
|
1492
|
+
_request.APIRequest.getInstance({
|
|
1493
|
+
webex: webex
|
|
1494
|
+
});
|
|
1495
|
+
mobiusSocketMock = jest.requireMock('../mobius-socket').getMobiusSocketInstance(webex);
|
|
1496
|
+
mobiusSocketMock.on.mockClear();
|
|
1497
|
+
mobiusSocketMock.off.mockClear();
|
|
1498
|
+
_context40.next = 1;
|
|
1499
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
1500
|
+
logger: {
|
|
1501
|
+
level: _types.LOGGER.INFO
|
|
1502
|
+
}
|
|
1503
|
+
});
|
|
1504
|
+
case 1:
|
|
1505
|
+
callingClient = _context40.sent;
|
|
1506
|
+
asyncEventOnCall = mobiusSocketMock.on.mock.calls.find(function (call) {
|
|
1507
|
+
return call[0] === 'event:async_event';
|
|
1508
|
+
});
|
|
1509
|
+
asyncEventCallback = asyncEventOnCall[1];
|
|
1510
|
+
case 2:
|
|
1511
|
+
case "end":
|
|
1512
|
+
return _context40.stop();
|
|
1513
|
+
}
|
|
1514
|
+
}, _callee40);
|
|
1515
|
+
})));
|
|
1516
|
+
afterEach(function () {
|
|
1517
|
+
callingClient.removeAllListeners();
|
|
1518
|
+
callManager.removeAllListeners();
|
|
1519
|
+
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1520
|
+
value: false
|
|
1521
|
+
});
|
|
1522
|
+
});
|
|
1523
|
+
it('routes mobius.* async events to callManager', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
|
|
1524
|
+
var callEventSpy;
|
|
1525
|
+
return _regenerator.default.wrap(function (_context41) {
|
|
1526
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
1527
|
+
case 0:
|
|
1528
|
+
callEventSpy = jest.spyOn(callingClient['callManager'], 'dequeueWsEvents').mockImplementation(function () {
|
|
1529
|
+
return undefined;
|
|
1530
|
+
});
|
|
1531
|
+
_context41.next = 1;
|
|
1532
|
+
return asyncEventCallback({
|
|
1533
|
+
type: 'async_event',
|
|
1534
|
+
data: {
|
|
1535
|
+
eventType: 'mobius.call',
|
|
1536
|
+
callId: 'fcf86aa5-5539-4c9f-8b72-667786ae9b6c',
|
|
1537
|
+
callUrl: 'https://mobius-a.wbx2.com/api/v1/calling/web/devices/d1/calls/c1',
|
|
1538
|
+
deviceId: 'd1',
|
|
1539
|
+
correlationId: 'corr-1'
|
|
1540
|
+
}
|
|
1541
|
+
});
|
|
1542
|
+
case 1:
|
|
1543
|
+
expect(callEventSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
1544
|
+
type: 'async_event',
|
|
1545
|
+
data: expect.objectContaining({
|
|
1546
|
+
eventType: 'mobius.call'
|
|
1547
|
+
})
|
|
1548
|
+
}));
|
|
1549
|
+
case 2:
|
|
1550
|
+
case "end":
|
|
1551
|
+
return _context41.stop();
|
|
1552
|
+
}
|
|
1553
|
+
}, _callee41);
|
|
1554
|
+
})));
|
|
1555
|
+
});
|
|
1556
|
+
describe('Mobius socket connection events', function () {
|
|
1557
|
+
var callingClient;
|
|
1558
|
+
var mobiusSocketMock;
|
|
1559
|
+
var getSocketHandlerFor = function getSocketHandlerFor(eventName) {
|
|
1560
|
+
var onCall = mobiusSocketMock.on.mock.calls.find(function (call) {
|
|
1561
|
+
return call[0] === eventName;
|
|
1562
|
+
});
|
|
1563
|
+
return onCall[1];
|
|
1564
|
+
};
|
|
1565
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42() {
|
|
1566
|
+
return _regenerator.default.wrap(function (_context42) {
|
|
1567
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
1568
|
+
case 0:
|
|
1569
|
+
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1570
|
+
value: true
|
|
1571
|
+
});
|
|
1572
|
+
_request.APIRequest.resetInstance();
|
|
1573
|
+
_request.APIRequest.getInstance({
|
|
1574
|
+
webex: webex
|
|
1575
|
+
});
|
|
1576
|
+
mobiusSocketMock = jest.requireMock('../mobius-socket').getMobiusSocketInstance(webex);
|
|
1577
|
+
mobiusSocketMock.on.mockClear();
|
|
1578
|
+
mobiusSocketMock.off.mockClear();
|
|
1579
|
+
mobiusSocketMock.isConnected.mockReturnValue(false);
|
|
1580
|
+
_context42.next = 1;
|
|
1581
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
1582
|
+
logger: {
|
|
1583
|
+
level: _types.LOGGER.INFO
|
|
1584
|
+
}
|
|
1585
|
+
});
|
|
1586
|
+
case 1:
|
|
1587
|
+
callingClient = _context42.sent;
|
|
1588
|
+
case 2:
|
|
1589
|
+
case "end":
|
|
1590
|
+
return _context42.stop();
|
|
1591
|
+
}
|
|
1592
|
+
}, _callee42);
|
|
1593
|
+
})));
|
|
1594
|
+
afterEach(function () {
|
|
1595
|
+
callingClient.removeAllListeners();
|
|
1596
|
+
callManager.removeAllListeners();
|
|
1597
|
+
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1598
|
+
value: false
|
|
1599
|
+
});
|
|
1600
|
+
});
|
|
1601
|
+
it('emits MOBIUS_SOCKET_CONNECTED when the socket comes online', function () {
|
|
1602
|
+
var listener = jest.fn();
|
|
1603
|
+
callingClient.on(_types3.CALLING_CLIENT_EVENT_KEYS.MOBIUS_SOCKET_CONNECTED, listener);
|
|
1604
|
+
getSocketHandlerFor('online')();
|
|
1605
|
+
expect(listener).toHaveBeenCalledTimes(1);
|
|
1606
|
+
});
|
|
1607
|
+
it.each([['offline.permanent', _types3.MOBIUS_SOCKET_DISCONNECT_REASON.PERMANENT], ['offline.transient', _types3.MOBIUS_SOCKET_DISCONNECT_REASON.TRANSIENT], ['offline.replaced', _types3.MOBIUS_SOCKET_DISCONNECT_REASON.REPLACED]])('emits MOBIUS_SOCKET_DISCONNECTED with the matching reason when %s fires', function (eventName, reason) {
|
|
1608
|
+
var listener = jest.fn();
|
|
1609
|
+
callingClient.on(_types3.CALLING_CLIENT_EVENT_KEYS.MOBIUS_SOCKET_DISCONNECTED, listener);
|
|
1610
|
+
getSocketHandlerFor(eventName)();
|
|
1611
|
+
expect(listener).toHaveBeenCalledTimes(1);
|
|
1612
|
+
expect(listener).toHaveBeenCalledWith({
|
|
1613
|
+
reason: reason
|
|
1614
|
+
});
|
|
1615
|
+
});
|
|
1616
|
+
it.each([true, false])('isMobiusSocketConnected() reflects the underlying socket state (%s) when WSS is enabled', function (connected) {
|
|
1617
|
+
mobiusSocketMock.isConnected.mockReturnValue(connected);
|
|
1618
|
+
expect(callingClient.isMobiusSocketConnected()).toBe(connected);
|
|
1619
|
+
});
|
|
1620
|
+
});
|
|
1064
1621
|
describe('getDevices', function () {
|
|
1065
1622
|
var callingClient;
|
|
1066
1623
|
var primaryMobius = 'https://mobius.primary/api/v1/calling/web/';
|
|
1067
1624
|
var backupMobius = 'https://mobius.backup/api/v1/calling/web/';
|
|
1068
|
-
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1069
|
-
return _regenerator.default.wrap(function (
|
|
1070
|
-
while (1) switch (
|
|
1625
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43() {
|
|
1626
|
+
return _regenerator.default.wrap(function (_context43) {
|
|
1627
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
1071
1628
|
case 0:
|
|
1072
|
-
|
|
1629
|
+
_context43.next = 1;
|
|
1073
1630
|
return (0, _CallingClient.createClient)(webex, {
|
|
1074
1631
|
logger: {
|
|
1075
1632
|
level: _types.LOGGER.INFO
|
|
1076
1633
|
}
|
|
1077
1634
|
});
|
|
1078
1635
|
case 1:
|
|
1079
|
-
callingClient =
|
|
1636
|
+
callingClient = _context43.sent;
|
|
1080
1637
|
callingClient.primaryMobiusUris = [primaryMobius];
|
|
1081
1638
|
callingClient.backupMobiusUris = [backupMobius];
|
|
1082
1639
|
webex.request.mockClear();
|
|
1083
1640
|
case 2:
|
|
1084
1641
|
case "end":
|
|
1085
|
-
return
|
|
1642
|
+
return _context43.stop();
|
|
1086
1643
|
}
|
|
1087
|
-
},
|
|
1644
|
+
}, _callee43);
|
|
1088
1645
|
})));
|
|
1089
1646
|
afterEach(function () {
|
|
1090
1647
|
callingClient.removeAllListeners();
|
|
1091
1648
|
});
|
|
1092
|
-
it('fetches devices for the provided userId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1649
|
+
it('fetches devices for the provided userId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee44() {
|
|
1093
1650
|
var devices, responsePayload, response;
|
|
1094
|
-
return _regenerator.default.wrap(function (
|
|
1095
|
-
while (1) switch (
|
|
1651
|
+
return _regenerator.default.wrap(function (_context44) {
|
|
1652
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
1096
1653
|
case 0:
|
|
1097
1654
|
devices = [{
|
|
1098
1655
|
deviceId: 'device-1',
|
|
@@ -1110,10 +1667,10 @@ describe('CallingClient Tests', function () {
|
|
|
1110
1667
|
}
|
|
1111
1668
|
};
|
|
1112
1669
|
webex.request.mockResolvedValue(responsePayload);
|
|
1113
|
-
|
|
1670
|
+
_context44.next = 1;
|
|
1114
1671
|
return callingClient.getDevices('user-123');
|
|
1115
1672
|
case 1:
|
|
1116
|
-
response =
|
|
1673
|
+
response = _context44.sent;
|
|
1117
1674
|
expect(webex.request).toHaveBeenCalledWith({
|
|
1118
1675
|
uri: 'https://mobius.primary/api/v1/calling/web/devices?userid=user-123',
|
|
1119
1676
|
method: _types2.HTTP_METHODS.GET,
|
|
@@ -1123,14 +1680,14 @@ describe('CallingClient Tests', function () {
|
|
|
1123
1680
|
expect(response).toEqual(devices);
|
|
1124
1681
|
case 2:
|
|
1125
1682
|
case "end":
|
|
1126
|
-
return
|
|
1683
|
+
return _context44.stop();
|
|
1127
1684
|
}
|
|
1128
|
-
},
|
|
1685
|
+
}, _callee44);
|
|
1129
1686
|
})));
|
|
1130
|
-
it('falls back to backup Mobius when primary fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1687
|
+
it('falls back to backup Mobius when primary fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45() {
|
|
1131
1688
|
var devices, failurePayload, responsePayload, response, requestCalls;
|
|
1132
|
-
return _regenerator.default.wrap(function (
|
|
1133
|
-
while (1) switch (
|
|
1689
|
+
return _regenerator.default.wrap(function (_context45) {
|
|
1690
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
1134
1691
|
case 0:
|
|
1135
1692
|
devices = [{
|
|
1136
1693
|
deviceId: 'device-2',
|
|
@@ -1151,10 +1708,10 @@ describe('CallingClient Tests', function () {
|
|
|
1151
1708
|
}
|
|
1152
1709
|
};
|
|
1153
1710
|
webex.request.mockRejectedValueOnce(failurePayload).mockResolvedValueOnce(responsePayload);
|
|
1154
|
-
|
|
1711
|
+
_context45.next = 1;
|
|
1155
1712
|
return callingClient.getDevices('user-123');
|
|
1156
1713
|
case 1:
|
|
1157
|
-
response =
|
|
1714
|
+
response = _context45.sent;
|
|
1158
1715
|
requestCalls = webex.request.mock.calls;
|
|
1159
1716
|
expect(requestCalls[0][0]).toEqual({
|
|
1160
1717
|
uri: 'https://mobius.primary/api/v1/calling/web/devices?userid=user-123',
|
|
@@ -1171,9 +1728,9 @@ describe('CallingClient Tests', function () {
|
|
|
1171
1728
|
expect(response).toEqual(devices);
|
|
1172
1729
|
case 2:
|
|
1173
1730
|
case "end":
|
|
1174
|
-
return
|
|
1731
|
+
return _context45.stop();
|
|
1175
1732
|
}
|
|
1176
|
-
},
|
|
1733
|
+
}, _callee45);
|
|
1177
1734
|
})));
|
|
1178
1735
|
});
|
|
1179
1736
|
describe('windowsChromiumIceWarmup', function () {
|
|
@@ -1249,17 +1806,17 @@ describe('CallingClient Tests', function () {
|
|
|
1249
1806
|
afterAll(function () {
|
|
1250
1807
|
global.RTCPeerConnection = origRTCPeerConnection;
|
|
1251
1808
|
});
|
|
1252
|
-
it('should complete without throwing', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1253
|
-
return _regenerator.default.wrap(function (
|
|
1254
|
-
while (1) switch (
|
|
1809
|
+
it('should complete without throwing', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46() {
|
|
1810
|
+
return _regenerator.default.wrap(function (_context46) {
|
|
1811
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
1255
1812
|
case 0:
|
|
1256
|
-
|
|
1813
|
+
_context46.next = 1;
|
|
1257
1814
|
return expect((0, _windowsChromiumIceWarmupUtils.default)({})).resolves.not.toThrow();
|
|
1258
1815
|
case 1:
|
|
1259
1816
|
case "end":
|
|
1260
|
-
return
|
|
1817
|
+
return _context46.stop();
|
|
1261
1818
|
}
|
|
1262
|
-
},
|
|
1819
|
+
}, _callee46);
|
|
1263
1820
|
})));
|
|
1264
1821
|
});
|
|
1265
1822
|
});
|