@webex/calling 3.10.0-next.9 → 3.10.0-wxc-disconnect.1
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/CallHistory/CallHistory.js +41 -42
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +5 -120
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.js +6 -6
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +1 -2
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +43 -38
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +1 -4
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +207 -161
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +290 -152
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +40 -37
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +264 -330
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +1 -1
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +4 -5
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +3 -3
- package/dist/CallingClient/registration/webWorker.js.map +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
- package/dist/Contacts/ContactsClient.js +45 -39
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +3 -4
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Events/impl/index.js +1 -1
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/Logger/index.js +3 -3
- package/dist/Logger/index.js.map +1 -1
- package/dist/Logger/index.test.js +1 -1
- package/dist/Logger/index.test.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +54 -47
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +2 -10
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +32 -29
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +102 -77
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +59 -46
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +18 -44
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
- package/dist/common/Utils.js +2 -2
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +8 -4
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/testUtil.js +1 -2
- package/dist/common/testUtil.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +11 -20
- package/dist/module/CallSettings/UcmBackendConnector.js +2 -1
- package/dist/module/CallSettings/WxCallBackendConnector.js +15 -10
- package/dist/module/CallingClient/CallingClient.js +123 -83
- package/dist/module/CallingClient/calling/call.js +19 -13
- package/dist/module/CallingClient/registration/register.js +3 -3
- package/dist/module/CallingClient/registration/webWorker.js +2 -2
- package/dist/module/CallingClient/registration/webWorkerStr.js +2 -2
- package/dist/module/Contacts/ContactsClient.js +25 -19
- package/dist/module/Events/impl/index.js +1 -1
- package/dist/module/Logger/index.js +2 -2
- package/dist/module/Voicemail/BroadworksBackendConnector.js +18 -10
- package/dist/module/Voicemail/UcmBackendConnector.js +11 -7
- package/dist/module/Voicemail/Voicemail.js +68 -42
- package/dist/module/Voicemail/WxCallBackendConnector.js +28 -14
- package/dist/module/common/Utils.js +2 -2
- package/dist/module/common/testUtil.js +0 -1
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.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/Contacts/ContactsClient.d.ts +0 -1
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/Logger/index.d.ts +2 -1
- package/dist/types/Logger/index.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +0 -10
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/Voicemail.d.ts.map +1 -1
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +0 -1
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -52,7 +52,6 @@ describe('CallingClient Tests', function () {
|
|
|
52
52
|
var setLoggerSpy = jest.spyOn(Media, 'setLogger');
|
|
53
53
|
var webex = (0, _testUtil.getTestUtilsWebex)();
|
|
54
54
|
webex.internal.services['_hostCatalog'] = _callingClientFixtures.mockCatalogUS;
|
|
55
|
-
webex.internal.services.getMobiusClusters = jest.fn().mockReturnValue(_callingClientFixtures.mockUSServiceHosts);
|
|
56
55
|
var defaultServiceIndicator = _types2.ServiceIndicator.CALLING;
|
|
57
56
|
var callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
|
|
58
57
|
var infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
@@ -70,48 +69,51 @@ describe('CallingClient Tests', function () {
|
|
|
70
69
|
webex.internal.services['_serviceUrls']['mobius'] = 'https://mobius.aintgen-a-1.int.infra.webex.com/api/v1';
|
|
71
70
|
webex.internal.services['_hostCatalog'] = _callingClientFixtures.mockCatalogUS;
|
|
72
71
|
});
|
|
73
|
-
it('should
|
|
74
|
-
var callingClient;
|
|
72
|
+
it('should set mobiusServiceHost correctly when URL is valid', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
73
|
+
var urlSpy, callingClient;
|
|
75
74
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
76
75
|
while (1) switch (_context.prev = _context.next) {
|
|
77
76
|
case 0:
|
|
78
|
-
webex.internal.services._hostCatalog = _callingClientFixtures.
|
|
79
|
-
webex.internal.services
|
|
80
|
-
|
|
77
|
+
webex.internal.services._hostCatalog = _callingClientFixtures.mockCatalogEU;
|
|
78
|
+
webex.internal.services['_serviceUrls']['mobius'] = 'https://mobius-eu-central-1.prod.infra.webex.com/api/v1';
|
|
79
|
+
urlSpy = jest.spyOn(window, 'URL').mockImplementation(function (url) {
|
|
80
|
+
return new window.URL(url);
|
|
81
|
+
});
|
|
82
|
+
_context.next = 5;
|
|
81
83
|
return (0, _CallingClient.createClient)(webex, {
|
|
82
84
|
logger: {
|
|
83
85
|
level: _types.LOGGER.INFO
|
|
84
86
|
}
|
|
85
87
|
});
|
|
86
|
-
case
|
|
88
|
+
case 5:
|
|
87
89
|
callingClient = _context.sent;
|
|
88
|
-
expect(
|
|
89
|
-
expect(callingClient['mobiusClusters']).toStrictEqual(_callingClientFixtures.
|
|
90
|
-
|
|
90
|
+
expect(urlSpy).toHaveBeenCalledWith('https://mobius-eu-central-1.prod.infra.webex.com/api/v1');
|
|
91
|
+
expect(callingClient['mobiusClusters']).toStrictEqual(_callingClientFixtures.mockEUServiceHosts);
|
|
92
|
+
urlSpy.mockRestore();
|
|
93
|
+
case 9:
|
|
91
94
|
case "end":
|
|
92
95
|
return _context.stop();
|
|
93
96
|
}
|
|
94
97
|
}, _callee);
|
|
95
98
|
})));
|
|
96
|
-
it('should
|
|
99
|
+
it('should use default mobius service host when Service URL is invalid', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
97
100
|
var callingClient;
|
|
98
101
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
99
102
|
while (1) switch (_context2.prev = _context2.next) {
|
|
100
103
|
case 0:
|
|
101
|
-
webex.internal.services._hostCatalog = _callingClientFixtures.
|
|
102
|
-
webex.internal.services.
|
|
103
|
-
|
|
104
|
-
_context2.next = 5;
|
|
104
|
+
webex.internal.services._hostCatalog = _callingClientFixtures.mockCatalogUS;
|
|
105
|
+
webex.internal.services._serviceUrls.mobius = 'invalid-url';
|
|
106
|
+
_context2.next = 4;
|
|
105
107
|
return (0, _CallingClient.createClient)(webex, {
|
|
106
108
|
logger: {
|
|
107
109
|
level: _types.LOGGER.INFO
|
|
108
110
|
}
|
|
109
111
|
});
|
|
110
|
-
case
|
|
112
|
+
case 4:
|
|
111
113
|
callingClient = _context2.sent;
|
|
112
|
-
expect(
|
|
113
|
-
expect(callingClient['mobiusClusters']).toStrictEqual(_callingClientFixtures.
|
|
114
|
-
case
|
|
114
|
+
expect(setLoggerSpy).toHaveBeenCalledTimes(1);
|
|
115
|
+
expect(callingClient['mobiusClusters']).toStrictEqual(_callingClientFixtures.mockUSServiceHosts);
|
|
116
|
+
case 7:
|
|
115
117
|
case "end":
|
|
116
118
|
return _context2.stop();
|
|
117
119
|
}
|
|
@@ -432,7 +434,7 @@ describe('CallingClient Tests', function () {
|
|
|
432
434
|
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
433
435
|
while (1) switch (_context13.prev = _context13.next) {
|
|
434
436
|
case 0:
|
|
435
|
-
webex.request.mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload);
|
|
437
|
+
webex.request.mockResolvedValueOnce(_callingClientFixtures.ipPayload).mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload);
|
|
436
438
|
_context13.next = 3;
|
|
437
439
|
return (0, _CallingClient.createClient)(webex, {
|
|
438
440
|
logger: {
|
|
@@ -441,35 +443,40 @@ describe('CallingClient Tests', function () {
|
|
|
441
443
|
});
|
|
442
444
|
case 3:
|
|
443
445
|
callingClient = _context13.sent;
|
|
444
|
-
expect(webex.request).toBeCalledTimes(
|
|
446
|
+
expect(webex.request).toBeCalledTimes(3);
|
|
445
447
|
expect(callingClient.primaryMobiusUris).toEqual([_callingClientFixtures.primaryUrl]);
|
|
446
448
|
expect(handleErrorSpy).not.toBeCalled();
|
|
447
|
-
expect(webex.request).nthCalledWith(1, {
|
|
449
|
+
expect(webex.request).nthCalledWith(1, _objectSpread(_objectSpread({
|
|
450
|
+
method: 'GET'
|
|
451
|
+
}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
452
|
+
uri: "".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT).concat(_constants.IP_ENDPOINT)
|
|
453
|
+
}));
|
|
454
|
+
expect(webex.request).nthCalledWith(2, {
|
|
448
455
|
method: 'GET',
|
|
449
|
-
uri: "".concat(_constants.DISCOVERY_URL),
|
|
456
|
+
uri: "".concat(_constants.DISCOVERY_URL, "/").concat(_callingClientFixtures.myIP),
|
|
450
457
|
addAuthHeader: false,
|
|
451
458
|
headers: (0, _defineProperty2.default)({}, _constants.SPARK_USER_AGENT, null)
|
|
452
459
|
});
|
|
453
|
-
expect(webex.request).nthCalledWith(
|
|
460
|
+
expect(webex.request).nthCalledWith(3, _objectSpread(_objectSpread({
|
|
454
461
|
method: 'GET'
|
|
455
462
|
}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
456
463
|
uri: "".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT, "?regionCode=").concat(_callingClientFixtures.regionBody.clientRegion, "&countryCode=").concat(_callingClientFixtures.regionBody.countryCode)
|
|
457
464
|
}));
|
|
458
|
-
case
|
|
465
|
+
case 10:
|
|
459
466
|
case "end":
|
|
460
467
|
return _context13.stop();
|
|
461
468
|
}
|
|
462
469
|
}, _callee13);
|
|
463
470
|
})));
|
|
464
|
-
it('when region discovery
|
|
471
|
+
it('case when region discovery fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
465
472
|
var failurePayload;
|
|
466
473
|
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
467
474
|
while (1) switch (_context14.prev = _context14.next) {
|
|
468
475
|
case 0:
|
|
469
476
|
failurePayload = {
|
|
470
|
-
statusCode:
|
|
477
|
+
statusCode: 500
|
|
471
478
|
};
|
|
472
|
-
webex.request.
|
|
479
|
+
webex.request.mockRejectedValue(failurePayload);
|
|
473
480
|
_context14.next = 4;
|
|
474
481
|
return (0, _CallingClient.createClient)(webex, {
|
|
475
482
|
logger: {
|
|
@@ -478,35 +485,167 @@ describe('CallingClient Tests', function () {
|
|
|
478
485
|
});
|
|
479
486
|
case 4:
|
|
480
487
|
callingClient = _context14.sent;
|
|
488
|
+
expect(webex.request).nthCalledWith(1, _objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
489
|
+
uri: 'https://mobius-us-east-1.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
490
|
+
method: 'GET'
|
|
491
|
+
}));
|
|
492
|
+
expect(webex.request).nthCalledWith(2, _objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
493
|
+
uri: 'https://mobius-ca-central-1.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
494
|
+
method: 'GET'
|
|
495
|
+
}));
|
|
496
|
+
expect(webex.request).nthCalledWith(3, _objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
497
|
+
uri: 'https://mobius-eu-central-1.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
498
|
+
method: 'GET'
|
|
499
|
+
}));
|
|
500
|
+
expect(webex.request).nthCalledWith(4, _objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
501
|
+
uri: 'https://mobius-ap-southeast-2.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
502
|
+
method: 'GET'
|
|
503
|
+
}));
|
|
481
504
|
expect(handleErrorSpy).toBeCalledWith(failurePayload, expect.anything(), {
|
|
482
505
|
file: _constants.CALLING_CLIENT_FILE,
|
|
483
506
|
method: 'getMobiusServers'
|
|
484
507
|
});
|
|
485
|
-
expect(webex.request).toBeCalledTimes(2);
|
|
486
508
|
expect(callingClient.primaryMobiusUris).toEqual(["".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT)]);
|
|
487
|
-
expect(webex.request).nthCalledWith(1, {
|
|
488
|
-
method: 'GET',
|
|
489
|
-
uri: "".concat(_constants.DISCOVERY_URL),
|
|
490
|
-
addAuthHeader: false,
|
|
491
|
-
headers: (0, _defineProperty2.default)({}, _constants.SPARK_USER_AGENT, null)
|
|
492
|
-
});
|
|
493
509
|
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers", expect.objectContaining({
|
|
494
510
|
file: _constants.CALLING_CLIENT_FILE,
|
|
495
511
|
method: 'getMobiusServers'
|
|
496
512
|
}));
|
|
497
|
-
case
|
|
513
|
+
case 12:
|
|
498
514
|
case "end":
|
|
499
515
|
return _context14.stop();
|
|
500
516
|
}
|
|
501
517
|
}, _callee14);
|
|
502
518
|
})));
|
|
503
|
-
it('
|
|
519
|
+
it('case when /myIP failed with 401', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
520
|
+
var failurePayload;
|
|
504
521
|
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
505
522
|
while (1) switch (_context15.prev = _context15.next) {
|
|
523
|
+
case 0:
|
|
524
|
+
failurePayload = {
|
|
525
|
+
statusCode: 401
|
|
526
|
+
};
|
|
527
|
+
webex.request.mockRejectedValueOnce(failurePayload);
|
|
528
|
+
_context15.next = 4;
|
|
529
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
530
|
+
logger: {
|
|
531
|
+
level: _types.LOGGER.INFO
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
case 4:
|
|
535
|
+
callingClient = _context15.sent;
|
|
536
|
+
expect(webex.request).toBeCalledOnceWith(_objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
537
|
+
uri: 'https://mobius-us-east-1.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
538
|
+
method: 'GET'
|
|
539
|
+
}));
|
|
540
|
+
expect(handleErrorSpy).toBeCalledOnceWith(failurePayload, expect.anything(), {
|
|
541
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
542
|
+
method: 'getMobiusServers'
|
|
543
|
+
});
|
|
544
|
+
expect(callingClient.primaryMobiusUris).toEqual(["".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT)]);
|
|
545
|
+
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers", expect.objectContaining({
|
|
546
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
547
|
+
method: 'getMobiusServers'
|
|
548
|
+
}));
|
|
549
|
+
case 9:
|
|
550
|
+
case "end":
|
|
551
|
+
return _context15.stop();
|
|
552
|
+
}
|
|
553
|
+
}, _callee15);
|
|
554
|
+
})));
|
|
555
|
+
it('when region discovery succeeds but region based mobius url discovery fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
556
|
+
var failurePayload;
|
|
557
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
558
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
559
|
+
case 0:
|
|
560
|
+
failurePayload = {
|
|
561
|
+
statusCode: 500
|
|
562
|
+
};
|
|
563
|
+
webex.request.mockResolvedValueOnce(_callingClientFixtures.ipPayload).mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockRejectedValueOnce(failurePayload);
|
|
564
|
+
_context16.next = 4;
|
|
565
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
566
|
+
logger: {
|
|
567
|
+
level: _types.LOGGER.INFO
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
case 4:
|
|
571
|
+
callingClient = _context16.sent;
|
|
572
|
+
expect(handleErrorSpy).toBeCalledWith(failurePayload, expect.anything(), {
|
|
573
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
574
|
+
method: 'getMobiusServers'
|
|
575
|
+
});
|
|
576
|
+
expect(webex.request).toBeCalledTimes(3);
|
|
577
|
+
expect(callingClient.primaryMobiusUris).toEqual(["".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT)]);
|
|
578
|
+
expect(webex.request).nthCalledWith(1, _objectSpread(_objectSpread({
|
|
579
|
+
method: 'GET'
|
|
580
|
+
}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
581
|
+
uri: "".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT).concat(_constants.IP_ENDPOINT)
|
|
582
|
+
}));
|
|
583
|
+
expect(webex.request).nthCalledWith(2, {
|
|
584
|
+
method: 'GET',
|
|
585
|
+
uri: "".concat(_constants.DISCOVERY_URL, "/").concat(_callingClientFixtures.myIP),
|
|
586
|
+
addAuthHeader: false,
|
|
587
|
+
headers: (0, _defineProperty2.default)({}, _constants.SPARK_USER_AGENT, null)
|
|
588
|
+
});
|
|
589
|
+
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers", expect.objectContaining({
|
|
590
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
591
|
+
method: 'getMobiusServers'
|
|
592
|
+
}));
|
|
593
|
+
case 11:
|
|
594
|
+
case "end":
|
|
595
|
+
return _context16.stop();
|
|
596
|
+
}
|
|
597
|
+
}, _callee16);
|
|
598
|
+
})));
|
|
599
|
+
it('case when discovery failed with 401', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
600
|
+
var failurePayload;
|
|
601
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
602
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
603
|
+
case 0:
|
|
604
|
+
failurePayload = {
|
|
605
|
+
statusCode: 401
|
|
606
|
+
};
|
|
607
|
+
webex.request.mockResolvedValueOnce(_callingClientFixtures.ipPayload).mockRejectedValueOnce(failurePayload);
|
|
608
|
+
_context17.next = 4;
|
|
609
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
610
|
+
logger: {
|
|
611
|
+
level: _types.LOGGER.INFO
|
|
612
|
+
}
|
|
613
|
+
});
|
|
614
|
+
case 4:
|
|
615
|
+
callingClient = _context17.sent;
|
|
616
|
+
expect(webex.request).toBeCalledTimes(2);
|
|
617
|
+
expect(webex.request).nthCalledWith(1, _objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
618
|
+
uri: 'https://mobius-us-east-1.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
619
|
+
method: 'GET'
|
|
620
|
+
}));
|
|
621
|
+
expect(webex.request).nthCalledWith(2, {
|
|
622
|
+
method: 'GET',
|
|
623
|
+
uri: "".concat(_constants.DISCOVERY_URL, "/").concat(_callingClientFixtures.myIP),
|
|
624
|
+
addAuthHeader: false,
|
|
625
|
+
headers: (0, _defineProperty2.default)({}, _constants.SPARK_USER_AGENT, null)
|
|
626
|
+
});
|
|
627
|
+
expect(handleErrorSpy).toBeCalledOnceWith(failurePayload, expect.anything(), {
|
|
628
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
629
|
+
method: 'getMobiusServers'
|
|
630
|
+
});
|
|
631
|
+
expect(callingClient.primaryMobiusUris).toEqual(["".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT)]);
|
|
632
|
+
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers", expect.objectContaining({
|
|
633
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
634
|
+
method: 'getMobiusServers'
|
|
635
|
+
}));
|
|
636
|
+
case 11:
|
|
637
|
+
case "end":
|
|
638
|
+
return _context17.stop();
|
|
639
|
+
}
|
|
640
|
+
}, _callee17);
|
|
641
|
+
})));
|
|
642
|
+
it('Verify successful mobius server url discovery after initializing callingClient through a config', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
643
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
644
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
506
645
|
case 0:
|
|
507
646
|
infoSpy.mockReset();
|
|
508
647
|
webex.request.mockResolvedValueOnce(_callingClientFixtures.discoveryPayload);
|
|
509
|
-
|
|
648
|
+
_context18.next = 4;
|
|
510
649
|
return (0, _CallingClient.createClient)(webex, {
|
|
511
650
|
discovery: {
|
|
512
651
|
region: 'AP-SOUTHEAST',
|
|
@@ -517,7 +656,7 @@ describe('CallingClient Tests', function () {
|
|
|
517
656
|
}
|
|
518
657
|
});
|
|
519
658
|
case 4:
|
|
520
|
-
callingClient =
|
|
659
|
+
callingClient = _context18.sent;
|
|
521
660
|
expect(callingClient.primaryMobiusUris).toEqual([_callingClientFixtures.primaryUrl]);
|
|
522
661
|
expect(infoSpy).toHaveBeenCalledWith(_constants2.METHOD_START_MESSAGE, {
|
|
523
662
|
file: 'CallingClient',
|
|
@@ -530,87 +669,86 @@ describe('CallingClient Tests', function () {
|
|
|
530
669
|
expect(handleErrorSpy).not.toHaveBeenCalled();
|
|
531
670
|
case 9:
|
|
532
671
|
case "end":
|
|
533
|
-
return
|
|
672
|
+
return _context18.stop();
|
|
534
673
|
}
|
|
535
|
-
},
|
|
674
|
+
}, _callee18);
|
|
536
675
|
})));
|
|
537
676
|
});
|
|
538
677
|
describe('Testing each cluster present withing host catalog', function () {
|
|
539
678
|
var mobiusCluster = ['mobius-eu-central-1.prod.infra.webex.com', 'mobius-us-east-1.int.infra.webex.com', 'mobius-eu-central-1.int.infra.webex.com'];
|
|
540
679
|
var checkCluster = /*#__PURE__*/function () {
|
|
541
|
-
var
|
|
680
|
+
var _ref19 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19(mockServiceHosts, mockCatalog) {
|
|
542
681
|
var callingClient;
|
|
543
|
-
return _regenerator.default.wrap(function
|
|
544
|
-
while (1) switch (
|
|
682
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
683
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
545
684
|
case 0:
|
|
546
685
|
webex.internal.services._hostCatalog = mockCatalog;
|
|
547
|
-
|
|
548
|
-
_context16.next = 4;
|
|
686
|
+
_context19.next = 3;
|
|
549
687
|
return (0, _CallingClient.createClient)(webex, {
|
|
550
688
|
logger: {
|
|
551
689
|
level: _types.LOGGER.INFO
|
|
552
690
|
}
|
|
553
691
|
});
|
|
554
|
-
case
|
|
555
|
-
callingClient =
|
|
692
|
+
case 3:
|
|
693
|
+
callingClient = _context19.sent;
|
|
556
694
|
expect(callingClient['mobiusClusters']).toStrictEqual(mockServiceHosts);
|
|
557
|
-
case
|
|
695
|
+
case 5:
|
|
558
696
|
case "end":
|
|
559
|
-
return
|
|
697
|
+
return _context19.stop();
|
|
560
698
|
}
|
|
561
|
-
},
|
|
699
|
+
}, _callee19);
|
|
562
700
|
}));
|
|
563
701
|
return function checkCluster(_x, _x2) {
|
|
564
|
-
return
|
|
702
|
+
return _ref19.apply(this, arguments);
|
|
565
703
|
};
|
|
566
704
|
}();
|
|
567
705
|
it.each(mobiusCluster)('%s', /*#__PURE__*/function () {
|
|
568
|
-
var
|
|
569
|
-
return _regenerator.default.wrap(function
|
|
570
|
-
while (1) switch (
|
|
706
|
+
var _ref20 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20(clusterName) {
|
|
707
|
+
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
708
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
571
709
|
case 0:
|
|
572
|
-
|
|
573
|
-
|
|
710
|
+
_context20.t0 = clusterName;
|
|
711
|
+
_context20.next = _context20.t0 === 'mobius-eu-central-1.prod.infra.webex.com' ? 3 : _context20.t0 === 'mobius-us-east-1.int.infra.webex.com' ? 5 : _context20.t0 === 'mobius-eu-central-1.int.infra.webex.com' ? 7 : 9;
|
|
574
712
|
break;
|
|
575
713
|
case 3:
|
|
576
714
|
checkCluster(_callingClientFixtures.mockEUServiceHosts, _callingClientFixtures.mockCatalogEU);
|
|
577
|
-
return
|
|
715
|
+
return _context20.abrupt("break", 10);
|
|
578
716
|
case 5:
|
|
579
717
|
checkCluster(_callingClientFixtures.mockIntServiceHosts, _callingClientFixtures.mockCatalogUSInt);
|
|
580
|
-
return
|
|
718
|
+
return _context20.abrupt("break", 10);
|
|
581
719
|
case 7:
|
|
582
720
|
checkCluster(_callingClientFixtures.mockEUIntServiceHosts, _callingClientFixtures.mockCatalogEUInt);
|
|
583
|
-
return
|
|
721
|
+
return _context20.abrupt("break", 10);
|
|
584
722
|
case 9:
|
|
585
|
-
return
|
|
723
|
+
return _context20.abrupt("break", 10);
|
|
586
724
|
case 10:
|
|
587
725
|
case "end":
|
|
588
|
-
return
|
|
726
|
+
return _context20.stop();
|
|
589
727
|
}
|
|
590
|
-
},
|
|
728
|
+
}, _callee20);
|
|
591
729
|
}));
|
|
592
730
|
return function (_x3) {
|
|
593
|
-
return
|
|
731
|
+
return _ref20.apply(this, arguments);
|
|
594
732
|
};
|
|
595
733
|
}());
|
|
596
734
|
});
|
|
597
735
|
describe('Line creation tests', function () {
|
|
598
736
|
var callingClient;
|
|
599
737
|
var line;
|
|
600
|
-
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
601
|
-
return _regenerator.default.wrap(function
|
|
602
|
-
while (1) switch (
|
|
738
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
739
|
+
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
740
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
603
741
|
case 0:
|
|
604
|
-
|
|
742
|
+
_context21.next = 2;
|
|
605
743
|
return (0, _CallingClient.createClient)(webex);
|
|
606
744
|
case 2:
|
|
607
|
-
callingClient =
|
|
745
|
+
callingClient = _context21.sent;
|
|
608
746
|
line = (0, _values.default)(callingClient.lineDict)[0];
|
|
609
747
|
case 4:
|
|
610
748
|
case "end":
|
|
611
|
-
return
|
|
749
|
+
return _context21.stop();
|
|
612
750
|
}
|
|
613
|
-
},
|
|
751
|
+
}, _callee21);
|
|
614
752
|
})));
|
|
615
753
|
afterEach(function () {
|
|
616
754
|
jest.clearAllTimers();
|
|
@@ -640,24 +778,24 @@ describe('CallingClient Tests', function () {
|
|
|
640
778
|
var restartRegisterSpy;
|
|
641
779
|
var registerSpy;
|
|
642
780
|
var metricSpy;
|
|
643
|
-
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
644
|
-
return _regenerator.default.wrap(function
|
|
645
|
-
while (1) switch (
|
|
781
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
782
|
+
return _regenerator.default.wrap(function _callee22$(_context22) {
|
|
783
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
646
784
|
case 0:
|
|
647
785
|
jest.useFakeTimers();
|
|
648
|
-
webex.request.mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload).mockResolvedValueOnce(_callingClientFixtures.registrationPayload);
|
|
786
|
+
webex.request.mockResolvedValueOnce(_callingClientFixtures.ipPayload).mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload).mockResolvedValueOnce(_callingClientFixtures.registrationPayload);
|
|
649
787
|
windowEventSpy = jest.spyOn(window, 'addEventListener');
|
|
650
|
-
|
|
788
|
+
_context22.next = 5;
|
|
651
789
|
return (0, _CallingClient.createClient)(webex, {
|
|
652
790
|
logger: {
|
|
653
791
|
level: _types.LOGGER.INFO
|
|
654
792
|
}
|
|
655
793
|
});
|
|
656
794
|
case 5:
|
|
657
|
-
callingClient =
|
|
795
|
+
callingClient = _context22.sent;
|
|
658
796
|
line = (0, _values.default)(callingClient.lineDict)[0];
|
|
659
797
|
reg = line.registration;
|
|
660
|
-
|
|
798
|
+
_context22.next = 10;
|
|
661
799
|
return line.register();
|
|
662
800
|
case 10:
|
|
663
801
|
deRegSpy = jest.spyOn(reg, 'deregister');
|
|
@@ -667,9 +805,9 @@ describe('CallingClient Tests', function () {
|
|
|
667
805
|
metricSpy = jest.spyOn(callingClient['metricManager'], 'submitConnectionMetrics');
|
|
668
806
|
case 15:
|
|
669
807
|
case "end":
|
|
670
|
-
return
|
|
808
|
+
return _context22.stop();
|
|
671
809
|
}
|
|
672
|
-
},
|
|
810
|
+
}, _callee22);
|
|
673
811
|
})));
|
|
674
812
|
afterEach(function () {
|
|
675
813
|
jest.clearAllTimers();
|
|
@@ -680,16 +818,16 @@ describe('CallingClient Tests', function () {
|
|
|
680
818
|
callingClient = undefined;
|
|
681
819
|
jest.useRealTimers();
|
|
682
820
|
});
|
|
683
|
-
it('window offline handler sets networkDown and clears keepalive when network is unreachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
821
|
+
it('window offline handler sets networkDown and clears keepalive when network is unreachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
684
822
|
var g, clearKeepaliveSpy, offlineCb;
|
|
685
|
-
return _regenerator.default.wrap(function
|
|
686
|
-
while (1) switch (
|
|
823
|
+
return _regenerator.default.wrap(function _callee23$(_context23) {
|
|
824
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
687
825
|
case 0:
|
|
688
826
|
g = global;
|
|
689
827
|
g.fetch = jest.fn().mockRejectedValueOnce(new Error('network fail'));
|
|
690
828
|
clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
691
829
|
offlineCb = windowEventSpy.mock.calls[1][1];
|
|
692
|
-
|
|
830
|
+
_context23.next = 6;
|
|
693
831
|
return offlineCb();
|
|
694
832
|
case 6:
|
|
695
833
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Network connectivity probe failed'), {
|
|
@@ -700,20 +838,20 @@ describe('CallingClient Tests', function () {
|
|
|
700
838
|
expect(clearKeepaliveSpy).toHaveBeenCalled();
|
|
701
839
|
case 9:
|
|
702
840
|
case "end":
|
|
703
|
-
return
|
|
841
|
+
return _context23.stop();
|
|
704
842
|
}
|
|
705
|
-
},
|
|
843
|
+
}, _callee23);
|
|
706
844
|
})));
|
|
707
|
-
it('window offline handler does not clear keepalive when network is reachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
845
|
+
it('window offline handler does not clear keepalive when network is reachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
708
846
|
var g, clearKeepaliveSpy, offlineCb;
|
|
709
|
-
return _regenerator.default.wrap(function
|
|
710
|
-
while (1) switch (
|
|
847
|
+
return _regenerator.default.wrap(function _callee24$(_context24) {
|
|
848
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
711
849
|
case 0:
|
|
712
850
|
g = global;
|
|
713
851
|
g.fetch = jest.fn().mockResolvedValueOnce({});
|
|
714
852
|
clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
715
853
|
offlineCb = windowEventSpy.mock.calls[1][1];
|
|
716
|
-
|
|
854
|
+
_context24.next = 6;
|
|
717
855
|
return offlineCb();
|
|
718
856
|
case 6:
|
|
719
857
|
expect(g.fetch).toHaveBeenCalledWith('https://www.google.com/generate_204', expect.any(Object));
|
|
@@ -721,17 +859,17 @@ describe('CallingClient Tests', function () {
|
|
|
721
859
|
expect(clearKeepaliveSpy).not.toHaveBeenCalled();
|
|
722
860
|
case 9:
|
|
723
861
|
case "end":
|
|
724
|
-
return
|
|
862
|
+
return _context24.stop();
|
|
725
863
|
}
|
|
726
|
-
},
|
|
864
|
+
}, _callee24);
|
|
727
865
|
})));
|
|
728
|
-
it('window online handler sets networkUpTimestamp and logs', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
866
|
+
it('window online handler sets networkUpTimestamp and logs', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
729
867
|
var onlineCb;
|
|
730
|
-
return _regenerator.default.wrap(function
|
|
731
|
-
while (1) switch (
|
|
868
|
+
return _regenerator.default.wrap(function _callee25$(_context25) {
|
|
869
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
732
870
|
case 0:
|
|
733
871
|
onlineCb = windowEventSpy.mock.calls[0][1];
|
|
734
|
-
|
|
872
|
+
_context25.next = 3;
|
|
735
873
|
return onlineCb();
|
|
736
874
|
case 3:
|
|
737
875
|
expect(callingClient['networkUpTimestamp']).toEqual(expect.any(String));
|
|
@@ -741,17 +879,17 @@ describe('CallingClient Tests', function () {
|
|
|
741
879
|
});
|
|
742
880
|
case 5:
|
|
743
881
|
case "end":
|
|
744
|
-
return
|
|
882
|
+
return _context25.stop();
|
|
745
883
|
}
|
|
746
|
-
},
|
|
884
|
+
}, _callee25);
|
|
747
885
|
})));
|
|
748
|
-
it('mercury offline submits metrics and sets timestamp', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
886
|
+
it('mercury offline submits metrics and sets timestamp', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
749
887
|
var mercuryOfflineCb;
|
|
750
|
-
return _regenerator.default.wrap(function
|
|
751
|
-
while (1) switch (
|
|
888
|
+
return _regenerator.default.wrap(function _callee26$(_context26) {
|
|
889
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
752
890
|
case 0:
|
|
753
891
|
mercuryOfflineCb = webex.internal.mercury.on.mock.calls[1][1];
|
|
754
|
-
|
|
892
|
+
_context26.next = 3;
|
|
755
893
|
return mercuryOfflineCb();
|
|
756
894
|
case 3:
|
|
757
895
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Mercury down, waiting for connection to be up'), {
|
|
@@ -762,26 +900,26 @@ describe('CallingClient Tests', function () {
|
|
|
762
900
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.MERCURY_DOWN, _types4.METRIC_TYPE.BEHAVIORAL, expect.any(String), '');
|
|
763
901
|
case 6:
|
|
764
902
|
case "end":
|
|
765
|
-
return
|
|
903
|
+
return _context26.stop();
|
|
766
904
|
}
|
|
767
|
-
},
|
|
905
|
+
}, _callee26);
|
|
768
906
|
})));
|
|
769
|
-
it('handles reconnection with no active calls after network flap, once mercury comes back up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
907
|
+
it('handles reconnection with no active calls after network flap, once mercury comes back up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
|
|
770
908
|
var handleConnectionRestoreSpy, mercuryOnlineCb;
|
|
771
|
-
return _regenerator.default.wrap(function
|
|
772
|
-
while (1) switch (
|
|
909
|
+
return _regenerator.default.wrap(function _callee27$(_context27) {
|
|
910
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
773
911
|
case 0:
|
|
774
912
|
handleConnectionRestoreSpy = jest.spyOn(reg, 'handleConnectionRestoration');
|
|
775
913
|
callingClient['isNetworkDown'] = true;
|
|
776
914
|
callingClient['networkDownTimestamp'] = '2023-01-01T00:00:00.000Z';
|
|
777
915
|
callingClient['networkUpTimestamp'] = '2023-01-01T00:01:00.000Z';
|
|
778
916
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
779
|
-
|
|
917
|
+
_context27.next = 7;
|
|
780
918
|
return mercuryOnlineCb();
|
|
781
919
|
case 7:
|
|
782
920
|
// Run the interval once
|
|
783
921
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 100);
|
|
784
|
-
|
|
922
|
+
_context27.next = 10;
|
|
785
923
|
return flushPromises();
|
|
786
924
|
case 10:
|
|
787
925
|
expect(handleConnectionRestoreSpy).toHaveBeenCalledWith(true);
|
|
@@ -797,14 +935,14 @@ describe('CallingClient Tests', function () {
|
|
|
797
935
|
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');
|
|
798
936
|
case 18:
|
|
799
937
|
case "end":
|
|
800
|
-
return
|
|
938
|
+
return _context27.stop();
|
|
801
939
|
}
|
|
802
|
-
},
|
|
940
|
+
}, _callee27);
|
|
803
941
|
})));
|
|
804
|
-
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
|
|
942
|
+
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 _callee28() {
|
|
805
943
|
var handleConnectionRestoreSpy, mercuryOnlineCb;
|
|
806
|
-
return _regenerator.default.wrap(function
|
|
807
|
-
while (1) switch (
|
|
944
|
+
return _regenerator.default.wrap(function _callee28$(_context28) {
|
|
945
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
808
946
|
case 0:
|
|
809
947
|
handleConnectionRestoreSpy = jest.spyOn(reg, 'handleConnectionRestoration');
|
|
810
948
|
callingClient['isNetworkDown'] = true;
|
|
@@ -812,12 +950,12 @@ describe('CallingClient Tests', function () {
|
|
|
812
950
|
callingClient['networkUpTimestamp'] = '2023-01-01T00:01:00.000Z';
|
|
813
951
|
reg.setStatus(_types2.RegistrationStatus.IDLE);
|
|
814
952
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
815
|
-
|
|
953
|
+
_context28.next = 8;
|
|
816
954
|
return mercuryOnlineCb();
|
|
817
955
|
case 8:
|
|
818
956
|
// Run the interval once
|
|
819
957
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 100);
|
|
820
|
-
|
|
958
|
+
_context28.next = 11;
|
|
821
959
|
return flushPromises();
|
|
822
960
|
case 11:
|
|
823
961
|
expect(handleConnectionRestoreSpy).not.toHaveBeenCalledWith(true);
|
|
@@ -833,14 +971,14 @@ describe('CallingClient Tests', function () {
|
|
|
833
971
|
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');
|
|
834
972
|
case 19:
|
|
835
973
|
case "end":
|
|
836
|
-
return
|
|
974
|
+
return _context28.stop();
|
|
837
975
|
}
|
|
838
|
-
},
|
|
976
|
+
}, _callee28);
|
|
839
977
|
})));
|
|
840
|
-
it('handle calls status check once mercury comes back up after a network flap', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
978
|
+
it('handle calls status check once mercury comes back up after a network flap', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
|
|
841
979
|
var call, callKeepaliveSpy, deleteSpy, mercuryOnlineCb;
|
|
842
|
-
return _regenerator.default.wrap(function
|
|
843
|
-
while (1) switch (
|
|
980
|
+
return _regenerator.default.wrap(function _callee29$(_context29) {
|
|
981
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
844
982
|
case 0:
|
|
845
983
|
callingClient['isNetworkDown'] = true;
|
|
846
984
|
call = callingClient['callManager'].createCall();
|
|
@@ -848,11 +986,11 @@ describe('CallingClient Tests', function () {
|
|
|
848
986
|
deleteSpy = jest.spyOn(call, 'delete');
|
|
849
987
|
expect((0, _keys.default)(callingClient['callManager'].getActiveCalls()).length).toBe(1);
|
|
850
988
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
851
|
-
|
|
989
|
+
_context29.next = 8;
|
|
852
990
|
return mercuryOnlineCb();
|
|
853
991
|
case 8:
|
|
854
992
|
expect(callKeepaliveSpy).toHaveBeenCalled();
|
|
855
|
-
|
|
993
|
+
_context29.next = 11;
|
|
856
994
|
return flushPromises();
|
|
857
995
|
case 11:
|
|
858
996
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Call Keepalive failed'), {
|
|
@@ -865,25 +1003,25 @@ describe('CallingClient Tests', function () {
|
|
|
865
1003
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.NETWORK_FLAP, _types4.METRIC_TYPE.BEHAVIORAL, expect.any(String), expect.any(String));
|
|
866
1004
|
case 16:
|
|
867
1005
|
case "end":
|
|
868
|
-
return
|
|
1006
|
+
return _context29.stop();
|
|
869
1007
|
}
|
|
870
|
-
},
|
|
1008
|
+
}, _callee29);
|
|
871
1009
|
})));
|
|
872
|
-
it('handle calls status check once mercury comes back up with stable network', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1010
|
+
it('handle calls status check once mercury comes back up with stable network', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
|
|
873
1011
|
var call, callKeepaliveSpy, deleteSpy, mercuryOnlineCb;
|
|
874
|
-
return _regenerator.default.wrap(function
|
|
875
|
-
while (1) switch (
|
|
1012
|
+
return _regenerator.default.wrap(function _callee30$(_context30) {
|
|
1013
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
876
1014
|
case 0:
|
|
877
1015
|
call = callingClient['callManager'].createCall();
|
|
878
1016
|
callKeepaliveSpy = jest.spyOn(call, 'postStatus').mockRejectedValueOnce(new Error('keepalive fail'));
|
|
879
1017
|
deleteSpy = jest.spyOn(call, 'delete');
|
|
880
1018
|
expect((0, _keys.default)(callingClient['callManager'].getActiveCalls()).length).toBe(1);
|
|
881
1019
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
882
|
-
|
|
1020
|
+
_context30.next = 7;
|
|
883
1021
|
return mercuryOnlineCb();
|
|
884
1022
|
case 7:
|
|
885
1023
|
expect(callKeepaliveSpy).toHaveBeenCalled();
|
|
886
|
-
|
|
1024
|
+
_context30.next = 10;
|
|
887
1025
|
return flushPromises();
|
|
888
1026
|
case 10:
|
|
889
1027
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Call Keepalive failed'), {
|
|
@@ -896,9 +1034,9 @@ describe('CallingClient Tests', function () {
|
|
|
896
1034
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.MERCURY_UP, _types4.METRIC_TYPE.BEHAVIORAL, expect.any(String), expect.any(String));
|
|
897
1035
|
case 15:
|
|
898
1036
|
case "end":
|
|
899
|
-
return
|
|
1037
|
+
return _context30.stop();
|
|
900
1038
|
}
|
|
901
|
-
},
|
|
1039
|
+
}, _callee30);
|
|
902
1040
|
})));
|
|
903
1041
|
});
|
|
904
1042
|
|
|
@@ -916,15 +1054,15 @@ describe('CallingClient Tests', function () {
|
|
|
916
1054
|
});
|
|
917
1055
|
var callingClient;
|
|
918
1056
|
var line;
|
|
919
|
-
beforeAll(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1057
|
+
beforeAll(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
|
|
920
1058
|
var calls;
|
|
921
|
-
return _regenerator.default.wrap(function
|
|
922
|
-
while (1) switch (
|
|
1059
|
+
return _regenerator.default.wrap(function _callee31$(_context31) {
|
|
1060
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
923
1061
|
case 0:
|
|
924
|
-
|
|
1062
|
+
_context31.next = 2;
|
|
925
1063
|
return (0, _CallingClient.createClient)(webex);
|
|
926
1064
|
case 2:
|
|
927
|
-
callingClient =
|
|
1065
|
+
callingClient = _context31.sent;
|
|
928
1066
|
line = new _line.default(userId, clientDeviceUri, mutex, primaryMobiusUris(), backupMobiusUris(), _types.LOGGER.INFO);
|
|
929
1067
|
calls = (0, _values.default)(callManager.getActiveCalls());
|
|
930
1068
|
calls.forEach(function (call) {
|
|
@@ -932,9 +1070,9 @@ describe('CallingClient Tests', function () {
|
|
|
932
1070
|
});
|
|
933
1071
|
case 6:
|
|
934
1072
|
case "end":
|
|
935
|
-
return
|
|
1073
|
+
return _context31.stop();
|
|
936
1074
|
}
|
|
937
|
-
},
|
|
1075
|
+
}, _callee31);
|
|
938
1076
|
})));
|
|
939
1077
|
afterAll(function () {
|
|
940
1078
|
callingClient.removeAllListeners();
|
|
@@ -1017,23 +1155,23 @@ describe('CallingClient Tests', function () {
|
|
|
1017
1155
|
describe('Call Session Event test', function () {
|
|
1018
1156
|
var mockOn = webex.internal.mercury.on;
|
|
1019
1157
|
var callingClient;
|
|
1020
|
-
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1021
|
-
return _regenerator.default.wrap(function
|
|
1022
|
-
while (1) switch (
|
|
1158
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
|
|
1159
|
+
return _regenerator.default.wrap(function _callee32$(_context32) {
|
|
1160
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1023
1161
|
case 0:
|
|
1024
|
-
|
|
1162
|
+
_context32.next = 2;
|
|
1025
1163
|
return (0, _CallingClient.createClient)(webex, {
|
|
1026
1164
|
logger: {
|
|
1027
1165
|
level: _types.LOGGER.INFO
|
|
1028
1166
|
}
|
|
1029
1167
|
});
|
|
1030
1168
|
case 2:
|
|
1031
|
-
callingClient =
|
|
1169
|
+
callingClient = _context32.sent;
|
|
1032
1170
|
case 3:
|
|
1033
1171
|
case "end":
|
|
1034
|
-
return
|
|
1172
|
+
return _context32.stop();
|
|
1035
1173
|
}
|
|
1036
|
-
},
|
|
1174
|
+
}, _callee32);
|
|
1037
1175
|
})));
|
|
1038
1176
|
afterEach(function () {
|
|
1039
1177
|
callingClient.removeAllListeners();
|
|
@@ -1134,17 +1272,17 @@ describe('CallingClient Tests', function () {
|
|
|
1134
1272
|
afterAll(function () {
|
|
1135
1273
|
global.RTCPeerConnection = origRTCPeerConnection;
|
|
1136
1274
|
});
|
|
1137
|
-
it('should complete without throwing', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1138
|
-
return _regenerator.default.wrap(function
|
|
1139
|
-
while (1) switch (
|
|
1275
|
+
it('should complete without throwing', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
|
|
1276
|
+
return _regenerator.default.wrap(function _callee33$(_context33) {
|
|
1277
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1140
1278
|
case 0:
|
|
1141
|
-
|
|
1279
|
+
_context33.next = 2;
|
|
1142
1280
|
return expect((0, _windowsChromiumIceWarmupUtils.default)({})).resolves.not.toThrow();
|
|
1143
1281
|
case 2:
|
|
1144
1282
|
case "end":
|
|
1145
|
-
return
|
|
1283
|
+
return _context33.stop();
|
|
1146
1284
|
}
|
|
1147
|
-
},
|
|
1285
|
+
}, _callee33);
|
|
1148
1286
|
})));
|
|
1149
1287
|
});
|
|
1150
1288
|
});
|