@webex/calling 3.12.0-next.5 → 3.12.0-next.51
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/CallingClient/CallingClient.js +506 -223
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +236 -77
- 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 +53 -30
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +35 -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 +27 -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 +714 -407
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +311 -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 +415 -0
- package/dist/CallingClient/utils/request.js.map +1 -0
- package/dist/CallingClient/utils/request.test.js +968 -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 +11 -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/common/Utils.js +138 -44
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/testUtil.js +8 -4
- package/dist/common/testUtil.js.map +1 -1
- package/dist/common/types.js +2 -0
- package/dist/common/types.js.map +1 -1
- package/dist/index.js +12 -0
- 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/CallingClient/CallingClient.js +148 -10
- package/dist/module/CallingClient/calling/call.js +177 -61
- package/dist/module/CallingClient/calling/callManager.js +27 -7
- package/dist/module/CallingClient/calling/types.js +2 -0
- package/dist/module/CallingClient/constants.js +23 -0
- package/dist/module/CallingClient/line/index.js +2 -2
- package/dist/module/CallingClient/registration/register.js +236 -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 +204 -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 +4 -10
- package/dist/module/Metrics/index.js +48 -1
- package/dist/module/Metrics/types.js +18 -0
- package/dist/module/common/Utils.js +52 -12
- package/dist/module/common/testUtil.js +5 -1
- package/dist/module/common/types.js +2 -0
- package/dist/module/index.js +1 -1
- 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/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 +3 -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 +23 -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 +27 -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 +14 -13
- 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 +24 -0
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +9 -2
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +4 -1
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +3 -0
- package/dist/types/common/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- 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
|
@@ -36,9 +36,21 @@ var _registerFixtures = require("./registration/registerFixtures");
|
|
|
36
36
|
var _constants2 = require("../common/constants");
|
|
37
37
|
var _types4 = require("../Metrics/types");
|
|
38
38
|
var _windowsChromiumIceWarmupUtils = _interopRequireDefault(require("./windowsChromiumIceWarmupUtils"));
|
|
39
|
-
|
|
39
|
+
var _request = require("./utils/request");
|
|
40
|
+
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
41
|
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
42
|
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 */
|
|
43
|
+
jest.mock('../mobius-socket', function () {
|
|
44
|
+
return {
|
|
45
|
+
getMobiusSocketInstance: jest.fn().mockReturnValue({
|
|
46
|
+
sendWssRequest: jest.fn(),
|
|
47
|
+
connect: jest.fn(),
|
|
48
|
+
isConnected: jest.fn().mockReturnValue(false),
|
|
49
|
+
on: jest.fn(),
|
|
50
|
+
off: jest.fn()
|
|
51
|
+
})
|
|
52
|
+
};
|
|
53
|
+
});
|
|
42
54
|
global.crypto = {
|
|
43
55
|
randomUUID: function randomUUID() {
|
|
44
56
|
return '12345678-1234-5678-1234-567812345678';
|
|
@@ -64,6 +76,12 @@ describe('CallingClient Tests', function () {
|
|
|
64
76
|
originalProcessNextTick(resolve);
|
|
65
77
|
});
|
|
66
78
|
}
|
|
79
|
+
beforeEach(function () {
|
|
80
|
+
_request.APIRequest.resetInstance();
|
|
81
|
+
_request.APIRequest.getInstance({
|
|
82
|
+
webex: webex
|
|
83
|
+
});
|
|
84
|
+
});
|
|
67
85
|
describe('CallingClient pick Mobius cluster using Service Host Tests', function () {
|
|
68
86
|
afterAll(function () {
|
|
69
87
|
callManager.removeAllListeners();
|
|
@@ -316,81 +334,80 @@ describe('CallingClient Tests', function () {
|
|
|
316
334
|
}
|
|
317
335
|
}, _callee0);
|
|
318
336
|
})));
|
|
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;
|
|
337
|
+
it('ContactCenter: uses config domain and does not fetch RTMS domain from catalog', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
338
|
+
var serviceDataObj;
|
|
330
339
|
return _regenerator.default.wrap(function (_context1) {
|
|
331
340
|
while (1) switch (_context1.prev = _context1.next) {
|
|
332
341
|
case 0:
|
|
333
342
|
serviceDataObj = {
|
|
334
343
|
indicator: _types2.ServiceIndicator.CONTACT_CENTER,
|
|
335
|
-
domain: ''
|
|
344
|
+
domain: 'test.example.com'
|
|
336
345
|
};
|
|
337
|
-
|
|
338
|
-
_context1.next =
|
|
346
|
+
webex.internal.services.get = jest.fn();
|
|
347
|
+
_context1.next = 1;
|
|
339
348
|
return (0, _CallingClient.createClient)(webex, {
|
|
340
349
|
serviceData: serviceDataObj
|
|
341
350
|
});
|
|
342
|
-
case
|
|
351
|
+
case 1:
|
|
343
352
|
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:
|
|
353
|
+
expect(callingClient).toBeTruthy();
|
|
354
|
+
expect(webex.internal.services.get).not.toHaveBeenCalled();
|
|
355
|
+
case 2:
|
|
353
356
|
case "end":
|
|
354
357
|
return _context1.stop();
|
|
355
358
|
}
|
|
356
|
-
}, _callee1
|
|
359
|
+
}, _callee1);
|
|
357
360
|
})));
|
|
358
361
|
|
|
359
362
|
/**
|
|
360
363
|
* Input sdk config to callingClient with serviceData carrying valid value for indicator
|
|
361
364
|
* '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
365
|
*/
|
|
367
|
-
it('ContactCenter:
|
|
366
|
+
it('ContactCenter: fetches RTMS domain from catalog when config domain is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
368
367
|
var serviceDataObj;
|
|
368
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
369
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
370
|
+
case 0:
|
|
371
|
+
serviceDataObj = {
|
|
372
|
+
indicator: _types2.ServiceIndicator.CONTACT_CENTER,
|
|
373
|
+
domain: ''
|
|
374
|
+
};
|
|
375
|
+
webex.internal.services.get = jest.fn().mockReturnValue('https://cc-rtms.example.com/calling/web/rtms');
|
|
376
|
+
_context10.next = 1;
|
|
377
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
378
|
+
serviceData: serviceDataObj
|
|
379
|
+
});
|
|
380
|
+
case 1:
|
|
381
|
+
callingClient = _context10.sent;
|
|
382
|
+
expect(callingClient).toBeTruthy();
|
|
383
|
+
expect(webex.internal.services.get).toHaveBeenCalledWith('wcc-calling-rtms-domain');
|
|
384
|
+
case 2:
|
|
385
|
+
case "end":
|
|
386
|
+
return _context10.stop();
|
|
387
|
+
}
|
|
388
|
+
}, _callee10);
|
|
389
|
+
})));
|
|
390
|
+
it('ContactCenter: init fails when config domain is empty and catalog fetch fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
391
|
+
var serviceDataObj, createLineSpy;
|
|
369
392
|
return _regenerator.default.wrap(function (_context11) {
|
|
370
393
|
while (1) switch (_context11.prev = _context11.next) {
|
|
371
394
|
case 0:
|
|
372
395
|
serviceDataObj = {
|
|
373
396
|
indicator: _types2.ServiceIndicator.CONTACT_CENTER,
|
|
374
|
-
domain: '
|
|
397
|
+
domain: ''
|
|
375
398
|
};
|
|
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);
|
|
399
|
+
createLineSpy = jest.spyOn(_CallingClient.CallingClient.prototype, 'createLine');
|
|
400
|
+
webex.internal.services.get = jest.fn(function () {
|
|
401
|
+
throw new Error('catalog unavailable');
|
|
402
|
+
});
|
|
403
|
+
_context11.next = 1;
|
|
404
|
+
return expect((0, _CallingClient.createClient)(webex, {
|
|
405
|
+
serviceData: serviceDataObj
|
|
406
|
+
})).rejects.toThrow('Invalid service domain.');
|
|
393
407
|
case 1:
|
|
408
|
+
expect(createLineSpy).not.toHaveBeenCalled();
|
|
409
|
+
createLineSpy.mockRestore();
|
|
410
|
+
case 2:
|
|
394
411
|
case "end":
|
|
395
412
|
return _context11.stop();
|
|
396
413
|
}
|
|
@@ -566,12 +583,12 @@ describe('CallingClient Tests', function () {
|
|
|
566
583
|
}();
|
|
567
584
|
it.each(mobiusCluster)('%s', /*#__PURE__*/function () {
|
|
568
585
|
var _ref17 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17(clusterName) {
|
|
569
|
-
var
|
|
586
|
+
var _t3;
|
|
570
587
|
return _regenerator.default.wrap(function (_context17) {
|
|
571
588
|
while (1) switch (_context17.prev = _context17.next) {
|
|
572
589
|
case 0:
|
|
573
|
-
|
|
574
|
-
_context17.next =
|
|
590
|
+
_t3 = clusterName;
|
|
591
|
+
_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
592
|
break;
|
|
576
593
|
case 1:
|
|
577
594
|
checkCluster(_callingClientFixtures.mockEUServiceHosts, _callingClientFixtures.mockCatalogEU);
|
|
@@ -1061,14 +1078,25 @@ describe('CallingClient Tests', function () {
|
|
|
1061
1078
|
callSessionCallback(_callRecordFixtures.MOCK_MULTIPLE_SESSIONS_EVENT);
|
|
1062
1079
|
});
|
|
1063
1080
|
});
|
|
1064
|
-
describe('
|
|
1081
|
+
describe('Mobius async_event routing', function () {
|
|
1065
1082
|
var callingClient;
|
|
1066
|
-
var
|
|
1067
|
-
var
|
|
1083
|
+
var asyncEventCallback;
|
|
1084
|
+
var mobiusSocketMock;
|
|
1068
1085
|
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
|
|
1086
|
+
var asyncEventOnCall;
|
|
1069
1087
|
return _regenerator.default.wrap(function (_context30) {
|
|
1070
1088
|
while (1) switch (_context30.prev = _context30.next) {
|
|
1071
1089
|
case 0:
|
|
1090
|
+
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1091
|
+
value: true
|
|
1092
|
+
});
|
|
1093
|
+
_request.APIRequest.resetInstance();
|
|
1094
|
+
_request.APIRequest.getInstance({
|
|
1095
|
+
webex: webex
|
|
1096
|
+
});
|
|
1097
|
+
mobiusSocketMock = jest.requireMock('../mobius-socket').getMobiusSocketInstance(webex);
|
|
1098
|
+
mobiusSocketMock.on.mockClear();
|
|
1099
|
+
mobiusSocketMock.off.mockClear();
|
|
1072
1100
|
_context30.next = 1;
|
|
1073
1101
|
return (0, _CallingClient.createClient)(webex, {
|
|
1074
1102
|
logger: {
|
|
@@ -1077,9 +1105,10 @@ describe('CallingClient Tests', function () {
|
|
|
1077
1105
|
});
|
|
1078
1106
|
case 1:
|
|
1079
1107
|
callingClient = _context30.sent;
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1108
|
+
asyncEventOnCall = mobiusSocketMock.on.mock.calls.find(function (call) {
|
|
1109
|
+
return call[0] === 'event:async_event';
|
|
1110
|
+
});
|
|
1111
|
+
asyncEventCallback = asyncEventOnCall[1];
|
|
1083
1112
|
case 2:
|
|
1084
1113
|
case "end":
|
|
1085
1114
|
return _context30.stop();
|
|
@@ -1088,11 +1117,141 @@ describe('CallingClient Tests', function () {
|
|
|
1088
1117
|
})));
|
|
1089
1118
|
afterEach(function () {
|
|
1090
1119
|
callingClient.removeAllListeners();
|
|
1120
|
+
callManager.removeAllListeners();
|
|
1121
|
+
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1122
|
+
value: false
|
|
1123
|
+
});
|
|
1091
1124
|
});
|
|
1092
|
-
it('
|
|
1093
|
-
var
|
|
1125
|
+
it('routes mobius.* async events to callManager', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
|
|
1126
|
+
var callEventSpy;
|
|
1094
1127
|
return _regenerator.default.wrap(function (_context31) {
|
|
1095
1128
|
while (1) switch (_context31.prev = _context31.next) {
|
|
1129
|
+
case 0:
|
|
1130
|
+
callEventSpy = jest.spyOn(callingClient['callManager'], 'dequeueWsEvents').mockImplementation(function () {
|
|
1131
|
+
return undefined;
|
|
1132
|
+
});
|
|
1133
|
+
_context31.next = 1;
|
|
1134
|
+
return asyncEventCallback({
|
|
1135
|
+
type: 'async_event',
|
|
1136
|
+
data: {
|
|
1137
|
+
eventType: 'mobius.call',
|
|
1138
|
+
callId: 'fcf86aa5-5539-4c9f-8b72-667786ae9b6c',
|
|
1139
|
+
callUrl: 'https://mobius-a.wbx2.com/api/v1/calling/web/devices/d1/calls/c1',
|
|
1140
|
+
deviceId: 'd1',
|
|
1141
|
+
correlationId: 'corr-1'
|
|
1142
|
+
}
|
|
1143
|
+
});
|
|
1144
|
+
case 1:
|
|
1145
|
+
expect(callEventSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
1146
|
+
type: 'async_event',
|
|
1147
|
+
data: expect.objectContaining({
|
|
1148
|
+
eventType: 'mobius.call'
|
|
1149
|
+
})
|
|
1150
|
+
}));
|
|
1151
|
+
case 2:
|
|
1152
|
+
case "end":
|
|
1153
|
+
return _context31.stop();
|
|
1154
|
+
}
|
|
1155
|
+
}, _callee31);
|
|
1156
|
+
})));
|
|
1157
|
+
});
|
|
1158
|
+
describe('Mobius socket connection events', function () {
|
|
1159
|
+
var callingClient;
|
|
1160
|
+
var mobiusSocketMock;
|
|
1161
|
+
var getSocketHandlerFor = function getSocketHandlerFor(eventName) {
|
|
1162
|
+
var onCall = mobiusSocketMock.on.mock.calls.find(function (call) {
|
|
1163
|
+
return call[0] === eventName;
|
|
1164
|
+
});
|
|
1165
|
+
return onCall[1];
|
|
1166
|
+
};
|
|
1167
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
|
|
1168
|
+
return _regenerator.default.wrap(function (_context32) {
|
|
1169
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1170
|
+
case 0:
|
|
1171
|
+
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1172
|
+
value: true
|
|
1173
|
+
});
|
|
1174
|
+
_request.APIRequest.resetInstance();
|
|
1175
|
+
_request.APIRequest.getInstance({
|
|
1176
|
+
webex: webex
|
|
1177
|
+
});
|
|
1178
|
+
mobiusSocketMock = jest.requireMock('../mobius-socket').getMobiusSocketInstance(webex);
|
|
1179
|
+
mobiusSocketMock.on.mockClear();
|
|
1180
|
+
mobiusSocketMock.off.mockClear();
|
|
1181
|
+
mobiusSocketMock.isConnected.mockReturnValue(false);
|
|
1182
|
+
_context32.next = 1;
|
|
1183
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
1184
|
+
logger: {
|
|
1185
|
+
level: _types.LOGGER.INFO
|
|
1186
|
+
}
|
|
1187
|
+
});
|
|
1188
|
+
case 1:
|
|
1189
|
+
callingClient = _context32.sent;
|
|
1190
|
+
case 2:
|
|
1191
|
+
case "end":
|
|
1192
|
+
return _context32.stop();
|
|
1193
|
+
}
|
|
1194
|
+
}, _callee32);
|
|
1195
|
+
})));
|
|
1196
|
+
afterEach(function () {
|
|
1197
|
+
callingClient.removeAllListeners();
|
|
1198
|
+
callManager.removeAllListeners();
|
|
1199
|
+
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1200
|
+
value: false
|
|
1201
|
+
});
|
|
1202
|
+
});
|
|
1203
|
+
it('emits MOBIUS_SOCKET_CONNECTED when the socket comes online', function () {
|
|
1204
|
+
var listener = jest.fn();
|
|
1205
|
+
callingClient.on(_types3.CALLING_CLIENT_EVENT_KEYS.MOBIUS_SOCKET_CONNECTED, listener);
|
|
1206
|
+
getSocketHandlerFor('online')();
|
|
1207
|
+
expect(listener).toHaveBeenCalledTimes(1);
|
|
1208
|
+
});
|
|
1209
|
+
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) {
|
|
1210
|
+
var listener = jest.fn();
|
|
1211
|
+
callingClient.on(_types3.CALLING_CLIENT_EVENT_KEYS.MOBIUS_SOCKET_DISCONNECTED, listener);
|
|
1212
|
+
getSocketHandlerFor(eventName)();
|
|
1213
|
+
expect(listener).toHaveBeenCalledTimes(1);
|
|
1214
|
+
expect(listener).toHaveBeenCalledWith({
|
|
1215
|
+
reason: reason
|
|
1216
|
+
});
|
|
1217
|
+
});
|
|
1218
|
+
it.each([true, false])('isMobiusSocketConnected() reflects the underlying socket state (%s) when WSS is enabled', function (connected) {
|
|
1219
|
+
mobiusSocketMock.isConnected.mockReturnValue(connected);
|
|
1220
|
+
expect(callingClient.isMobiusSocketConnected()).toBe(connected);
|
|
1221
|
+
});
|
|
1222
|
+
});
|
|
1223
|
+
describe('getDevices', function () {
|
|
1224
|
+
var callingClient;
|
|
1225
|
+
var primaryMobius = 'https://mobius.primary/api/v1/calling/web/';
|
|
1226
|
+
var backupMobius = 'https://mobius.backup/api/v1/calling/web/';
|
|
1227
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
|
|
1228
|
+
return _regenerator.default.wrap(function (_context33) {
|
|
1229
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1230
|
+
case 0:
|
|
1231
|
+
_context33.next = 1;
|
|
1232
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
1233
|
+
logger: {
|
|
1234
|
+
level: _types.LOGGER.INFO
|
|
1235
|
+
}
|
|
1236
|
+
});
|
|
1237
|
+
case 1:
|
|
1238
|
+
callingClient = _context33.sent;
|
|
1239
|
+
callingClient.primaryMobiusUris = [primaryMobius];
|
|
1240
|
+
callingClient.backupMobiusUris = [backupMobius];
|
|
1241
|
+
webex.request.mockClear();
|
|
1242
|
+
case 2:
|
|
1243
|
+
case "end":
|
|
1244
|
+
return _context33.stop();
|
|
1245
|
+
}
|
|
1246
|
+
}, _callee33);
|
|
1247
|
+
})));
|
|
1248
|
+
afterEach(function () {
|
|
1249
|
+
callingClient.removeAllListeners();
|
|
1250
|
+
});
|
|
1251
|
+
it('fetches devices for the provided userId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
|
|
1252
|
+
var devices, responsePayload, response;
|
|
1253
|
+
return _regenerator.default.wrap(function (_context34) {
|
|
1254
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
1096
1255
|
case 0:
|
|
1097
1256
|
devices = [{
|
|
1098
1257
|
deviceId: 'device-1',
|
|
@@ -1110,10 +1269,10 @@ describe('CallingClient Tests', function () {
|
|
|
1110
1269
|
}
|
|
1111
1270
|
};
|
|
1112
1271
|
webex.request.mockResolvedValue(responsePayload);
|
|
1113
|
-
|
|
1272
|
+
_context34.next = 1;
|
|
1114
1273
|
return callingClient.getDevices('user-123');
|
|
1115
1274
|
case 1:
|
|
1116
|
-
response =
|
|
1275
|
+
response = _context34.sent;
|
|
1117
1276
|
expect(webex.request).toHaveBeenCalledWith({
|
|
1118
1277
|
uri: 'https://mobius.primary/api/v1/calling/web/devices?userid=user-123',
|
|
1119
1278
|
method: _types2.HTTP_METHODS.GET,
|
|
@@ -1123,14 +1282,14 @@ describe('CallingClient Tests', function () {
|
|
|
1123
1282
|
expect(response).toEqual(devices);
|
|
1124
1283
|
case 2:
|
|
1125
1284
|
case "end":
|
|
1126
|
-
return
|
|
1285
|
+
return _context34.stop();
|
|
1127
1286
|
}
|
|
1128
|
-
},
|
|
1287
|
+
}, _callee34);
|
|
1129
1288
|
})));
|
|
1130
|
-
it('falls back to backup Mobius when primary fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1289
|
+
it('falls back to backup Mobius when primary fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
|
|
1131
1290
|
var devices, failurePayload, responsePayload, response, requestCalls;
|
|
1132
|
-
return _regenerator.default.wrap(function (
|
|
1133
|
-
while (1) switch (
|
|
1291
|
+
return _regenerator.default.wrap(function (_context35) {
|
|
1292
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1134
1293
|
case 0:
|
|
1135
1294
|
devices = [{
|
|
1136
1295
|
deviceId: 'device-2',
|
|
@@ -1151,10 +1310,10 @@ describe('CallingClient Tests', function () {
|
|
|
1151
1310
|
}
|
|
1152
1311
|
};
|
|
1153
1312
|
webex.request.mockRejectedValueOnce(failurePayload).mockResolvedValueOnce(responsePayload);
|
|
1154
|
-
|
|
1313
|
+
_context35.next = 1;
|
|
1155
1314
|
return callingClient.getDevices('user-123');
|
|
1156
1315
|
case 1:
|
|
1157
|
-
response =
|
|
1316
|
+
response = _context35.sent;
|
|
1158
1317
|
requestCalls = webex.request.mock.calls;
|
|
1159
1318
|
expect(requestCalls[0][0]).toEqual({
|
|
1160
1319
|
uri: 'https://mobius.primary/api/v1/calling/web/devices?userid=user-123',
|
|
@@ -1171,9 +1330,9 @@ describe('CallingClient Tests', function () {
|
|
|
1171
1330
|
expect(response).toEqual(devices);
|
|
1172
1331
|
case 2:
|
|
1173
1332
|
case "end":
|
|
1174
|
-
return
|
|
1333
|
+
return _context35.stop();
|
|
1175
1334
|
}
|
|
1176
|
-
},
|
|
1335
|
+
}, _callee35);
|
|
1177
1336
|
})));
|
|
1178
1337
|
});
|
|
1179
1338
|
describe('windowsChromiumIceWarmup', function () {
|
|
@@ -1249,17 +1408,17 @@ describe('CallingClient Tests', function () {
|
|
|
1249
1408
|
afterAll(function () {
|
|
1250
1409
|
global.RTCPeerConnection = origRTCPeerConnection;
|
|
1251
1410
|
});
|
|
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 (
|
|
1411
|
+
it('should complete without throwing', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
|
|
1412
|
+
return _regenerator.default.wrap(function (_context36) {
|
|
1413
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1255
1414
|
case 0:
|
|
1256
|
-
|
|
1415
|
+
_context36.next = 1;
|
|
1257
1416
|
return expect((0, _windowsChromiumIceWarmupUtils.default)({})).resolves.not.toThrow();
|
|
1258
1417
|
case 1:
|
|
1259
1418
|
case "end":
|
|
1260
|
-
return
|
|
1419
|
+
return _context36.stop();
|
|
1261
1420
|
}
|
|
1262
|
-
},
|
|
1421
|
+
}, _callee36);
|
|
1263
1422
|
})));
|
|
1264
1423
|
});
|
|
1265
1424
|
});
|