@webex/calling 3.12.0-next.6 → 3.12.0-next.61
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 +158 -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 +576 -0
- package/dist/CallRecording/WxcCallRecordingConnector.js.map +1 -0
- package/dist/CallRecording/WxcCallRecordingConnector.test.js +651 -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 +49 -0
- package/dist/CallRecording/constants.js.map +1 -0
- package/dist/CallRecording/types.js +136 -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 +454 -224
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +513 -154
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +589 -445
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +695 -445
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +81 -31
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +123 -0
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/calling/types.js +2 -0
- package/dist/CallingClient/calling/types.js.map +1 -1
- package/dist/CallingClient/constants.js +28 -3
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +4 -1
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +16 -1
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +724 -407
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +380 -58
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- 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.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/Events/types.js +38 -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/api.js +56 -0
- package/dist/api.js.map +1 -1
- package/dist/common/Utils.js +156 -51
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +79 -0
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/testUtil.js +10 -5
- package/dist/common/testUtil.js.map +1 -1
- package/dist/common/types.js +3 -0
- package/dist/common/types.js.map +1 -1
- package/dist/index.js +165 -40
- package/dist/index.js.map +1 -1
- package/dist/mobius-socket/config.js +24 -0
- package/dist/mobius-socket/config.js.map +1 -0
- package/dist/mobius-socket/errors.js +143 -0
- package/dist/mobius-socket/errors.js.map +1 -0
- package/dist/mobius-socket/errors.test.js +20 -0
- package/dist/mobius-socket/errors.test.js.map +1 -0
- package/dist/mobius-socket/index.js +57 -0
- package/dist/mobius-socket/index.js.map +1 -0
- package/dist/mobius-socket/mobius-socket-events.test.js +492 -0
- package/dist/mobius-socket/mobius-socket-events.test.js.map +1 -0
- package/dist/mobius-socket/mobius-socket.js +849 -0
- package/dist/mobius-socket/mobius-socket.js.map +1 -0
- package/dist/mobius-socket/mobius-socket.test.js +1898 -0
- package/dist/mobius-socket/mobius-socket.test.js.map +1 -0
- package/dist/mobius-socket/socket/constants.js +55 -0
- package/dist/mobius-socket/socket/constants.js.map +1 -0
- package/dist/mobius-socket/socket/index.js +15 -0
- package/dist/mobius-socket/socket/index.js.map +1 -0
- package/dist/mobius-socket/socket/socket-base.js +604 -0
- package/dist/mobius-socket/socket/socket-base.js.map +1 -0
- package/dist/mobius-socket/socket/socket.js +19 -0
- package/dist/mobius-socket/socket/socket.js.map +1 -0
- package/dist/mobius-socket/socket/socket.shim.js +26 -0
- package/dist/mobius-socket/socket/socket.shim.js.map +1 -0
- package/dist/mobius-socket/socket/types.js +7 -0
- package/dist/mobius-socket/socket/types.js.map +1 -0
- package/dist/mobius-socket/socket.test.js +727 -0
- package/dist/mobius-socket/socket.test.js.map +1 -0
- package/dist/mobius-socket/test/mocha-helpers.js +23 -0
- package/dist/mobius-socket/test/mocha-helpers.js.map +1 -0
- package/dist/mobius-socket/test/promise-tick.js +28 -0
- package/dist/mobius-socket/test/promise-tick.js.map +1 -0
- package/dist/mobius-socket/types.js +7 -0
- package/dist/mobius-socket/types.js.map +1 -0
- package/dist/module/CallRecording/CallRecording.js +56 -0
- package/dist/module/CallRecording/WxcCallRecordingConnector.js +264 -0
- package/dist/module/CallRecording/callRecordingFixtures.js +201 -0
- package/dist/module/CallRecording/constants.js +27 -0
- package/dist/module/CallRecording/types.js +19 -0
- package/dist/module/CallRecording/utils.js +14 -0
- package/dist/module/CallingClient/CallingClient.js +126 -10
- package/dist/module/CallingClient/calling/call.js +177 -61
- package/dist/module/CallingClient/calling/callManager.js +39 -7
- package/dist/module/CallingClient/calling/types.js +2 -0
- package/dist/module/CallingClient/constants.js +24 -0
- package/dist/module/CallingClient/line/index.js +2 -2
- package/dist/module/CallingClient/registration/register.js +239 -63
- 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/Events/types.js +23 -10
- 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 +60 -17
- package/dist/module/common/testUtil.js +6 -1
- package/dist/module/common/types.js +3 -0
- package/dist/module/index.js +7 -3
- package/dist/module/mobius-socket/config.js +15 -0
- package/dist/module/mobius-socket/errors.js +58 -0
- package/dist/module/mobius-socket/index.js +24 -0
- package/dist/module/mobius-socket/mobius-socket.js +593 -0
- package/dist/module/mobius-socket/socket/constants.js +26 -0
- package/dist/module/mobius-socket/socket/index.js +4 -0
- package/dist/module/mobius-socket/socket/socket-base.js +368 -0
- package/dist/module/mobius-socket/socket/socket.js +9 -0
- package/dist/module/mobius-socket/socket/socket.shim.js +12 -0
- package/dist/module/mobius-socket/socket/types.js +1 -0
- package/dist/module/mobius-socket/types.js +1 -0
- package/dist/types/CallRecording/CallRecording.d.ts +18 -0
- package/dist/types/CallRecording/CallRecording.d.ts.map +1 -0
- package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts +23 -0
- package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts.map +1 -0
- package/dist/types/CallRecording/callRecordingFixtures.d.ts +61 -0
- package/dist/types/CallRecording/callRecordingFixtures.d.ts.map +1 -0
- package/dist/types/CallRecording/constants.d.ts +28 -0
- package/dist/types/CallRecording/constants.d.ts.map +1 -0
- package/dist/types/CallRecording/types.d.ts +176 -0
- package/dist/types/CallRecording/types.d.ts.map +1 -0
- package/dist/types/CallRecording/utils.d.ts +3 -0
- package/dist/types/CallRecording/utils.d.ts.map +1 -0
- package/dist/types/CallingClient/CallingClient.d.ts +8 -0
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +12 -0
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/callManager.d.ts +4 -2
- package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/types.d.ts +34 -9
- package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +24 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts +1 -1
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +7 -1
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +4 -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 +1 -0
- 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/Events/types.d.ts +79 -15
- 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 -3
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +5 -1
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +5 -1
- package/dist/types/common/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +8 -3
- 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 -5
- package/src/mobius-socket/socket/socket.shim.ts +22 -0
- package/src/mobius-socket/socket/socket.ts +14 -0
|
@@ -31,14 +31,27 @@ var _callManager = require("./calling/callManager");
|
|
|
31
31
|
var _constants = require("./constants");
|
|
32
32
|
var _callRecordFixtures = require("./callRecordFixtures");
|
|
33
33
|
var _callingClientFixtures = require("./callingClientFixtures");
|
|
34
|
-
var _line =
|
|
34
|
+
var _line = _interopRequireWildcard(require("./line"));
|
|
35
|
+
var LineModule = _line;
|
|
35
36
|
var _registerFixtures = require("./registration/registerFixtures");
|
|
36
37
|
var _constants2 = require("../common/constants");
|
|
37
38
|
var _types4 = require("../Metrics/types");
|
|
38
39
|
var _windowsChromiumIceWarmupUtils = _interopRequireDefault(require("./windowsChromiumIceWarmupUtils"));
|
|
39
|
-
|
|
40
|
+
var _request = require("./utils/request");
|
|
41
|
+
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
42
|
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
43
|
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 */
|
|
44
|
+
jest.mock('../mobius-socket', function () {
|
|
45
|
+
return {
|
|
46
|
+
getMobiusSocketInstance: jest.fn().mockReturnValue({
|
|
47
|
+
sendWssRequest: jest.fn(),
|
|
48
|
+
connect: jest.fn(),
|
|
49
|
+
isConnected: jest.fn().mockReturnValue(false),
|
|
50
|
+
on: jest.fn(),
|
|
51
|
+
off: jest.fn()
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
});
|
|
42
55
|
global.crypto = {
|
|
43
56
|
randomUUID: function randomUUID() {
|
|
44
57
|
return '12345678-1234-5678-1234-567812345678';
|
|
@@ -64,6 +77,12 @@ describe('CallingClient Tests', function () {
|
|
|
64
77
|
originalProcessNextTick(resolve);
|
|
65
78
|
});
|
|
66
79
|
}
|
|
80
|
+
beforeEach(function () {
|
|
81
|
+
_request.APIRequest.resetInstance();
|
|
82
|
+
_request.APIRequest.getInstance({
|
|
83
|
+
webex: webex
|
|
84
|
+
});
|
|
85
|
+
});
|
|
67
86
|
describe('CallingClient pick Mobius cluster using Service Host Tests', function () {
|
|
68
87
|
afterAll(function () {
|
|
69
88
|
callManager.removeAllListeners();
|
|
@@ -316,81 +335,80 @@ describe('CallingClient Tests', function () {
|
|
|
316
335
|
}
|
|
317
336
|
}, _callee0);
|
|
318
337
|
})));
|
|
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;
|
|
338
|
+
it('ContactCenter: uses config domain and does not fetch RTMS domain from catalog', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
339
|
+
var serviceDataObj;
|
|
330
340
|
return _regenerator.default.wrap(function (_context1) {
|
|
331
341
|
while (1) switch (_context1.prev = _context1.next) {
|
|
332
342
|
case 0:
|
|
333
343
|
serviceDataObj = {
|
|
334
344
|
indicator: _types2.ServiceIndicator.CONTACT_CENTER,
|
|
335
|
-
domain: ''
|
|
345
|
+
domain: 'test.example.com'
|
|
336
346
|
};
|
|
337
|
-
|
|
338
|
-
_context1.next =
|
|
347
|
+
webex.internal.services.get = jest.fn();
|
|
348
|
+
_context1.next = 1;
|
|
339
349
|
return (0, _CallingClient.createClient)(webex, {
|
|
340
350
|
serviceData: serviceDataObj
|
|
341
351
|
});
|
|
342
|
-
case
|
|
352
|
+
case 1:
|
|
343
353
|
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:
|
|
354
|
+
expect(callingClient).toBeTruthy();
|
|
355
|
+
expect(webex.internal.services.get).not.toHaveBeenCalled();
|
|
356
|
+
case 2:
|
|
353
357
|
case "end":
|
|
354
358
|
return _context1.stop();
|
|
355
359
|
}
|
|
356
|
-
}, _callee1
|
|
360
|
+
}, _callee1);
|
|
357
361
|
})));
|
|
358
362
|
|
|
359
363
|
/**
|
|
360
364
|
* Input sdk config to callingClient with serviceData carrying valid value for indicator
|
|
361
365
|
* '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
366
|
*/
|
|
367
|
-
it('ContactCenter:
|
|
367
|
+
it('ContactCenter: fetches RTMS domain from catalog when config domain is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
368
368
|
var serviceDataObj;
|
|
369
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
370
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
371
|
+
case 0:
|
|
372
|
+
serviceDataObj = {
|
|
373
|
+
indicator: _types2.ServiceIndicator.CONTACT_CENTER,
|
|
374
|
+
domain: ''
|
|
375
|
+
};
|
|
376
|
+
webex.internal.services.get = jest.fn().mockReturnValue('https://cc-rtms.example.com/calling/web/rtms');
|
|
377
|
+
_context10.next = 1;
|
|
378
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
379
|
+
serviceData: serviceDataObj
|
|
380
|
+
});
|
|
381
|
+
case 1:
|
|
382
|
+
callingClient = _context10.sent;
|
|
383
|
+
expect(callingClient).toBeTruthy();
|
|
384
|
+
expect(webex.internal.services.get).toHaveBeenCalledWith('wcc-calling-rtms-domain');
|
|
385
|
+
case 2:
|
|
386
|
+
case "end":
|
|
387
|
+
return _context10.stop();
|
|
388
|
+
}
|
|
389
|
+
}, _callee10);
|
|
390
|
+
})));
|
|
391
|
+
it('ContactCenter: init fails when config domain is empty and catalog fetch fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
392
|
+
var serviceDataObj, createLineSpy;
|
|
369
393
|
return _regenerator.default.wrap(function (_context11) {
|
|
370
394
|
while (1) switch (_context11.prev = _context11.next) {
|
|
371
395
|
case 0:
|
|
372
396
|
serviceDataObj = {
|
|
373
397
|
indicator: _types2.ServiceIndicator.CONTACT_CENTER,
|
|
374
|
-
domain: '
|
|
398
|
+
domain: ''
|
|
375
399
|
};
|
|
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);
|
|
400
|
+
createLineSpy = jest.spyOn(_CallingClient.CallingClient.prototype, 'createLine');
|
|
401
|
+
webex.internal.services.get = jest.fn(function () {
|
|
402
|
+
throw new Error('catalog unavailable');
|
|
403
|
+
});
|
|
404
|
+
_context11.next = 1;
|
|
405
|
+
return expect((0, _CallingClient.createClient)(webex, {
|
|
406
|
+
serviceData: serviceDataObj
|
|
407
|
+
})).rejects.toThrow('Invalid service domain.');
|
|
393
408
|
case 1:
|
|
409
|
+
expect(createLineSpy).not.toHaveBeenCalled();
|
|
410
|
+
createLineSpy.mockRestore();
|
|
411
|
+
case 2:
|
|
394
412
|
case "end":
|
|
395
413
|
return _context11.stop();
|
|
396
414
|
}
|
|
@@ -566,12 +584,12 @@ describe('CallingClient Tests', function () {
|
|
|
566
584
|
}();
|
|
567
585
|
it.each(mobiusCluster)('%s', /*#__PURE__*/function () {
|
|
568
586
|
var _ref17 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17(clusterName) {
|
|
569
|
-
var
|
|
587
|
+
var _t3;
|
|
570
588
|
return _regenerator.default.wrap(function (_context17) {
|
|
571
589
|
while (1) switch (_context17.prev = _context17.next) {
|
|
572
590
|
case 0:
|
|
573
|
-
|
|
574
|
-
_context17.next =
|
|
591
|
+
_t3 = clusterName;
|
|
592
|
+
_context17.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
593
|
break;
|
|
576
594
|
case 1:
|
|
577
595
|
checkCluster(_callingClientFixtures.mockEUServiceHosts, _callingClientFixtures.mockCatalogEU);
|
|
@@ -631,6 +649,205 @@ describe('CallingClient Tests', function () {
|
|
|
631
649
|
expect(callingClient.getLines()).toEqual(callingClient.lineDict);
|
|
632
650
|
});
|
|
633
651
|
});
|
|
652
|
+
describe('createLine transport URI selection', function () {
|
|
653
|
+
var callingClient;
|
|
654
|
+
var lineCtorSpy;
|
|
655
|
+
var primaryHttp = ['https://primary.example.com/api/v1/calling/web/'];
|
|
656
|
+
var backupHttp = ['https://backup.example.com/api/v1/calling/web/'];
|
|
657
|
+
var primaryWss = ['wss://primary.example.com/api/v1/calling/web/'];
|
|
658
|
+
var backupWss = ['wss://backup.example.com/api/v1/calling/web/'];
|
|
659
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
660
|
+
return _regenerator.default.wrap(function (_context19) {
|
|
661
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
662
|
+
case 0:
|
|
663
|
+
_context19.next = 1;
|
|
664
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
665
|
+
logger: {
|
|
666
|
+
level: _types.LOGGER.INFO
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
case 1:
|
|
670
|
+
callingClient = _context19.sent;
|
|
671
|
+
callingClient.primaryMobiusUris = primaryHttp;
|
|
672
|
+
callingClient.backupMobiusUris = backupHttp;
|
|
673
|
+
lineCtorSpy = jest.spyOn(LineModule, 'default').mockImplementation(function () {
|
|
674
|
+
return {
|
|
675
|
+
lineId: 'mock-line-id'
|
|
676
|
+
};
|
|
677
|
+
});
|
|
678
|
+
case 2:
|
|
679
|
+
case "end":
|
|
680
|
+
return _context19.stop();
|
|
681
|
+
}
|
|
682
|
+
}, _callee19);
|
|
683
|
+
})));
|
|
684
|
+
afterEach(function () {
|
|
685
|
+
lineCtorSpy.mockRestore();
|
|
686
|
+
jest.clearAllMocks();
|
|
687
|
+
callingClient.removeAllListeners();
|
|
688
|
+
callManager.removeAllListeners();
|
|
689
|
+
callingClient = undefined;
|
|
690
|
+
});
|
|
691
|
+
var getLineUris = function getLineUris() {
|
|
692
|
+
var ctorArgs = lineCtorSpy.mock.calls[0];
|
|
693
|
+
return {
|
|
694
|
+
primary: ctorArgs[3],
|
|
695
|
+
backup: ctorArgs[4]
|
|
696
|
+
};
|
|
697
|
+
};
|
|
698
|
+
it('uses normalized WSS URIs for both groups when socket is enabled and WSS URIs are present', function () {
|
|
699
|
+
jest.spyOn(callingClient['apiRequest'], 'isSocketEnabled').mockReturnValue(true);
|
|
700
|
+
callingClient.primaryWssMobiusUris = primaryWss;
|
|
701
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
702
|
+
callingClient['createLine']();
|
|
703
|
+
var _getLineUris = getLineUris(),
|
|
704
|
+
primary = _getLineUris.primary,
|
|
705
|
+
backup = _getLineUris.backup;
|
|
706
|
+
expect(primary).toEqual((0, _Utils.normalizeMobiusUris)(primaryWss));
|
|
707
|
+
expect(backup).toEqual((0, _Utils.normalizeMobiusUris)(backupWss));
|
|
708
|
+
});
|
|
709
|
+
it('falls back to HTTP URIs for a group with no WSS URL even when the socket is enabled', function () {
|
|
710
|
+
jest.spyOn(callingClient['apiRequest'], 'isSocketEnabled').mockReturnValue(true);
|
|
711
|
+
// Primary has no WSS URL (HTTP fallback expected) while backup does.
|
|
712
|
+
callingClient.primaryWssMobiusUris = [];
|
|
713
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
714
|
+
callingClient['createLine']();
|
|
715
|
+
var _getLineUris2 = getLineUris(),
|
|
716
|
+
primary = _getLineUris2.primary,
|
|
717
|
+
backup = _getLineUris2.backup;
|
|
718
|
+
expect(primary).toEqual(primaryHttp);
|
|
719
|
+
expect(backup).toEqual((0, _Utils.normalizeMobiusUris)(backupWss));
|
|
720
|
+
});
|
|
721
|
+
it('uses HTTP URIs for both groups when the socket is enabled but no WSS URLs are present', function () {
|
|
722
|
+
jest.spyOn(callingClient['apiRequest'], 'isSocketEnabled').mockReturnValue(true);
|
|
723
|
+
callingClient.primaryWssMobiusUris = [];
|
|
724
|
+
callingClient.backupWssMobiusUris = [];
|
|
725
|
+
callingClient['createLine']();
|
|
726
|
+
var _getLineUris3 = getLineUris(),
|
|
727
|
+
primary = _getLineUris3.primary,
|
|
728
|
+
backup = _getLineUris3.backup;
|
|
729
|
+
expect(primary).toEqual(primaryHttp);
|
|
730
|
+
expect(backup).toEqual(backupHttp);
|
|
731
|
+
});
|
|
732
|
+
it('uses HTTP URIs for both groups when the socket is disabled', function () {
|
|
733
|
+
jest.spyOn(callingClient['apiRequest'], 'isSocketEnabled').mockReturnValue(false);
|
|
734
|
+
callingClient.primaryWssMobiusUris = primaryWss;
|
|
735
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
736
|
+
callingClient['createLine']();
|
|
737
|
+
var _getLineUris4 = getLineUris(),
|
|
738
|
+
primary = _getLineUris4.primary,
|
|
739
|
+
backup = _getLineUris4.backup;
|
|
740
|
+
expect(primary).toEqual(primaryHttp);
|
|
741
|
+
expect(backup).toEqual(backupHttp);
|
|
742
|
+
});
|
|
743
|
+
});
|
|
744
|
+
describe('connectToMobiusSocket', function () {
|
|
745
|
+
var callingClient;
|
|
746
|
+
var connectSpy;
|
|
747
|
+
var primaryWss = ['wss://primary-1.example.com/api/v1/calling/web/', 'wss://primary-2.example.com/api/v1/calling/web/'];
|
|
748
|
+
var backupWss = ['wss://backup.example.com/api/v1/calling/web/'];
|
|
749
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
750
|
+
return _regenerator.default.wrap(function (_context20) {
|
|
751
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
752
|
+
case 0:
|
|
753
|
+
_context20.next = 1;
|
|
754
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
755
|
+
logger: {
|
|
756
|
+
level: _types.LOGGER.INFO
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
case 1:
|
|
760
|
+
callingClient = _context20.sent;
|
|
761
|
+
connectSpy = jest.spyOn(callingClient['apiRequest'], 'connectToMobiusSocket');
|
|
762
|
+
warnSpy.mockClear();
|
|
763
|
+
case 2:
|
|
764
|
+
case "end":
|
|
765
|
+
return _context20.stop();
|
|
766
|
+
}
|
|
767
|
+
}, _callee20);
|
|
768
|
+
})));
|
|
769
|
+
afterEach(function () {
|
|
770
|
+
jest.clearAllMocks();
|
|
771
|
+
callingClient.removeAllListeners();
|
|
772
|
+
callManager.removeAllListeners();
|
|
773
|
+
callingClient = undefined;
|
|
774
|
+
});
|
|
775
|
+
it('skips the socket connection and warns when no primary WSS URIs are available', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
776
|
+
return _regenerator.default.wrap(function (_context21) {
|
|
777
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
778
|
+
case 0:
|
|
779
|
+
callingClient.primaryWssMobiusUris = [];
|
|
780
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
781
|
+
_context21.next = 1;
|
|
782
|
+
return callingClient['connectToMobiusSocket']();
|
|
783
|
+
case 1:
|
|
784
|
+
expect(connectSpy).not.toHaveBeenCalled();
|
|
785
|
+
expect(warnSpy).toHaveBeenCalledWith('No WSS URIs available from Mobius discovery for primary, skipping socket connection', {
|
|
786
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
787
|
+
method: 'connectToMobiusSocket'
|
|
788
|
+
});
|
|
789
|
+
case 2:
|
|
790
|
+
case "end":
|
|
791
|
+
return _context21.stop();
|
|
792
|
+
}
|
|
793
|
+
}, _callee21);
|
|
794
|
+
})));
|
|
795
|
+
it('connects using the first reachable primary WSS URI and stops on success', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
796
|
+
return _regenerator.default.wrap(function (_context22) {
|
|
797
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
798
|
+
case 0:
|
|
799
|
+
callingClient.primaryWssMobiusUris = primaryWss;
|
|
800
|
+
connectSpy.mockResolvedValue(undefined);
|
|
801
|
+
_context22.next = 1;
|
|
802
|
+
return callingClient['connectToMobiusSocket']();
|
|
803
|
+
case 1:
|
|
804
|
+
expect(connectSpy).toHaveBeenCalledTimes(1);
|
|
805
|
+
expect(connectSpy).toHaveBeenCalledWith(primaryWss[0]);
|
|
806
|
+
case 2:
|
|
807
|
+
case "end":
|
|
808
|
+
return _context22.stop();
|
|
809
|
+
}
|
|
810
|
+
}, _callee22);
|
|
811
|
+
})));
|
|
812
|
+
it('tries each primary WSS URI and warns when all attempts fail', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
813
|
+
return _regenerator.default.wrap(function (_context23) {
|
|
814
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
815
|
+
case 0:
|
|
816
|
+
callingClient.primaryWssMobiusUris = primaryWss;
|
|
817
|
+
connectSpy.mockRejectedValue(new Error('connect failed'));
|
|
818
|
+
_context23.next = 1;
|
|
819
|
+
return callingClient['connectToMobiusSocket']();
|
|
820
|
+
case 1:
|
|
821
|
+
expect(connectSpy).toHaveBeenCalledTimes(primaryWss.length);
|
|
822
|
+
expect(connectSpy).toHaveBeenNthCalledWith(1, primaryWss[0]);
|
|
823
|
+
expect(connectSpy).toHaveBeenNthCalledWith(2, primaryWss[1]);
|
|
824
|
+
expect(warnSpy).toHaveBeenCalledWith('All primary WSS URI connection attempts failed', {
|
|
825
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
826
|
+
method: 'connectToMobiusSocket'
|
|
827
|
+
});
|
|
828
|
+
case 2:
|
|
829
|
+
case "end":
|
|
830
|
+
return _context23.stop();
|
|
831
|
+
}
|
|
832
|
+
}, _callee23);
|
|
833
|
+
})));
|
|
834
|
+
it('does not attempt backup WSS URIs when primary WSS URIs are absent', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
835
|
+
return _regenerator.default.wrap(function (_context24) {
|
|
836
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
837
|
+
case 0:
|
|
838
|
+
callingClient.primaryWssMobiusUris = [];
|
|
839
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
840
|
+
_context24.next = 1;
|
|
841
|
+
return callingClient['connectToMobiusSocket']();
|
|
842
|
+
case 1:
|
|
843
|
+
expect(connectSpy).not.toHaveBeenCalled();
|
|
844
|
+
case 2:
|
|
845
|
+
case "end":
|
|
846
|
+
return _context24.stop();
|
|
847
|
+
}
|
|
848
|
+
}, _callee24);
|
|
849
|
+
})));
|
|
850
|
+
});
|
|
634
851
|
describe('Connectivity and Mercury event handlers', function () {
|
|
635
852
|
var callingClient;
|
|
636
853
|
var line;
|
|
@@ -641,24 +858,24 @@ describe('CallingClient Tests', function () {
|
|
|
641
858
|
var restartRegisterSpy;
|
|
642
859
|
var registerSpy;
|
|
643
860
|
var metricSpy;
|
|
644
|
-
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
645
|
-
return _regenerator.default.wrap(function (
|
|
646
|
-
while (1) switch (
|
|
861
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
862
|
+
return _regenerator.default.wrap(function (_context25) {
|
|
863
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
647
864
|
case 0:
|
|
648
865
|
jest.useFakeTimers();
|
|
649
866
|
webex.request.mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload).mockResolvedValueOnce(_callingClientFixtures.registrationPayload);
|
|
650
867
|
windowEventSpy = jest.spyOn(window, 'addEventListener');
|
|
651
|
-
|
|
868
|
+
_context25.next = 1;
|
|
652
869
|
return (0, _CallingClient.createClient)(webex, {
|
|
653
870
|
logger: {
|
|
654
871
|
level: _types.LOGGER.INFO
|
|
655
872
|
}
|
|
656
873
|
});
|
|
657
874
|
case 1:
|
|
658
|
-
callingClient =
|
|
875
|
+
callingClient = _context25.sent;
|
|
659
876
|
line = (0, _values.default)(callingClient.lineDict)[0];
|
|
660
877
|
reg = line.registration;
|
|
661
|
-
|
|
878
|
+
_context25.next = 2;
|
|
662
879
|
return line.register();
|
|
663
880
|
case 2:
|
|
664
881
|
deRegSpy = jest.spyOn(reg, 'deregister');
|
|
@@ -668,9 +885,9 @@ describe('CallingClient Tests', function () {
|
|
|
668
885
|
metricSpy = jest.spyOn(callingClient['metricManager'], 'submitConnectionMetrics');
|
|
669
886
|
case 3:
|
|
670
887
|
case "end":
|
|
671
|
-
return
|
|
888
|
+
return _context25.stop();
|
|
672
889
|
}
|
|
673
|
-
},
|
|
890
|
+
}, _callee25);
|
|
674
891
|
})));
|
|
675
892
|
afterEach(function () {
|
|
676
893
|
jest.clearAllTimers();
|
|
@@ -681,16 +898,16 @@ describe('CallingClient Tests', function () {
|
|
|
681
898
|
callingClient = undefined;
|
|
682
899
|
jest.useRealTimers();
|
|
683
900
|
});
|
|
684
|
-
it('window offline handler sets networkDown and clears keepalive when network is unreachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
901
|
+
it('window offline handler sets networkDown and clears keepalive when network is unreachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
685
902
|
var g, clearKeepaliveSpy, offlineCb;
|
|
686
|
-
return _regenerator.default.wrap(function (
|
|
687
|
-
while (1) switch (
|
|
903
|
+
return _regenerator.default.wrap(function (_context26) {
|
|
904
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
688
905
|
case 0:
|
|
689
906
|
g = global;
|
|
690
907
|
g.fetch = jest.fn().mockRejectedValueOnce(new Error('network fail'));
|
|
691
908
|
clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
692
909
|
offlineCb = windowEventSpy.mock.calls[1][1];
|
|
693
|
-
|
|
910
|
+
_context26.next = 1;
|
|
694
911
|
return offlineCb();
|
|
695
912
|
case 1:
|
|
696
913
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Network connectivity probe failed'), {
|
|
@@ -701,20 +918,20 @@ describe('CallingClient Tests', function () {
|
|
|
701
918
|
expect(clearKeepaliveSpy).toHaveBeenCalled();
|
|
702
919
|
case 2:
|
|
703
920
|
case "end":
|
|
704
|
-
return
|
|
921
|
+
return _context26.stop();
|
|
705
922
|
}
|
|
706
|
-
},
|
|
923
|
+
}, _callee26);
|
|
707
924
|
})));
|
|
708
|
-
it('window offline handler does not clear keepalive when network is reachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
925
|
+
it('window offline handler does not clear keepalive when network is reachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
|
|
709
926
|
var g, clearKeepaliveSpy, offlineCb;
|
|
710
|
-
return _regenerator.default.wrap(function (
|
|
711
|
-
while (1) switch (
|
|
927
|
+
return _regenerator.default.wrap(function (_context27) {
|
|
928
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
712
929
|
case 0:
|
|
713
930
|
g = global;
|
|
714
931
|
g.fetch = jest.fn().mockResolvedValueOnce({});
|
|
715
932
|
clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
716
933
|
offlineCb = windowEventSpy.mock.calls[1][1];
|
|
717
|
-
|
|
934
|
+
_context27.next = 1;
|
|
718
935
|
return offlineCb();
|
|
719
936
|
case 1:
|
|
720
937
|
expect(g.fetch).toHaveBeenCalledWith('https://www.google.com/generate_204', expect.any(Object));
|
|
@@ -722,17 +939,17 @@ describe('CallingClient Tests', function () {
|
|
|
722
939
|
expect(clearKeepaliveSpy).not.toHaveBeenCalled();
|
|
723
940
|
case 2:
|
|
724
941
|
case "end":
|
|
725
|
-
return
|
|
942
|
+
return _context27.stop();
|
|
726
943
|
}
|
|
727
|
-
},
|
|
944
|
+
}, _callee27);
|
|
728
945
|
})));
|
|
729
|
-
it('window online handler sets networkUpTimestamp and logs', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
946
|
+
it('window online handler sets networkUpTimestamp and logs', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
|
|
730
947
|
var onlineCb;
|
|
731
|
-
return _regenerator.default.wrap(function (
|
|
732
|
-
while (1) switch (
|
|
948
|
+
return _regenerator.default.wrap(function (_context28) {
|
|
949
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
733
950
|
case 0:
|
|
734
951
|
onlineCb = windowEventSpy.mock.calls[0][1];
|
|
735
|
-
|
|
952
|
+
_context28.next = 1;
|
|
736
953
|
return onlineCb();
|
|
737
954
|
case 1:
|
|
738
955
|
expect(callingClient['networkUpTimestamp']).toEqual(expect.any(String));
|
|
@@ -742,17 +959,17 @@ describe('CallingClient Tests', function () {
|
|
|
742
959
|
});
|
|
743
960
|
case 2:
|
|
744
961
|
case "end":
|
|
745
|
-
return
|
|
962
|
+
return _context28.stop();
|
|
746
963
|
}
|
|
747
|
-
},
|
|
964
|
+
}, _callee28);
|
|
748
965
|
})));
|
|
749
|
-
it('mercury offline submits metrics and sets timestamp', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
966
|
+
it('mercury offline submits metrics and sets timestamp', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
|
|
750
967
|
var mercuryOfflineCb;
|
|
751
|
-
return _regenerator.default.wrap(function (
|
|
752
|
-
while (1) switch (
|
|
968
|
+
return _regenerator.default.wrap(function (_context29) {
|
|
969
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
753
970
|
case 0:
|
|
754
971
|
mercuryOfflineCb = webex.internal.mercury.on.mock.calls[1][1];
|
|
755
|
-
|
|
972
|
+
_context29.next = 1;
|
|
756
973
|
return mercuryOfflineCb();
|
|
757
974
|
case 1:
|
|
758
975
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Mercury down, waiting for connection to be up'), {
|
|
@@ -763,26 +980,26 @@ describe('CallingClient Tests', function () {
|
|
|
763
980
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.MERCURY_DOWN, _types4.METRIC_TYPE.BEHAVIORAL, expect.any(String), '');
|
|
764
981
|
case 2:
|
|
765
982
|
case "end":
|
|
766
|
-
return
|
|
983
|
+
return _context29.stop();
|
|
767
984
|
}
|
|
768
|
-
},
|
|
985
|
+
}, _callee29);
|
|
769
986
|
})));
|
|
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
|
|
987
|
+
it('handles reconnection with no active calls after network flap, once mercury comes back up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
|
|
771
988
|
var handleConnectionRestoreSpy, mercuryOnlineCb;
|
|
772
|
-
return _regenerator.default.wrap(function (
|
|
773
|
-
while (1) switch (
|
|
989
|
+
return _regenerator.default.wrap(function (_context30) {
|
|
990
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
774
991
|
case 0:
|
|
775
992
|
handleConnectionRestoreSpy = jest.spyOn(reg, 'handleConnectionRestoration');
|
|
776
993
|
callingClient['isNetworkDown'] = true;
|
|
777
994
|
callingClient['networkDownTimestamp'] = '2023-01-01T00:00:00.000Z';
|
|
778
995
|
callingClient['networkUpTimestamp'] = '2023-01-01T00:01:00.000Z';
|
|
779
996
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
780
|
-
|
|
997
|
+
_context30.next = 1;
|
|
781
998
|
return mercuryOnlineCb();
|
|
782
999
|
case 1:
|
|
783
1000
|
// Run the interval once
|
|
784
1001
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 100);
|
|
785
|
-
|
|
1002
|
+
_context30.next = 2;
|
|
786
1003
|
return flushPromises();
|
|
787
1004
|
case 2:
|
|
788
1005
|
expect(handleConnectionRestoreSpy).toHaveBeenCalledWith(true);
|
|
@@ -798,14 +1015,14 @@ describe('CallingClient Tests', function () {
|
|
|
798
1015
|
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
1016
|
case 3:
|
|
800
1017
|
case "end":
|
|
801
|
-
return
|
|
1018
|
+
return _context30.stop();
|
|
802
1019
|
}
|
|
803
|
-
},
|
|
1020
|
+
}, _callee30);
|
|
804
1021
|
})));
|
|
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
|
|
1022
|
+
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 _callee31() {
|
|
806
1023
|
var handleConnectionRestoreSpy, mercuryOnlineCb;
|
|
807
|
-
return _regenerator.default.wrap(function (
|
|
808
|
-
while (1) switch (
|
|
1024
|
+
return _regenerator.default.wrap(function (_context31) {
|
|
1025
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
809
1026
|
case 0:
|
|
810
1027
|
handleConnectionRestoreSpy = jest.spyOn(reg, 'handleConnectionRestoration');
|
|
811
1028
|
callingClient['isNetworkDown'] = true;
|
|
@@ -813,12 +1030,12 @@ describe('CallingClient Tests', function () {
|
|
|
813
1030
|
callingClient['networkUpTimestamp'] = '2023-01-01T00:01:00.000Z';
|
|
814
1031
|
reg.setStatus(_types2.RegistrationStatus.IDLE);
|
|
815
1032
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
816
|
-
|
|
1033
|
+
_context31.next = 1;
|
|
817
1034
|
return mercuryOnlineCb();
|
|
818
1035
|
case 1:
|
|
819
1036
|
// Run the interval once
|
|
820
1037
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 100);
|
|
821
|
-
|
|
1038
|
+
_context31.next = 2;
|
|
822
1039
|
return flushPromises();
|
|
823
1040
|
case 2:
|
|
824
1041
|
expect(handleConnectionRestoreSpy).not.toHaveBeenCalledWith(true);
|
|
@@ -834,14 +1051,14 @@ describe('CallingClient Tests', function () {
|
|
|
834
1051
|
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
1052
|
case 3:
|
|
836
1053
|
case "end":
|
|
837
|
-
return
|
|
1054
|
+
return _context31.stop();
|
|
838
1055
|
}
|
|
839
|
-
},
|
|
1056
|
+
}, _callee31);
|
|
840
1057
|
})));
|
|
841
|
-
it('handle calls status check once mercury comes back up after a network flap', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1058
|
+
it('handle calls status check once mercury comes back up after a network flap', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
|
|
842
1059
|
var call, callKeepaliveSpy, deleteSpy, mercuryOnlineCb;
|
|
843
|
-
return _regenerator.default.wrap(function (
|
|
844
|
-
while (1) switch (
|
|
1060
|
+
return _regenerator.default.wrap(function (_context32) {
|
|
1061
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
845
1062
|
case 0:
|
|
846
1063
|
callingClient['isNetworkDown'] = true;
|
|
847
1064
|
call = callingClient['callManager'].createCall();
|
|
@@ -849,11 +1066,11 @@ describe('CallingClient Tests', function () {
|
|
|
849
1066
|
deleteSpy = jest.spyOn(call, 'delete');
|
|
850
1067
|
expect((0, _keys.default)(callingClient['callManager'].getActiveCalls()).length).toBe(1);
|
|
851
1068
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
852
|
-
|
|
1069
|
+
_context32.next = 1;
|
|
853
1070
|
return mercuryOnlineCb();
|
|
854
1071
|
case 1:
|
|
855
1072
|
expect(callKeepaliveSpy).toHaveBeenCalled();
|
|
856
|
-
|
|
1073
|
+
_context32.next = 2;
|
|
857
1074
|
return flushPromises();
|
|
858
1075
|
case 2:
|
|
859
1076
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Call Keepalive failed'), {
|
|
@@ -866,25 +1083,25 @@ describe('CallingClient Tests', function () {
|
|
|
866
1083
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.NETWORK_FLAP, _types4.METRIC_TYPE.BEHAVIORAL, expect.any(String), expect.any(String));
|
|
867
1084
|
case 3:
|
|
868
1085
|
case "end":
|
|
869
|
-
return
|
|
1086
|
+
return _context32.stop();
|
|
870
1087
|
}
|
|
871
|
-
},
|
|
1088
|
+
}, _callee32);
|
|
872
1089
|
})));
|
|
873
|
-
it('handle calls status check once mercury comes back up with stable network', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1090
|
+
it('handle calls status check once mercury comes back up with stable network', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
|
|
874
1091
|
var call, callKeepaliveSpy, deleteSpy, mercuryOnlineCb;
|
|
875
|
-
return _regenerator.default.wrap(function (
|
|
876
|
-
while (1) switch (
|
|
1092
|
+
return _regenerator.default.wrap(function (_context33) {
|
|
1093
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
877
1094
|
case 0:
|
|
878
1095
|
call = callingClient['callManager'].createCall();
|
|
879
1096
|
callKeepaliveSpy = jest.spyOn(call, 'postStatus').mockRejectedValueOnce(new Error('keepalive fail'));
|
|
880
1097
|
deleteSpy = jest.spyOn(call, 'delete');
|
|
881
1098
|
expect((0, _keys.default)(callingClient['callManager'].getActiveCalls()).length).toBe(1);
|
|
882
1099
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
883
|
-
|
|
1100
|
+
_context33.next = 1;
|
|
884
1101
|
return mercuryOnlineCb();
|
|
885
1102
|
case 1:
|
|
886
1103
|
expect(callKeepaliveSpy).toHaveBeenCalled();
|
|
887
|
-
|
|
1104
|
+
_context33.next = 2;
|
|
888
1105
|
return flushPromises();
|
|
889
1106
|
case 2:
|
|
890
1107
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Call Keepalive failed'), {
|
|
@@ -897,9 +1114,9 @@ describe('CallingClient Tests', function () {
|
|
|
897
1114
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.MERCURY_UP, _types4.METRIC_TYPE.BEHAVIORAL, expect.any(String), expect.any(String));
|
|
898
1115
|
case 3:
|
|
899
1116
|
case "end":
|
|
900
|
-
return
|
|
1117
|
+
return _context33.stop();
|
|
901
1118
|
}
|
|
902
|
-
},
|
|
1119
|
+
}, _callee33);
|
|
903
1120
|
})));
|
|
904
1121
|
});
|
|
905
1122
|
|
|
@@ -917,15 +1134,15 @@ describe('CallingClient Tests', function () {
|
|
|
917
1134
|
});
|
|
918
1135
|
var callingClient;
|
|
919
1136
|
var line;
|
|
920
|
-
beforeAll(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1137
|
+
beforeAll(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
|
|
921
1138
|
var calls;
|
|
922
|
-
return _regenerator.default.wrap(function (
|
|
923
|
-
while (1) switch (
|
|
1139
|
+
return _regenerator.default.wrap(function (_context34) {
|
|
1140
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
924
1141
|
case 0:
|
|
925
|
-
|
|
1142
|
+
_context34.next = 1;
|
|
926
1143
|
return (0, _CallingClient.createClient)(webex);
|
|
927
1144
|
case 1:
|
|
928
|
-
callingClient =
|
|
1145
|
+
callingClient = _context34.sent;
|
|
929
1146
|
line = new _line.default(userId, clientDeviceUri, mutex, primaryMobiusUris(), backupMobiusUris(), _types.LOGGER.INFO);
|
|
930
1147
|
calls = (0, _values.default)(callManager.getActiveCalls());
|
|
931
1148
|
calls.forEach(function (call) {
|
|
@@ -933,9 +1150,9 @@ describe('CallingClient Tests', function () {
|
|
|
933
1150
|
});
|
|
934
1151
|
case 2:
|
|
935
1152
|
case "end":
|
|
936
|
-
return
|
|
1153
|
+
return _context34.stop();
|
|
937
1154
|
}
|
|
938
|
-
},
|
|
1155
|
+
}, _callee34);
|
|
939
1156
|
})));
|
|
940
1157
|
afterAll(function () {
|
|
941
1158
|
callingClient.removeAllListeners();
|
|
@@ -1018,23 +1235,23 @@ describe('CallingClient Tests', function () {
|
|
|
1018
1235
|
describe('Call Session Event test', function () {
|
|
1019
1236
|
var mockOn = webex.internal.mercury.on;
|
|
1020
1237
|
var callingClient;
|
|
1021
|
-
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1022
|
-
return _regenerator.default.wrap(function (
|
|
1023
|
-
while (1) switch (
|
|
1238
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
|
|
1239
|
+
return _regenerator.default.wrap(function (_context35) {
|
|
1240
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1024
1241
|
case 0:
|
|
1025
|
-
|
|
1242
|
+
_context35.next = 1;
|
|
1026
1243
|
return (0, _CallingClient.createClient)(webex, {
|
|
1027
1244
|
logger: {
|
|
1028
1245
|
level: _types.LOGGER.INFO
|
|
1029
1246
|
}
|
|
1030
1247
|
});
|
|
1031
1248
|
case 1:
|
|
1032
|
-
callingClient =
|
|
1249
|
+
callingClient = _context35.sent;
|
|
1033
1250
|
case 2:
|
|
1034
1251
|
case "end":
|
|
1035
|
-
return
|
|
1252
|
+
return _context35.stop();
|
|
1036
1253
|
}
|
|
1037
|
-
},
|
|
1254
|
+
}, _callee35);
|
|
1038
1255
|
})));
|
|
1039
1256
|
afterEach(function () {
|
|
1040
1257
|
callingClient.removeAllListeners();
|
|
@@ -1061,38 +1278,180 @@ describe('CallingClient Tests', function () {
|
|
|
1061
1278
|
callSessionCallback(_callRecordFixtures.MOCK_MULTIPLE_SESSIONS_EVENT);
|
|
1062
1279
|
});
|
|
1063
1280
|
});
|
|
1281
|
+
describe('Mobius async_event routing', function () {
|
|
1282
|
+
var callingClient;
|
|
1283
|
+
var asyncEventCallback;
|
|
1284
|
+
var mobiusSocketMock;
|
|
1285
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
|
|
1286
|
+
var asyncEventOnCall;
|
|
1287
|
+
return _regenerator.default.wrap(function (_context36) {
|
|
1288
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1289
|
+
case 0:
|
|
1290
|
+
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1291
|
+
value: true
|
|
1292
|
+
});
|
|
1293
|
+
_request.APIRequest.resetInstance();
|
|
1294
|
+
_request.APIRequest.getInstance({
|
|
1295
|
+
webex: webex
|
|
1296
|
+
});
|
|
1297
|
+
mobiusSocketMock = jest.requireMock('../mobius-socket').getMobiusSocketInstance(webex);
|
|
1298
|
+
mobiusSocketMock.on.mockClear();
|
|
1299
|
+
mobiusSocketMock.off.mockClear();
|
|
1300
|
+
_context36.next = 1;
|
|
1301
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
1302
|
+
logger: {
|
|
1303
|
+
level: _types.LOGGER.INFO
|
|
1304
|
+
}
|
|
1305
|
+
});
|
|
1306
|
+
case 1:
|
|
1307
|
+
callingClient = _context36.sent;
|
|
1308
|
+
asyncEventOnCall = mobiusSocketMock.on.mock.calls.find(function (call) {
|
|
1309
|
+
return call[0] === 'event:async_event';
|
|
1310
|
+
});
|
|
1311
|
+
asyncEventCallback = asyncEventOnCall[1];
|
|
1312
|
+
case 2:
|
|
1313
|
+
case "end":
|
|
1314
|
+
return _context36.stop();
|
|
1315
|
+
}
|
|
1316
|
+
}, _callee36);
|
|
1317
|
+
})));
|
|
1318
|
+
afterEach(function () {
|
|
1319
|
+
callingClient.removeAllListeners();
|
|
1320
|
+
callManager.removeAllListeners();
|
|
1321
|
+
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1322
|
+
value: false
|
|
1323
|
+
});
|
|
1324
|
+
});
|
|
1325
|
+
it('routes mobius.* async events to callManager', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
|
|
1326
|
+
var callEventSpy;
|
|
1327
|
+
return _regenerator.default.wrap(function (_context37) {
|
|
1328
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
1329
|
+
case 0:
|
|
1330
|
+
callEventSpy = jest.spyOn(callingClient['callManager'], 'dequeueWsEvents').mockImplementation(function () {
|
|
1331
|
+
return undefined;
|
|
1332
|
+
});
|
|
1333
|
+
_context37.next = 1;
|
|
1334
|
+
return asyncEventCallback({
|
|
1335
|
+
type: 'async_event',
|
|
1336
|
+
data: {
|
|
1337
|
+
eventType: 'mobius.call',
|
|
1338
|
+
callId: 'fcf86aa5-5539-4c9f-8b72-667786ae9b6c',
|
|
1339
|
+
callUrl: 'https://mobius-a.wbx2.com/api/v1/calling/web/devices/d1/calls/c1',
|
|
1340
|
+
deviceId: 'd1',
|
|
1341
|
+
correlationId: 'corr-1'
|
|
1342
|
+
}
|
|
1343
|
+
});
|
|
1344
|
+
case 1:
|
|
1345
|
+
expect(callEventSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
1346
|
+
type: 'async_event',
|
|
1347
|
+
data: expect.objectContaining({
|
|
1348
|
+
eventType: 'mobius.call'
|
|
1349
|
+
})
|
|
1350
|
+
}));
|
|
1351
|
+
case 2:
|
|
1352
|
+
case "end":
|
|
1353
|
+
return _context37.stop();
|
|
1354
|
+
}
|
|
1355
|
+
}, _callee37);
|
|
1356
|
+
})));
|
|
1357
|
+
});
|
|
1358
|
+
describe('Mobius socket connection events', function () {
|
|
1359
|
+
var callingClient;
|
|
1360
|
+
var mobiusSocketMock;
|
|
1361
|
+
var getSocketHandlerFor = function getSocketHandlerFor(eventName) {
|
|
1362
|
+
var onCall = mobiusSocketMock.on.mock.calls.find(function (call) {
|
|
1363
|
+
return call[0] === eventName;
|
|
1364
|
+
});
|
|
1365
|
+
return onCall[1];
|
|
1366
|
+
};
|
|
1367
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
|
|
1368
|
+
return _regenerator.default.wrap(function (_context38) {
|
|
1369
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
1370
|
+
case 0:
|
|
1371
|
+
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1372
|
+
value: true
|
|
1373
|
+
});
|
|
1374
|
+
_request.APIRequest.resetInstance();
|
|
1375
|
+
_request.APIRequest.getInstance({
|
|
1376
|
+
webex: webex
|
|
1377
|
+
});
|
|
1378
|
+
mobiusSocketMock = jest.requireMock('../mobius-socket').getMobiusSocketInstance(webex);
|
|
1379
|
+
mobiusSocketMock.on.mockClear();
|
|
1380
|
+
mobiusSocketMock.off.mockClear();
|
|
1381
|
+
mobiusSocketMock.isConnected.mockReturnValue(false);
|
|
1382
|
+
_context38.next = 1;
|
|
1383
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
1384
|
+
logger: {
|
|
1385
|
+
level: _types.LOGGER.INFO
|
|
1386
|
+
}
|
|
1387
|
+
});
|
|
1388
|
+
case 1:
|
|
1389
|
+
callingClient = _context38.sent;
|
|
1390
|
+
case 2:
|
|
1391
|
+
case "end":
|
|
1392
|
+
return _context38.stop();
|
|
1393
|
+
}
|
|
1394
|
+
}, _callee38);
|
|
1395
|
+
})));
|
|
1396
|
+
afterEach(function () {
|
|
1397
|
+
callingClient.removeAllListeners();
|
|
1398
|
+
callManager.removeAllListeners();
|
|
1399
|
+
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1400
|
+
value: false
|
|
1401
|
+
});
|
|
1402
|
+
});
|
|
1403
|
+
it('emits MOBIUS_SOCKET_CONNECTED when the socket comes online', function () {
|
|
1404
|
+
var listener = jest.fn();
|
|
1405
|
+
callingClient.on(_types3.CALLING_CLIENT_EVENT_KEYS.MOBIUS_SOCKET_CONNECTED, listener);
|
|
1406
|
+
getSocketHandlerFor('online')();
|
|
1407
|
+
expect(listener).toHaveBeenCalledTimes(1);
|
|
1408
|
+
});
|
|
1409
|
+
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) {
|
|
1410
|
+
var listener = jest.fn();
|
|
1411
|
+
callingClient.on(_types3.CALLING_CLIENT_EVENT_KEYS.MOBIUS_SOCKET_DISCONNECTED, listener);
|
|
1412
|
+
getSocketHandlerFor(eventName)();
|
|
1413
|
+
expect(listener).toHaveBeenCalledTimes(1);
|
|
1414
|
+
expect(listener).toHaveBeenCalledWith({
|
|
1415
|
+
reason: reason
|
|
1416
|
+
});
|
|
1417
|
+
});
|
|
1418
|
+
it.each([true, false])('isMobiusSocketConnected() reflects the underlying socket state (%s) when WSS is enabled', function (connected) {
|
|
1419
|
+
mobiusSocketMock.isConnected.mockReturnValue(connected);
|
|
1420
|
+
expect(callingClient.isMobiusSocketConnected()).toBe(connected);
|
|
1421
|
+
});
|
|
1422
|
+
});
|
|
1064
1423
|
describe('getDevices', function () {
|
|
1065
1424
|
var callingClient;
|
|
1066
1425
|
var primaryMobius = 'https://mobius.primary/api/v1/calling/web/';
|
|
1067
1426
|
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 (
|
|
1427
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39() {
|
|
1428
|
+
return _regenerator.default.wrap(function (_context39) {
|
|
1429
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
1071
1430
|
case 0:
|
|
1072
|
-
|
|
1431
|
+
_context39.next = 1;
|
|
1073
1432
|
return (0, _CallingClient.createClient)(webex, {
|
|
1074
1433
|
logger: {
|
|
1075
1434
|
level: _types.LOGGER.INFO
|
|
1076
1435
|
}
|
|
1077
1436
|
});
|
|
1078
1437
|
case 1:
|
|
1079
|
-
callingClient =
|
|
1438
|
+
callingClient = _context39.sent;
|
|
1080
1439
|
callingClient.primaryMobiusUris = [primaryMobius];
|
|
1081
1440
|
callingClient.backupMobiusUris = [backupMobius];
|
|
1082
1441
|
webex.request.mockClear();
|
|
1083
1442
|
case 2:
|
|
1084
1443
|
case "end":
|
|
1085
|
-
return
|
|
1444
|
+
return _context39.stop();
|
|
1086
1445
|
}
|
|
1087
|
-
},
|
|
1446
|
+
}, _callee39);
|
|
1088
1447
|
})));
|
|
1089
1448
|
afterEach(function () {
|
|
1090
1449
|
callingClient.removeAllListeners();
|
|
1091
1450
|
});
|
|
1092
|
-
it('fetches devices for the provided userId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1451
|
+
it('fetches devices for the provided userId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
|
|
1093
1452
|
var devices, responsePayload, response;
|
|
1094
|
-
return _regenerator.default.wrap(function (
|
|
1095
|
-
while (1) switch (
|
|
1453
|
+
return _regenerator.default.wrap(function (_context40) {
|
|
1454
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
1096
1455
|
case 0:
|
|
1097
1456
|
devices = [{
|
|
1098
1457
|
deviceId: 'device-1',
|
|
@@ -1110,10 +1469,10 @@ describe('CallingClient Tests', function () {
|
|
|
1110
1469
|
}
|
|
1111
1470
|
};
|
|
1112
1471
|
webex.request.mockResolvedValue(responsePayload);
|
|
1113
|
-
|
|
1472
|
+
_context40.next = 1;
|
|
1114
1473
|
return callingClient.getDevices('user-123');
|
|
1115
1474
|
case 1:
|
|
1116
|
-
response =
|
|
1475
|
+
response = _context40.sent;
|
|
1117
1476
|
expect(webex.request).toHaveBeenCalledWith({
|
|
1118
1477
|
uri: 'https://mobius.primary/api/v1/calling/web/devices?userid=user-123',
|
|
1119
1478
|
method: _types2.HTTP_METHODS.GET,
|
|
@@ -1123,14 +1482,14 @@ describe('CallingClient Tests', function () {
|
|
|
1123
1482
|
expect(response).toEqual(devices);
|
|
1124
1483
|
case 2:
|
|
1125
1484
|
case "end":
|
|
1126
|
-
return
|
|
1485
|
+
return _context40.stop();
|
|
1127
1486
|
}
|
|
1128
|
-
},
|
|
1487
|
+
}, _callee40);
|
|
1129
1488
|
})));
|
|
1130
|
-
it('falls back to backup Mobius when primary fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1489
|
+
it('falls back to backup Mobius when primary fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
|
|
1131
1490
|
var devices, failurePayload, responsePayload, response, requestCalls;
|
|
1132
|
-
return _regenerator.default.wrap(function (
|
|
1133
|
-
while (1) switch (
|
|
1491
|
+
return _regenerator.default.wrap(function (_context41) {
|
|
1492
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
1134
1493
|
case 0:
|
|
1135
1494
|
devices = [{
|
|
1136
1495
|
deviceId: 'device-2',
|
|
@@ -1151,10 +1510,10 @@ describe('CallingClient Tests', function () {
|
|
|
1151
1510
|
}
|
|
1152
1511
|
};
|
|
1153
1512
|
webex.request.mockRejectedValueOnce(failurePayload).mockResolvedValueOnce(responsePayload);
|
|
1154
|
-
|
|
1513
|
+
_context41.next = 1;
|
|
1155
1514
|
return callingClient.getDevices('user-123');
|
|
1156
1515
|
case 1:
|
|
1157
|
-
response =
|
|
1516
|
+
response = _context41.sent;
|
|
1158
1517
|
requestCalls = webex.request.mock.calls;
|
|
1159
1518
|
expect(requestCalls[0][0]).toEqual({
|
|
1160
1519
|
uri: 'https://mobius.primary/api/v1/calling/web/devices?userid=user-123',
|
|
@@ -1171,9 +1530,9 @@ describe('CallingClient Tests', function () {
|
|
|
1171
1530
|
expect(response).toEqual(devices);
|
|
1172
1531
|
case 2:
|
|
1173
1532
|
case "end":
|
|
1174
|
-
return
|
|
1533
|
+
return _context41.stop();
|
|
1175
1534
|
}
|
|
1176
|
-
},
|
|
1535
|
+
}, _callee41);
|
|
1177
1536
|
})));
|
|
1178
1537
|
});
|
|
1179
1538
|
describe('windowsChromiumIceWarmup', function () {
|
|
@@ -1249,17 +1608,17 @@ describe('CallingClient Tests', function () {
|
|
|
1249
1608
|
afterAll(function () {
|
|
1250
1609
|
global.RTCPeerConnection = origRTCPeerConnection;
|
|
1251
1610
|
});
|
|
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 (
|
|
1611
|
+
it('should complete without throwing', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42() {
|
|
1612
|
+
return _regenerator.default.wrap(function (_context42) {
|
|
1613
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
1255
1614
|
case 0:
|
|
1256
|
-
|
|
1615
|
+
_context42.next = 1;
|
|
1257
1616
|
return expect((0, _windowsChromiumIceWarmupUtils.default)({})).resolves.not.toThrow();
|
|
1258
1617
|
case 1:
|
|
1259
1618
|
case "end":
|
|
1260
|
-
return
|
|
1619
|
+
return _context42.stop();
|
|
1261
1620
|
}
|
|
1262
|
-
},
|
|
1621
|
+
}, _callee42);
|
|
1263
1622
|
})));
|
|
1264
1623
|
});
|
|
1265
1624
|
});
|