@webex/calling 3.12.0-mobius-socket.20 → 3.12.0-mobius-socket.22

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.
@@ -37,7 +37,7 @@ 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 _t5 in e) "default" !== _t5 && {}.hasOwnProperty.call(e, _t5) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t5)) && (i.get || i.set) ? o(f, _t5, i) : f[_t5] = e[_t5]); return f; })(e, t); }
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); }
41
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; }
42
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
43
  jest.mock('../mobius-socket', function () {
@@ -110,9 +110,7 @@ describe('CallingClient Tests', function () {
110
110
  }
111
111
  }, _callee);
112
112
  })));
113
-
114
- // MOBIUS TODO: Remove the skip later. Added for testing purposes.
115
- it.skip('should set mobiusServiceHost correctly when URL is valid', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
113
+ it('should set mobiusServiceHost correctly when URL is valid', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
116
114
  var callingClient;
117
115
  return _regenerator.default.wrap(function (_context2) {
118
116
  while (1) switch (_context2.prev = _context2.next) {
@@ -335,81 +333,80 @@ describe('CallingClient Tests', function () {
335
333
  }
336
334
  }, _callee0);
337
335
  })));
338
-
339
- /**
340
- * Input sdk config to callingClient with serviceData carrying valid value for indicator
341
- * 'contactcenter', but an empty string for domain field in it.
342
- *
343
- * It should throw error and abort execution as domain value is invalid.
344
- *
345
- * DOMAIN field for service type 'contactcenter' must carry a non-empty valid domain type string.
346
- */
347
- it('ContactCenter: verify empty invalid service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
348
- var serviceDataObj, _t3;
336
+ it('ContactCenter: uses config domain and does not fetch RTMS domain from catalog', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
337
+ var serviceDataObj;
349
338
  return _regenerator.default.wrap(function (_context1) {
350
339
  while (1) switch (_context1.prev = _context1.next) {
351
340
  case 0:
352
341
  serviceDataObj = {
353
342
  indicator: _types2.ServiceIndicator.CONTACT_CENTER,
354
- domain: ''
343
+ domain: 'test.example.com'
355
344
  };
356
- _context1.prev = 1;
357
- _context1.next = 2;
345
+ webex.internal.services.get = jest.fn();
346
+ _context1.next = 1;
358
347
  return (0, _CallingClient.createClient)(webex, {
359
348
  serviceData: serviceDataObj
360
349
  });
361
- case 2:
350
+ case 1:
362
351
  callingClient = _context1.sent;
363
- _context1.next = 4;
364
- break;
365
- case 3:
366
- _context1.prev = 3;
367
- _t3 = _context1["catch"](1);
368
- expect(_t3.message).toEqual('Invalid service domain.');
369
- case 4:
370
- expect.assertions(1);
371
- case 5:
352
+ expect(callingClient).toBeTruthy();
353
+ expect(webex.internal.services.get).not.toHaveBeenCalled();
354
+ case 2:
372
355
  case "end":
373
356
  return _context1.stop();
374
357
  }
375
- }, _callee1, null, [[1, 3]]);
358
+ }, _callee1);
376
359
  })));
377
360
 
378
361
  /**
379
362
  * Input sdk config to callingClient with serviceData carrying valid value for indicator
380
363
  * 'contactcenter' , and a valid domain type string for domain field in it.
381
- *
382
- * Execution should proceed properly and createRegistration should be called with same serviceData.
383
- *
384
- * DOMAIN field for service type 'contactcenter' must carry a non-empty valid domain type string.
385
364
  */
386
- it('ContactCenter: verify valid service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
365
+ it('ContactCenter: fetches RTMS domain from catalog when config domain is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
387
366
  var serviceDataObj;
367
+ return _regenerator.default.wrap(function (_context10) {
368
+ while (1) switch (_context10.prev = _context10.next) {
369
+ case 0:
370
+ serviceDataObj = {
371
+ indicator: _types2.ServiceIndicator.CONTACT_CENTER,
372
+ domain: ''
373
+ };
374
+ webex.internal.services.get = jest.fn().mockReturnValue('https://cc-rtms.example.com/calling/web/rtms');
375
+ _context10.next = 1;
376
+ return (0, _CallingClient.createClient)(webex, {
377
+ serviceData: serviceDataObj
378
+ });
379
+ case 1:
380
+ callingClient = _context10.sent;
381
+ expect(callingClient).toBeTruthy();
382
+ expect(webex.internal.services.get).toHaveBeenCalledWith('wcc-calling-rtms-domain');
383
+ case 2:
384
+ case "end":
385
+ return _context10.stop();
386
+ }
387
+ }, _callee10);
388
+ })));
389
+ it('ContactCenter: init fails when config domain is empty and catalog fetch fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
390
+ var serviceDataObj, createLineSpy;
388
391
  return _regenerator.default.wrap(function (_context11) {
389
392
  while (1) switch (_context11.prev = _context11.next) {
390
393
  case 0:
391
394
  serviceDataObj = {
392
395
  indicator: _types2.ServiceIndicator.CONTACT_CENTER,
393
- domain: 'test.example.com'
396
+ domain: ''
394
397
  };
395
- expect(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
396
- return _regenerator.default.wrap(function (_context10) {
397
- while (1) switch (_context10.prev = _context10.next) {
398
- case 0:
399
- _context10.next = 1;
400
- return (0, _CallingClient.createClient)(webex, {
401
- serviceData: serviceDataObj
402
- });
403
- case 1:
404
- callingClient = _context10.sent;
405
- expect(callingClient).toBeTruthy();
406
- case 2:
407
- case "end":
408
- return _context10.stop();
409
- }
410
- }, _callee10);
411
- }))).not.toThrow(Error);
398
+ createLineSpy = jest.spyOn(_CallingClient.CallingClient.prototype, 'createLine');
399
+ webex.internal.services.get = jest.fn(function () {
400
+ throw new Error('catalog unavailable');
401
+ });
402
+ _context11.next = 1;
403
+ return expect((0, _CallingClient.createClient)(webex, {
404
+ serviceData: serviceDataObj
405
+ })).rejects.toThrow('Invalid service domain.');
412
406
  case 1:
407
+ expect(createLineSpy).not.toHaveBeenCalled();
408
+ createLineSpy.mockRestore();
409
+ case 2:
413
410
  case "end":
414
411
  return _context11.stop();
415
412
  }
@@ -447,9 +444,7 @@ describe('CallingClient Tests', function () {
447
444
  callingClient = undefined;
448
445
  jest.useRealTimers();
449
446
  });
450
-
451
- // MOBIUS TODO: Remove the skip later. Added for testing purposes.
452
- it.skip('verify successful mobius server url discovery', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
447
+ it('verify successful mobius server url discovery', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
453
448
  return _regenerator.default.wrap(function (_context13) {
454
449
  while (1) switch (_context13.prev = _context13.next) {
455
450
  case 0:
@@ -482,9 +477,7 @@ describe('CallingClient Tests', function () {
482
477
  }
483
478
  }, _callee13);
484
479
  })));
485
-
486
- // MOBIUS TODO: Remove the skip later. Added for testing purposes.
487
- it.skip('when region discovery succeeds but region based mobius url discovery fails with final error', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
480
+ it('when region discovery succeeds but region based mobius url discovery fails with final error', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
488
481
  var failurePayload;
489
482
  return _regenerator.default.wrap(function (_context14) {
490
483
  while (1) switch (_context14.prev = _context14.next) {
@@ -523,9 +516,7 @@ describe('CallingClient Tests', function () {
523
516
  }
524
517
  }, _callee14);
525
518
  })));
526
-
527
- // MOBIUS TODO: Remove the skip later. Added for testing purposes.
528
- it.skip('Verify successful mobius server url discovery after initializing callingClient through a config', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
519
+ it('Verify successful mobius server url discovery after initializing callingClient through a config', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
529
520
  return _regenerator.default.wrap(function (_context15) {
530
521
  while (1) switch (_context15.prev = _context15.next) {
531
522
  case 0:
@@ -591,12 +582,12 @@ describe('CallingClient Tests', function () {
591
582
  }();
592
583
  it.each(mobiusCluster)('%s', /*#__PURE__*/function () {
593
584
  var _ref17 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17(clusterName) {
594
- var _t4;
585
+ var _t3;
595
586
  return _regenerator.default.wrap(function (_context17) {
596
587
  while (1) switch (_context17.prev = _context17.next) {
597
588
  case 0:
598
- _t4 = clusterName;
599
- _context17.next = _t4 === 'mobius-eu-central-1.prod.infra.webex.com' ? 1 : _t4 === 'mobius-us-east-1.int.infra.webex.com' ? 2 : _t4 === 'mobius-eu-central-1.int.infra.webex.com' ? 3 : 4;
589
+ _t3 = clusterName;
590
+ _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;
600
591
  break;
601
592
  case 1:
602
593
  checkCluster(_callingClientFixtures.mockEUServiceHosts, _callingClientFixtures.mockCatalogEU);