@webex/calling 3.9.0-webinar5k.1 → 3.10.0
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 +51 -46
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +146 -147
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallHistory/callHistoryFixtures.js.map +1 -1
- package/dist/CallHistory/constants.js.map +1 -1
- package/dist/CallHistory/types.js.map +1 -1
- package/dist/CallSettings/CallSettings.js +8 -8
- package/dist/CallSettings/CallSettings.js.map +1 -1
- package/dist/CallSettings/CallSettings.test.js +1 -1
- package/dist/CallSettings/CallSettings.test.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.js +12 -11
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +9 -10
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +66 -59
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +108 -109
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/constants.js.map +1 -1
- package/dist/CallSettings/testFixtures.js.map +1 -1
- package/dist/CallSettings/types.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +457 -201
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +458 -315
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/callRecordFixtures.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.js +2 -2
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +8 -7
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/types.js.map +1 -1
- package/dist/CallingClient/calling/call.js +369 -333
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +411 -410
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +3 -4
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +67 -68
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/calling/index.js.map +1 -1
- package/dist/CallingClient/calling/types.js.map +1 -1
- package/dist/CallingClient/callingClientFixtures.js.map +1 -1
- package/dist/CallingClient/constants.js +9 -6
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +10 -11
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +10 -9
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/line/types.js.map +1 -1
- package/dist/CallingClient/registration/index.js.map +1 -1
- package/dist/CallingClient/registration/register.js +280 -201
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +251 -180
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/registerFixtures.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +25 -10
- package/dist/CallingClient/registration/webWorker.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.test.js +85 -38
- 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/windowsChromiumIceWarmupUtils.js +142 -0
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -0
- package/dist/Contacts/ContactsClient.js +244 -238
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +89 -90
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Contacts/constants.js +2 -2
- package/dist/Contacts/constants.js.map +1 -1
- package/dist/Contacts/contactFixtures.js.map +1 -1
- package/dist/Contacts/types.js.map +1 -1
- package/dist/Errors/catalog/CallError.js +2 -2
- package/dist/Errors/catalog/CallError.js.map +1 -1
- package/dist/Errors/catalog/CallingDeviceError.js +2 -2
- package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
- package/dist/Errors/catalog/ExtendedError.js +3 -3
- package/dist/Errors/catalog/ExtendedError.js.map +1 -1
- package/dist/Errors/catalog/LineError.js +2 -2
- package/dist/Errors/catalog/LineError.js.map +1 -1
- package/dist/Errors/index.js.map +1 -1
- package/dist/Errors/types.js.map +1 -1
- package/dist/Events/impl/index.js +2 -2
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/Events/types.js.map +1 -1
- package/dist/Logger/index.js.map +1 -1
- package/dist/Logger/index.test.js.map +1 -1
- package/dist/Logger/types.js.map +1 -1
- package/dist/Metrics/index.js +221 -104
- package/dist/Metrics/index.js.map +1 -1
- package/dist/Metrics/index.test.js +112 -23
- package/dist/Metrics/index.test.js.map +1 -1
- package/dist/Metrics/types.js +15 -1
- package/dist/Metrics/types.js.map +1 -1
- package/dist/SDKConnector/index.js +0 -1
- package/dist/SDKConnector/index.js.map +1 -1
- package/dist/SDKConnector/index.test.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/SDKConnector/utils.js.map +1 -1
- package/dist/SDKConnector/utils.test.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +42 -39
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +119 -120
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +54 -47
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +73 -74
- package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +12 -11
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/Voicemail.test.js +2 -2
- package/dist/Voicemail/Voicemail.test.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +78 -70
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +184 -185
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/constants.js.map +1 -1
- package/dist/Voicemail/types.js.map +1 -1
- package/dist/Voicemail/voicemailFixture.js.map +1 -1
- package/dist/api.js.map +1 -1
- package/dist/common/Utils.js +84 -65
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +111 -117
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/index.js.map +1 -1
- package/dist/common/testUtil.js +1 -1
- package/dist/common/testUtil.js.map +1 -1
- package/dist/common/types.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +4 -0
- package/dist/module/CallSettings/UcmBackendConnector.js +1 -0
- package/dist/module/CallSettings/WxCallBackendConnector.js +7 -0
- package/dist/module/CallingClient/CallingClient.js +174 -32
- package/dist/module/CallingClient/calling/call.js +79 -43
- package/dist/module/CallingClient/constants.js +8 -4
- package/dist/module/CallingClient/line/index.js +3 -3
- package/dist/module/CallingClient/registration/register.js +34 -10
- package/dist/module/CallingClient/registration/webWorker.js +17 -3
- package/dist/module/CallingClient/registration/webWorkerStr.js +19 -3
- package/dist/module/CallingClient/windowsChromiumIceWarmupUtils.js +59 -0
- package/dist/module/Contacts/ContactsClient.js +23 -17
- package/dist/module/Contacts/constants.js +1 -1
- package/dist/module/Metrics/index.js +142 -55
- package/dist/module/Metrics/types.js +14 -0
- package/dist/module/Voicemail/BroadworksBackendConnector.js +3 -0
- package/dist/module/Voicemail/UcmBackendConnector.js +6 -0
- package/dist/module/Voicemail/WxCallBackendConnector.js +8 -0
- package/dist/module/common/Utils.js +27 -10
- 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 +12 -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/calling/types.d.ts +2 -1
- package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +8 -4
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +1 -0
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorker.d.ts +2 -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/windowsChromiumIceWarmupUtils.d.ts +5 -0
- package/dist/types/CallingClient/windowsChromiumIceWarmupUtils.d.ts.map +1 -0
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/Contacts/constants.d.ts +1 -1
- package/dist/types/Contacts/constants.d.ts.map +1 -1
- package/dist/types/Metrics/index.d.ts.map +1 -1
- package/dist/types/Metrics/types.d.ts +18 -3
- package/dist/types/Metrics/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/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +1 -0
- package/dist/types/common/types.d.ts.map +1 -1
- package/package.json +10 -8
|
@@ -10,6 +10,8 @@ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/defi
|
|
|
10
10
|
var _WeakMap = require("@babel/runtime-corejs2/core-js/weak-map");
|
|
11
11
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
12
12
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
13
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
13
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
14
16
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
15
17
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
@@ -32,8 +34,9 @@ var _callingClientFixtures = require("./callingClientFixtures");
|
|
|
32
34
|
var _line = _interopRequireDefault(require("./line"));
|
|
33
35
|
var _registerFixtures = require("./registration/registerFixtures");
|
|
34
36
|
var _constants2 = require("../common/constants");
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
var _types4 = require("../Metrics/types");
|
|
38
|
+
var _windowsChromiumIceWarmupUtils = _interopRequireDefault(require("./windowsChromiumIceWarmupUtils"));
|
|
39
|
+
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 _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
37
40
|
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; }
|
|
38
41
|
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 */
|
|
39
42
|
global.crypto = {
|
|
@@ -51,7 +54,8 @@ describe('CallingClient Tests', function () {
|
|
|
51
54
|
webex.internal.services['_hostCatalog'] = _callingClientFixtures.mockCatalogUS;
|
|
52
55
|
var defaultServiceIndicator = _types2.ServiceIndicator.CALLING;
|
|
53
56
|
var callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
|
|
54
|
-
var
|
|
57
|
+
var infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
58
|
+
var logSpy = jest.spyOn(_Logger.default, 'log');
|
|
55
59
|
var warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
56
60
|
var originalProcessNextTick = process.nextTick;
|
|
57
61
|
function flushPromises() {
|
|
@@ -65,7 +69,7 @@ describe('CallingClient Tests', function () {
|
|
|
65
69
|
webex.internal.services['_serviceUrls']['mobius'] = 'https://mobius.aintgen-a-1.int.infra.webex.com/api/v1';
|
|
66
70
|
webex.internal.services['_hostCatalog'] = _callingClientFixtures.mockCatalogUS;
|
|
67
71
|
});
|
|
68
|
-
it('should set mobiusServiceHost correctly when URL is valid', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
72
|
+
it('should set mobiusServiceHost correctly when URL is valid', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
69
73
|
var urlSpy, callingClient;
|
|
70
74
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
71
75
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -92,7 +96,7 @@ describe('CallingClient Tests', function () {
|
|
|
92
96
|
}
|
|
93
97
|
}, _callee);
|
|
94
98
|
})));
|
|
95
|
-
it('should use default mobius service host when Service URL is invalid', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
99
|
+
it('should use default mobius service host when Service URL is invalid', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
96
100
|
var callingClient;
|
|
97
101
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
98
102
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -127,11 +131,11 @@ describe('CallingClient Tests', function () {
|
|
|
127
131
|
* No input sdk config to callingClient, it should default to service type
|
|
128
132
|
* calling and empty domain value.
|
|
129
133
|
*/
|
|
130
|
-
it('Verify valid calling serviceData with no input sdk config', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
134
|
+
it('Verify valid calling serviceData with no input sdk config', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
131
135
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
132
136
|
while (1) switch (_context4.prev = _context4.next) {
|
|
133
137
|
case 0:
|
|
134
|
-
expect(
|
|
138
|
+
expect(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
135
139
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
136
140
|
while (1) switch (_context3.prev = _context3.next) {
|
|
137
141
|
case 0:
|
|
@@ -160,7 +164,7 @@ describe('CallingClient Tests', function () {
|
|
|
160
164
|
* It should default to service type calling and empty domain value.
|
|
161
165
|
*
|
|
162
166
|
*/
|
|
163
|
-
it('Verify invalid empty service indicator, empty domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
167
|
+
it('Verify invalid empty service indicator, empty domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
164
168
|
var serviceDataObj;
|
|
165
169
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
166
170
|
while (1) switch (_context6.prev = _context6.next) {
|
|
@@ -170,7 +174,7 @@ describe('CallingClient Tests', function () {
|
|
|
170
174
|
indicator: '',
|
|
171
175
|
domain: ''
|
|
172
176
|
};
|
|
173
|
-
expect(
|
|
177
|
+
expect(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
174
178
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
175
179
|
while (1) switch (_context5.prev = _context5.next) {
|
|
176
180
|
case 0:
|
|
@@ -202,7 +206,7 @@ describe('CallingClient Tests', function () {
|
|
|
202
206
|
*
|
|
203
207
|
* INDICATOR value MUST MATCH with one of the values in ServiceIndicator enum.
|
|
204
208
|
*/
|
|
205
|
-
it('Verify invalid service indicator, valid domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
209
|
+
it('Verify invalid service indicator, valid domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
206
210
|
var serviceDataObj;
|
|
207
211
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
208
212
|
while (1) switch (_context7.prev = _context7.next) {
|
|
@@ -243,7 +247,7 @@ describe('CallingClient Tests', function () {
|
|
|
243
247
|
* DOMAIN field for service type calling is allowed to be empty but if it carries a non-empty
|
|
244
248
|
* string then it must be of valid domain type.
|
|
245
249
|
*/
|
|
246
|
-
it('CALLING: verify invalid service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
250
|
+
it('CALLING: verify invalid service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
247
251
|
var serviceDataObj;
|
|
248
252
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
249
253
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -282,16 +286,16 @@ describe('CallingClient Tests', function () {
|
|
|
282
286
|
*
|
|
283
287
|
* DOMAIN field for service type 'calling' is allowed to be empty.
|
|
284
288
|
*/
|
|
285
|
-
it('CALLING: verify valid empty service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
289
|
+
it('CALLING: verify valid empty service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
|
|
286
290
|
var serviceDataObj;
|
|
287
|
-
return _regenerator.default.wrap(function
|
|
288
|
-
while (1) switch (
|
|
291
|
+
return _regenerator.default.wrap(function _callee0$(_context0) {
|
|
292
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
289
293
|
case 0:
|
|
290
294
|
serviceDataObj = {
|
|
291
295
|
indicator: _types2.ServiceIndicator.CALLING,
|
|
292
296
|
domain: ''
|
|
293
297
|
};
|
|
294
|
-
expect(
|
|
298
|
+
expect(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
295
299
|
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
296
300
|
while (1) switch (_context9.prev = _context9.next) {
|
|
297
301
|
case 0:
|
|
@@ -310,9 +314,9 @@ describe('CallingClient Tests', function () {
|
|
|
310
314
|
}))).not.toThrow(Error);
|
|
311
315
|
case 2:
|
|
312
316
|
case "end":
|
|
313
|
-
return
|
|
317
|
+
return _context0.stop();
|
|
314
318
|
}
|
|
315
|
-
},
|
|
319
|
+
}, _callee0);
|
|
316
320
|
})));
|
|
317
321
|
|
|
318
322
|
/**
|
|
@@ -323,35 +327,35 @@ describe('CallingClient Tests', function () {
|
|
|
323
327
|
*
|
|
324
328
|
* DOMAIN field for service type 'contactcenter' must carry a non-empty valid domain type string.
|
|
325
329
|
*/
|
|
326
|
-
it('ContactCenter: verify empty invalid service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
330
|
+
it('ContactCenter: verify empty invalid service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
327
331
|
var serviceDataObj;
|
|
328
|
-
return _regenerator.default.wrap(function
|
|
329
|
-
while (1) switch (
|
|
332
|
+
return _regenerator.default.wrap(function _callee1$(_context1) {
|
|
333
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
330
334
|
case 0:
|
|
331
335
|
serviceDataObj = {
|
|
332
336
|
indicator: _types2.ServiceIndicator.CONTACT_CENTER,
|
|
333
337
|
domain: ''
|
|
334
338
|
};
|
|
335
|
-
|
|
336
|
-
|
|
339
|
+
_context1.prev = 1;
|
|
340
|
+
_context1.next = 4;
|
|
337
341
|
return (0, _CallingClient.createClient)(webex, {
|
|
338
342
|
serviceData: serviceDataObj
|
|
339
343
|
});
|
|
340
344
|
case 4:
|
|
341
|
-
callingClient =
|
|
342
|
-
|
|
345
|
+
callingClient = _context1.sent;
|
|
346
|
+
_context1.next = 10;
|
|
343
347
|
break;
|
|
344
348
|
case 7:
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
expect(
|
|
349
|
+
_context1.prev = 7;
|
|
350
|
+
_context1.t0 = _context1["catch"](1);
|
|
351
|
+
expect(_context1.t0.message).toEqual('Invalid service domain.');
|
|
348
352
|
case 10:
|
|
349
353
|
expect.assertions(1);
|
|
350
354
|
case 11:
|
|
351
355
|
case "end":
|
|
352
|
-
return
|
|
356
|
+
return _context1.stop();
|
|
353
357
|
}
|
|
354
|
-
},
|
|
358
|
+
}, _callee1, null, [[1, 7]]);
|
|
355
359
|
})));
|
|
356
360
|
|
|
357
361
|
/**
|
|
@@ -362,58 +366,58 @@ describe('CallingClient Tests', function () {
|
|
|
362
366
|
*
|
|
363
367
|
* DOMAIN field for service type 'contactcenter' must carry a non-empty valid domain type string.
|
|
364
368
|
*/
|
|
365
|
-
it('ContactCenter: verify valid service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
369
|
+
it('ContactCenter: verify valid service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
366
370
|
var serviceDataObj;
|
|
367
|
-
return _regenerator.default.wrap(function
|
|
368
|
-
while (1) switch (
|
|
371
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
372
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
369
373
|
case 0:
|
|
370
374
|
serviceDataObj = {
|
|
371
375
|
indicator: _types2.ServiceIndicator.CONTACT_CENTER,
|
|
372
376
|
domain: 'test.example.com'
|
|
373
377
|
};
|
|
374
|
-
expect(
|
|
375
|
-
return _regenerator.default.wrap(function
|
|
376
|
-
while (1) switch (
|
|
378
|
+
expect(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
379
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
380
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
377
381
|
case 0:
|
|
378
|
-
|
|
382
|
+
_context10.next = 2;
|
|
379
383
|
return (0, _CallingClient.createClient)(webex, {
|
|
380
384
|
serviceData: serviceDataObj
|
|
381
385
|
});
|
|
382
386
|
case 2:
|
|
383
|
-
callingClient =
|
|
387
|
+
callingClient = _context10.sent;
|
|
384
388
|
expect(callingClient).toBeTruthy();
|
|
385
389
|
case 4:
|
|
386
390
|
case "end":
|
|
387
|
-
return
|
|
391
|
+
return _context10.stop();
|
|
388
392
|
}
|
|
389
|
-
},
|
|
393
|
+
}, _callee10);
|
|
390
394
|
}))).not.toThrow(Error);
|
|
391
395
|
case 2:
|
|
392
396
|
case "end":
|
|
393
|
-
return
|
|
397
|
+
return _context11.stop();
|
|
394
398
|
}
|
|
395
|
-
},
|
|
399
|
+
}, _callee11);
|
|
396
400
|
})));
|
|
397
|
-
it('Get current log level', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
398
|
-
return _regenerator.default.wrap(function
|
|
399
|
-
while (1) switch (
|
|
401
|
+
it('Get current log level', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
402
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
403
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
400
404
|
case 0:
|
|
401
|
-
|
|
405
|
+
_context12.next = 2;
|
|
402
406
|
return (0, _CallingClient.createClient)(webex, {
|
|
403
407
|
logger: {
|
|
404
408
|
level: _types.LOGGER.INFO
|
|
405
409
|
}
|
|
406
410
|
});
|
|
407
411
|
case 2:
|
|
408
|
-
callingClient =
|
|
412
|
+
callingClient = _context12.sent;
|
|
409
413
|
expect(callingClient).toBeTruthy();
|
|
410
414
|
expect(callingClient.getLoggingLevel).toBeTruthy();
|
|
411
415
|
expect(callingClient.getLoggingLevel()).toEqual(_types.LOGGER.INFO);
|
|
412
416
|
case 6:
|
|
413
417
|
case "end":
|
|
414
|
-
return
|
|
418
|
+
return _context12.stop();
|
|
415
419
|
}
|
|
416
|
-
},
|
|
420
|
+
}, _callee12);
|
|
417
421
|
})));
|
|
418
422
|
});
|
|
419
423
|
describe('Mobius Server discovery tests', function () {
|
|
@@ -426,19 +430,19 @@ describe('CallingClient Tests', function () {
|
|
|
426
430
|
callingClient = undefined;
|
|
427
431
|
jest.useRealTimers();
|
|
428
432
|
});
|
|
429
|
-
it('verify successful mobius server url discovery', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
430
|
-
return _regenerator.default.wrap(function
|
|
431
|
-
while (1) switch (
|
|
433
|
+
it('verify successful mobius server url discovery', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
434
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
435
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
432
436
|
case 0:
|
|
433
437
|
webex.request.mockResolvedValueOnce(_callingClientFixtures.ipPayload).mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload);
|
|
434
|
-
|
|
438
|
+
_context13.next = 3;
|
|
435
439
|
return (0, _CallingClient.createClient)(webex, {
|
|
436
440
|
logger: {
|
|
437
441
|
level: _types.LOGGER.INFO
|
|
438
442
|
}
|
|
439
443
|
});
|
|
440
444
|
case 3:
|
|
441
|
-
callingClient =
|
|
445
|
+
callingClient = _context13.sent;
|
|
442
446
|
expect(webex.request).toBeCalledTimes(3);
|
|
443
447
|
expect(callingClient.primaryMobiusUris).toEqual([_callingClientFixtures.primaryUrl]);
|
|
444
448
|
expect(handleErrorSpy).not.toBeCalled();
|
|
@@ -460,27 +464,27 @@ describe('CallingClient Tests', function () {
|
|
|
460
464
|
}));
|
|
461
465
|
case 10:
|
|
462
466
|
case "end":
|
|
463
|
-
return
|
|
467
|
+
return _context13.stop();
|
|
464
468
|
}
|
|
465
|
-
},
|
|
469
|
+
}, _callee13);
|
|
466
470
|
})));
|
|
467
|
-
it('case when region discovery fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
471
|
+
it('case when region discovery fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
468
472
|
var failurePayload;
|
|
469
|
-
return _regenerator.default.wrap(function
|
|
470
|
-
while (1) switch (
|
|
473
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
474
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
471
475
|
case 0:
|
|
472
476
|
failurePayload = {
|
|
473
477
|
statusCode: 500
|
|
474
478
|
};
|
|
475
479
|
webex.request.mockRejectedValue(failurePayload);
|
|
476
|
-
|
|
480
|
+
_context14.next = 4;
|
|
477
481
|
return (0, _CallingClient.createClient)(webex, {
|
|
478
482
|
logger: {
|
|
479
483
|
level: _types.LOGGER.INFO
|
|
480
484
|
}
|
|
481
485
|
});
|
|
482
486
|
case 4:
|
|
483
|
-
callingClient =
|
|
487
|
+
callingClient = _context14.sent;
|
|
484
488
|
expect(webex.request).nthCalledWith(1, _objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
485
489
|
uri: 'https://mobius-us-east-1.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
486
490
|
method: 'GET'
|
|
@@ -502,30 +506,33 @@ describe('CallingClient Tests', function () {
|
|
|
502
506
|
method: 'getMobiusServers'
|
|
503
507
|
});
|
|
504
508
|
expect(callingClient.primaryMobiusUris).toEqual(["".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT)]);
|
|
505
|
-
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers",
|
|
509
|
+
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers", expect.objectContaining({
|
|
510
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
511
|
+
method: 'getMobiusServers'
|
|
512
|
+
}));
|
|
506
513
|
case 12:
|
|
507
514
|
case "end":
|
|
508
|
-
return
|
|
515
|
+
return _context14.stop();
|
|
509
516
|
}
|
|
510
|
-
},
|
|
517
|
+
}, _callee14);
|
|
511
518
|
})));
|
|
512
|
-
it('case when /myIP failed with 401', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
519
|
+
it('case when /myIP failed with 401', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
513
520
|
var failurePayload;
|
|
514
|
-
return _regenerator.default.wrap(function
|
|
515
|
-
while (1) switch (
|
|
521
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
522
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
516
523
|
case 0:
|
|
517
524
|
failurePayload = {
|
|
518
525
|
statusCode: 401
|
|
519
526
|
};
|
|
520
527
|
webex.request.mockRejectedValueOnce(failurePayload);
|
|
521
|
-
|
|
528
|
+
_context15.next = 4;
|
|
522
529
|
return (0, _CallingClient.createClient)(webex, {
|
|
523
530
|
logger: {
|
|
524
531
|
level: _types.LOGGER.INFO
|
|
525
532
|
}
|
|
526
533
|
});
|
|
527
534
|
case 4:
|
|
528
|
-
callingClient =
|
|
535
|
+
callingClient = _context15.sent;
|
|
529
536
|
expect(webex.request).toBeCalledOnceWith(_objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
530
537
|
uri: 'https://mobius-us-east-1.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
531
538
|
method: 'GET'
|
|
@@ -535,30 +542,33 @@ describe('CallingClient Tests', function () {
|
|
|
535
542
|
method: 'getMobiusServers'
|
|
536
543
|
});
|
|
537
544
|
expect(callingClient.primaryMobiusUris).toEqual(["".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT)]);
|
|
538
|
-
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers",
|
|
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
|
+
}));
|
|
539
549
|
case 9:
|
|
540
550
|
case "end":
|
|
541
|
-
return
|
|
551
|
+
return _context15.stop();
|
|
542
552
|
}
|
|
543
|
-
},
|
|
553
|
+
}, _callee15);
|
|
544
554
|
})));
|
|
545
|
-
it('when region discovery succeeds but region based mobius url discovery fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
555
|
+
it('when region discovery succeeds but region based mobius url discovery fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
546
556
|
var failurePayload;
|
|
547
|
-
return _regenerator.default.wrap(function
|
|
548
|
-
while (1) switch (
|
|
557
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
558
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
549
559
|
case 0:
|
|
550
560
|
failurePayload = {
|
|
551
561
|
statusCode: 500
|
|
552
562
|
};
|
|
553
563
|
webex.request.mockResolvedValueOnce(_callingClientFixtures.ipPayload).mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockRejectedValueOnce(failurePayload);
|
|
554
|
-
|
|
564
|
+
_context16.next = 4;
|
|
555
565
|
return (0, _CallingClient.createClient)(webex, {
|
|
556
566
|
logger: {
|
|
557
567
|
level: _types.LOGGER.INFO
|
|
558
568
|
}
|
|
559
569
|
});
|
|
560
570
|
case 4:
|
|
561
|
-
callingClient =
|
|
571
|
+
callingClient = _context16.sent;
|
|
562
572
|
expect(handleErrorSpy).toBeCalledWith(failurePayload, expect.anything(), {
|
|
563
573
|
file: _constants.CALLING_CLIENT_FILE,
|
|
564
574
|
method: 'getMobiusServers'
|
|
@@ -576,30 +586,33 @@ describe('CallingClient Tests', function () {
|
|
|
576
586
|
addAuthHeader: false,
|
|
577
587
|
headers: (0, _defineProperty2.default)({}, _constants.SPARK_USER_AGENT, null)
|
|
578
588
|
});
|
|
579
|
-
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers",
|
|
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
|
+
}));
|
|
580
593
|
case 11:
|
|
581
594
|
case "end":
|
|
582
|
-
return
|
|
595
|
+
return _context16.stop();
|
|
583
596
|
}
|
|
584
|
-
},
|
|
597
|
+
}, _callee16);
|
|
585
598
|
})));
|
|
586
|
-
it('case when discovery failed with 401', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
599
|
+
it('case when discovery failed with 401', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
587
600
|
var failurePayload;
|
|
588
|
-
return _regenerator.default.wrap(function
|
|
589
|
-
while (1) switch (
|
|
601
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
602
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
590
603
|
case 0:
|
|
591
604
|
failurePayload = {
|
|
592
605
|
statusCode: 401
|
|
593
606
|
};
|
|
594
607
|
webex.request.mockResolvedValueOnce(_callingClientFixtures.ipPayload).mockRejectedValueOnce(failurePayload);
|
|
595
|
-
|
|
608
|
+
_context17.next = 4;
|
|
596
609
|
return (0, _CallingClient.createClient)(webex, {
|
|
597
610
|
logger: {
|
|
598
611
|
level: _types.LOGGER.INFO
|
|
599
612
|
}
|
|
600
613
|
});
|
|
601
614
|
case 4:
|
|
602
|
-
callingClient =
|
|
615
|
+
callingClient = _context17.sent;
|
|
603
616
|
expect(webex.request).toBeCalledTimes(2);
|
|
604
617
|
expect(webex.request).nthCalledWith(1, _objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
605
618
|
uri: 'https://mobius-us-east-1.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
@@ -616,22 +629,23 @@ describe('CallingClient Tests', function () {
|
|
|
616
629
|
method: 'getMobiusServers'
|
|
617
630
|
});
|
|
618
631
|
expect(callingClient.primaryMobiusUris).toEqual(["".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT)]);
|
|
619
|
-
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers",
|
|
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
|
+
}));
|
|
620
636
|
case 11:
|
|
621
637
|
case "end":
|
|
622
|
-
return
|
|
638
|
+
return _context17.stop();
|
|
623
639
|
}
|
|
624
|
-
},
|
|
640
|
+
}, _callee17);
|
|
625
641
|
})));
|
|
626
|
-
it('Verify successful mobius server url discovery after initializing callingClient through a config', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
while (1) switch (_context20.prev = _context20.next) {
|
|
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) {
|
|
630
645
|
case 0:
|
|
631
|
-
infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
632
646
|
infoSpy.mockReset();
|
|
633
647
|
webex.request.mockResolvedValueOnce(_callingClientFixtures.discoveryPayload);
|
|
634
|
-
|
|
648
|
+
_context18.next = 4;
|
|
635
649
|
return (0, _CallingClient.createClient)(webex, {
|
|
636
650
|
discovery: {
|
|
637
651
|
region: 'AP-SOUTHEAST',
|
|
@@ -641,8 +655,8 @@ describe('CallingClient Tests', function () {
|
|
|
641
655
|
level: _types.LOGGER.INFO
|
|
642
656
|
}
|
|
643
657
|
});
|
|
644
|
-
case
|
|
645
|
-
callingClient =
|
|
658
|
+
case 4:
|
|
659
|
+
callingClient = _context18.sent;
|
|
646
660
|
expect(callingClient.primaryMobiusUris).toEqual([_callingClientFixtures.primaryUrl]);
|
|
647
661
|
expect(infoSpy).toHaveBeenCalledWith(_constants2.METHOD_START_MESSAGE, {
|
|
648
662
|
file: 'CallingClient',
|
|
@@ -653,335 +667,377 @@ describe('CallingClient Tests', function () {
|
|
|
653
667
|
method: 'GET'
|
|
654
668
|
}));
|
|
655
669
|
expect(handleErrorSpy).not.toHaveBeenCalled();
|
|
656
|
-
case
|
|
670
|
+
case 9:
|
|
657
671
|
case "end":
|
|
658
|
-
return
|
|
672
|
+
return _context18.stop();
|
|
659
673
|
}
|
|
660
|
-
},
|
|
674
|
+
}, _callee18);
|
|
661
675
|
})));
|
|
662
676
|
});
|
|
663
677
|
describe('Testing each cluster present withing host catalog', function () {
|
|
664
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'];
|
|
665
679
|
var checkCluster = /*#__PURE__*/function () {
|
|
666
|
-
var
|
|
680
|
+
var _ref19 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19(mockServiceHosts, mockCatalog) {
|
|
667
681
|
var callingClient;
|
|
668
|
-
return _regenerator.default.wrap(function
|
|
669
|
-
while (1) switch (
|
|
682
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
683
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
670
684
|
case 0:
|
|
671
685
|
webex.internal.services._hostCatalog = mockCatalog;
|
|
672
|
-
|
|
686
|
+
_context19.next = 3;
|
|
673
687
|
return (0, _CallingClient.createClient)(webex, {
|
|
674
688
|
logger: {
|
|
675
689
|
level: _types.LOGGER.INFO
|
|
676
690
|
}
|
|
677
691
|
});
|
|
678
692
|
case 3:
|
|
679
|
-
callingClient =
|
|
693
|
+
callingClient = _context19.sent;
|
|
680
694
|
expect(callingClient['mobiusClusters']).toStrictEqual(mockServiceHosts);
|
|
681
695
|
case 5:
|
|
682
696
|
case "end":
|
|
683
|
-
return
|
|
697
|
+
return _context19.stop();
|
|
684
698
|
}
|
|
685
|
-
},
|
|
699
|
+
}, _callee19);
|
|
686
700
|
}));
|
|
687
701
|
return function checkCluster(_x, _x2) {
|
|
688
|
-
return
|
|
702
|
+
return _ref19.apply(this, arguments);
|
|
689
703
|
};
|
|
690
704
|
}();
|
|
691
705
|
it.each(mobiusCluster)('%s', /*#__PURE__*/function () {
|
|
692
|
-
var
|
|
693
|
-
return _regenerator.default.wrap(function
|
|
694
|
-
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) {
|
|
695
709
|
case 0:
|
|
696
|
-
|
|
697
|
-
|
|
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;
|
|
698
712
|
break;
|
|
699
713
|
case 3:
|
|
700
714
|
checkCluster(_callingClientFixtures.mockEUServiceHosts, _callingClientFixtures.mockCatalogEU);
|
|
701
|
-
return
|
|
715
|
+
return _context20.abrupt("break", 10);
|
|
702
716
|
case 5:
|
|
703
717
|
checkCluster(_callingClientFixtures.mockIntServiceHosts, _callingClientFixtures.mockCatalogUSInt);
|
|
704
|
-
return
|
|
718
|
+
return _context20.abrupt("break", 10);
|
|
705
719
|
case 7:
|
|
706
720
|
checkCluster(_callingClientFixtures.mockEUIntServiceHosts, _callingClientFixtures.mockCatalogEUInt);
|
|
707
|
-
return
|
|
721
|
+
return _context20.abrupt("break", 10);
|
|
708
722
|
case 9:
|
|
709
|
-
return
|
|
723
|
+
return _context20.abrupt("break", 10);
|
|
710
724
|
case 10:
|
|
711
725
|
case "end":
|
|
712
|
-
return
|
|
726
|
+
return _context20.stop();
|
|
713
727
|
}
|
|
714
|
-
},
|
|
728
|
+
}, _callee20);
|
|
715
729
|
}));
|
|
716
730
|
return function (_x3) {
|
|
717
|
-
return
|
|
731
|
+
return _ref20.apply(this, arguments);
|
|
718
732
|
};
|
|
719
733
|
}());
|
|
720
734
|
});
|
|
721
|
-
describe('
|
|
735
|
+
describe('Line creation tests', function () {
|
|
736
|
+
var callingClient;
|
|
737
|
+
var line;
|
|
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) {
|
|
741
|
+
case 0:
|
|
742
|
+
_context21.next = 2;
|
|
743
|
+
return (0, _CallingClient.createClient)(webex);
|
|
744
|
+
case 2:
|
|
745
|
+
callingClient = _context21.sent;
|
|
746
|
+
line = (0, _values.default)(callingClient.lineDict)[0];
|
|
747
|
+
case 4:
|
|
748
|
+
case "end":
|
|
749
|
+
return _context21.stop();
|
|
750
|
+
}
|
|
751
|
+
}, _callee21);
|
|
752
|
+
})));
|
|
753
|
+
afterEach(function () {
|
|
754
|
+
jest.clearAllTimers();
|
|
755
|
+
jest.clearAllMocks();
|
|
756
|
+
callingClient.removeAllListeners();
|
|
757
|
+
callManager.removeAllListeners();
|
|
758
|
+
callingClient = undefined;
|
|
759
|
+
jest.useRealTimers();
|
|
760
|
+
});
|
|
761
|
+
it('verify line dict successfully created', function () {
|
|
762
|
+
expect(callingClient.lineDict).toBeTruthy();
|
|
763
|
+
expect(line).toBeTruthy();
|
|
764
|
+
expect((0, _keys.default)(callingClient.lineDict).length).toEqual(1);
|
|
765
|
+
});
|
|
766
|
+
it('verify getLines response', function () {
|
|
767
|
+
expect(callingClient.getLines).toBeTruthy();
|
|
768
|
+
expect(callingClient.getLines()).toEqual(callingClient.lineDict);
|
|
769
|
+
});
|
|
770
|
+
});
|
|
771
|
+
describe('Connectivity and Mercury event handlers', function () {
|
|
722
772
|
var callingClient;
|
|
723
773
|
var line;
|
|
724
774
|
var reg;
|
|
725
|
-
var
|
|
726
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
775
|
+
var windowEventSpy;
|
|
727
776
|
var deRegSpy;
|
|
777
|
+
var restoreSpy;
|
|
728
778
|
var restartRegisterSpy;
|
|
729
779
|
var registerSpy;
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
780
|
+
var metricSpy;
|
|
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) {
|
|
733
784
|
case 0:
|
|
734
785
|
jest.useFakeTimers();
|
|
735
786
|
webex.request.mockResolvedValueOnce(_callingClientFixtures.ipPayload).mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload).mockResolvedValueOnce(_callingClientFixtures.registrationPayload);
|
|
736
|
-
|
|
787
|
+
windowEventSpy = jest.spyOn(window, 'addEventListener');
|
|
788
|
+
_context22.next = 5;
|
|
737
789
|
return (0, _CallingClient.createClient)(webex, {
|
|
738
790
|
logger: {
|
|
739
791
|
level: _types.LOGGER.INFO
|
|
740
792
|
}
|
|
741
793
|
});
|
|
742
|
-
case
|
|
743
|
-
callingClient =
|
|
794
|
+
case 5:
|
|
795
|
+
callingClient = _context22.sent;
|
|
744
796
|
line = (0, _values.default)(callingClient.lineDict)[0];
|
|
745
797
|
reg = line.registration;
|
|
746
|
-
|
|
798
|
+
_context22.next = 10;
|
|
747
799
|
return line.register();
|
|
748
|
-
case
|
|
749
|
-
deRegSpy = jest.spyOn(
|
|
800
|
+
case 10:
|
|
801
|
+
deRegSpy = jest.spyOn(reg, 'deregister');
|
|
750
802
|
restoreSpy = jest.spyOn(reg, 'restorePreviousRegistration');
|
|
751
803
|
restartRegisterSpy = jest.spyOn(reg, 'restartRegistration');
|
|
752
804
|
registerSpy = jest.spyOn(reg, 'attemptRegistrationWithServers');
|
|
753
|
-
|
|
805
|
+
metricSpy = jest.spyOn(callingClient['metricManager'], 'submitConnectionMetrics');
|
|
806
|
+
case 15:
|
|
754
807
|
case "end":
|
|
755
|
-
return
|
|
808
|
+
return _context22.stop();
|
|
756
809
|
}
|
|
757
|
-
},
|
|
810
|
+
}, _callee22);
|
|
758
811
|
})));
|
|
759
812
|
afterEach(function () {
|
|
760
813
|
jest.clearAllTimers();
|
|
761
814
|
jest.clearAllMocks();
|
|
762
815
|
callingClient.removeAllListeners();
|
|
816
|
+
callingClient['callManager'].callCollection = {};
|
|
763
817
|
callManager.removeAllListeners();
|
|
764
818
|
callingClient = undefined;
|
|
765
819
|
jest.useRealTimers();
|
|
766
820
|
});
|
|
767
|
-
it('
|
|
768
|
-
|
|
769
|
-
|
|
821
|
+
it('window offline handler sets networkDown and clears keepalive when network is unreachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
822
|
+
var g, clearKeepaliveSpy, offlineCb;
|
|
823
|
+
return _regenerator.default.wrap(function _callee23$(_context23) {
|
|
824
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
770
825
|
case 0:
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
expect(warnSpy).toBeCalledOnceWith('Network has flapped, waiting for mercury connection to be up', {
|
|
826
|
+
g = global;
|
|
827
|
+
g.fetch = jest.fn().mockRejectedValueOnce(new Error('network fail'));
|
|
828
|
+
clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
829
|
+
offlineCb = windowEventSpy.mock.calls[1][1];
|
|
830
|
+
_context23.next = 6;
|
|
831
|
+
return offlineCb();
|
|
832
|
+
case 6:
|
|
833
|
+
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Network connectivity probe failed'), {
|
|
780
834
|
file: _constants.CALLING_CLIENT_FILE,
|
|
781
|
-
method:
|
|
782
|
-
});
|
|
783
|
-
|
|
784
|
-
/* Set mercury connection to be up and execute a delay of 2.5 seconds */
|
|
785
|
-
webex.internal.mercury.connected = true;
|
|
786
|
-
logSpy.mockReset();
|
|
787
|
-
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
788
|
-
_context24.next = 10;
|
|
789
|
-
return flushPromises();
|
|
790
|
-
case 10:
|
|
791
|
-
_Logger.default.info('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
792
|
-
file: _constants.REGISTRATION_FILE,
|
|
793
|
-
method: 'handleConnectionRestoration'
|
|
835
|
+
method: 'pingExternal'
|
|
794
836
|
});
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
837
|
+
expect(callingClient['isNetworkDown']).toBe(true);
|
|
838
|
+
expect(clearKeepaliveSpy).toHaveBeenCalled();
|
|
839
|
+
case 9:
|
|
840
|
+
case "end":
|
|
841
|
+
return _context23.stop();
|
|
842
|
+
}
|
|
843
|
+
}, _callee23);
|
|
844
|
+
})));
|
|
845
|
+
it('window offline handler does not clear keepalive when network is reachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
846
|
+
var g, clearKeepaliveSpy, offlineCb;
|
|
847
|
+
return _regenerator.default.wrap(function _callee24$(_context24) {
|
|
848
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
849
|
+
case 0:
|
|
850
|
+
g = global;
|
|
851
|
+
g.fetch = jest.fn().mockResolvedValueOnce({});
|
|
852
|
+
clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
853
|
+
offlineCb = windowEventSpy.mock.calls[1][1];
|
|
854
|
+
_context24.next = 6;
|
|
855
|
+
return offlineCb();
|
|
856
|
+
case 6:
|
|
857
|
+
expect(g.fetch).toHaveBeenCalledWith('https://www.google.com/generate_204', expect.any(Object));
|
|
858
|
+
expect(callingClient['isNetworkDown']).toBe(false);
|
|
859
|
+
expect(clearKeepaliveSpy).not.toHaveBeenCalled();
|
|
860
|
+
case 9:
|
|
807
861
|
case "end":
|
|
808
862
|
return _context24.stop();
|
|
809
863
|
}
|
|
810
864
|
}, _callee24);
|
|
811
865
|
})));
|
|
812
|
-
it('
|
|
813
|
-
var
|
|
866
|
+
it('window online handler sets networkUpTimestamp and logs', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
867
|
+
var onlineCb;
|
|
814
868
|
return _regenerator.default.wrap(function _callee25$(_context25) {
|
|
815
869
|
while (1) switch (_context25.prev = _context25.next) {
|
|
816
870
|
case 0:
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
successPayload = {
|
|
824
|
-
statusCode: 200,
|
|
825
|
-
body: mockRegistrationBody
|
|
826
|
-
};
|
|
827
|
-
webex.request.mockRejectedValueOnce(failurePayload).mockResolvedValueOnce(successPayload);
|
|
828
|
-
|
|
829
|
-
/* Set mercury connection to be down and execute a delay of 2.5 seconds */
|
|
830
|
-
webex.internal.mercury.connected = false;
|
|
831
|
-
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
832
|
-
|
|
833
|
-
/* We should be detecting the network flap */
|
|
834
|
-
expect(warnSpy).toBeCalledWith('Network has flapped, waiting for mercury connection to be up', {
|
|
871
|
+
onlineCb = windowEventSpy.mock.calls[0][1];
|
|
872
|
+
_context25.next = 3;
|
|
873
|
+
return onlineCb();
|
|
874
|
+
case 3:
|
|
875
|
+
expect(callingClient['networkUpTimestamp']).toEqual(expect.any(String));
|
|
876
|
+
expect(infoSpy).toHaveBeenCalledWith(_constants2.METHOD_START_MESSAGE, {
|
|
835
877
|
file: _constants.CALLING_CLIENT_FILE,
|
|
836
|
-
method:
|
|
878
|
+
method: 'handleNetworkOnline'
|
|
837
879
|
});
|
|
838
|
-
|
|
839
|
-
/* Set mercury connection to be up and execute a delay of 2.5 seconds */
|
|
840
|
-
webex.internal.mercury.connected = true;
|
|
841
|
-
logSpy.mockReset();
|
|
842
|
-
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
843
|
-
_context25.next = 13;
|
|
844
|
-
return flushPromises();
|
|
845
|
-
case 13:
|
|
846
|
-
_Logger.default.info('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
847
|
-
file: _constants.REGISTRATION_FILE,
|
|
848
|
-
method: 'handleConnectionRestoration'
|
|
849
|
-
});
|
|
850
|
-
|
|
851
|
-
/* We should be detecting the network recovery */
|
|
852
|
-
expect(logSpy).toBeCalledWith('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
853
|
-
file: _constants.REGISTRATION_FILE,
|
|
854
|
-
method: 'handleConnectionRestoration'
|
|
855
|
-
});
|
|
856
|
-
expect(restoreSpy).toHaveBeenCalledWith('handleConnectionRestoration');
|
|
857
|
-
expect(restartRegisterSpy).toHaveBeenCalledWith('handleConnectionRestoration');
|
|
858
|
-
expect(webex.request).toHaveBeenCalledTimes(6);
|
|
859
|
-
expect(registerSpy).toHaveBeenCalledWith('handleConnectionRestoration', [reg.getActiveMobiusUrl()]);
|
|
860
|
-
expect(registerSpy).toHaveBeenCalledWith('handleConnectionRestoration', [_callingClientFixtures.primaryUrl]);
|
|
861
|
-
case 20:
|
|
880
|
+
case 5:
|
|
862
881
|
case "end":
|
|
863
882
|
return _context25.stop();
|
|
864
883
|
}
|
|
865
884
|
}, _callee25);
|
|
866
885
|
})));
|
|
867
|
-
it('
|
|
868
|
-
var
|
|
886
|
+
it('mercury offline submits metrics and sets timestamp', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
887
|
+
var mercuryOfflineCb;
|
|
869
888
|
return _regenerator.default.wrap(function _callee26$(_context26) {
|
|
870
889
|
while (1) switch (_context26.prev = _context26.next) {
|
|
871
890
|
case 0:
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
webex.internal.mercury.connected = false;
|
|
878
|
-
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
879
|
-
|
|
880
|
-
/* We should be detecting the network flap */
|
|
881
|
-
expect(warnSpy).toBeCalledOnceWith('Network has flapped, waiting for mercury connection to be up', {
|
|
891
|
+
mercuryOfflineCb = webex.internal.mercury.on.mock.calls[1][1];
|
|
892
|
+
_context26.next = 3;
|
|
893
|
+
return mercuryOfflineCb();
|
|
894
|
+
case 3:
|
|
895
|
+
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Mercury down, waiting for connection to be up'), {
|
|
882
896
|
file: _constants.CALLING_CLIENT_FILE,
|
|
883
|
-
method:
|
|
897
|
+
method: 'handleMercuryOffline'
|
|
884
898
|
});
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
889
|
-
_context26.next = 10;
|
|
890
|
-
return flushPromises();
|
|
891
|
-
case 10:
|
|
892
|
-
/* We should be detecting the network recovery */
|
|
893
|
-
expect(logSpy).not.toBeCalledWith('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
894
|
-
file: _constants.REGISTRATION_FILE,
|
|
895
|
-
method: 'handleConnectionRestoration'
|
|
896
|
-
});
|
|
897
|
-
|
|
898
|
-
/*
|
|
899
|
-
* When initial registration is not done, network flap
|
|
900
|
-
* will not trigger de-registration/registration
|
|
901
|
-
*/
|
|
902
|
-
expect(handleConnectionRestoreSpy).not.toBeCalledOnceWith();
|
|
903
|
-
case 12:
|
|
899
|
+
expect(callingClient['mercuryDownTimestamp']).toEqual(expect.any(String));
|
|
900
|
+
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.MERCURY_DOWN, _types4.METRIC_TYPE.BEHAVIORAL, expect.any(String), '');
|
|
901
|
+
case 6:
|
|
904
902
|
case "end":
|
|
905
903
|
return _context26.stop();
|
|
906
904
|
}
|
|
907
905
|
}, _callee26);
|
|
908
906
|
})));
|
|
909
|
-
it('
|
|
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() {
|
|
908
|
+
var handleConnectionRestoreSpy, mercuryOnlineCb;
|
|
910
909
|
return _regenerator.default.wrap(function _callee27$(_context27) {
|
|
911
910
|
while (1) switch (_context27.prev = _context27.next) {
|
|
912
911
|
case 0:
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
/* Set mercury connection to be down and execute a delay of 2.5 seconds */
|
|
920
|
-
webex.internal.mercury.connected = false;
|
|
921
|
-
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
912
|
+
handleConnectionRestoreSpy = jest.spyOn(reg, 'handleConnectionRestoration');
|
|
913
|
+
callingClient['isNetworkDown'] = true;
|
|
914
|
+
callingClient['networkDownTimestamp'] = '2023-01-01T00:00:00.000Z';
|
|
915
|
+
callingClient['networkUpTimestamp'] = '2023-01-01T00:01:00.000Z';
|
|
916
|
+
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
922
917
|
_context27.next = 7;
|
|
923
|
-
return
|
|
918
|
+
return mercuryOnlineCb();
|
|
924
919
|
case 7:
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
method: 'handleConnectionRestoration'
|
|
929
|
-
});
|
|
930
|
-
|
|
931
|
-
/* Set mercury connection to be up and execute a delay of 2.5 seconds */
|
|
932
|
-
webex.internal.mercury.connected = true;
|
|
933
|
-
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
934
|
-
_context27.next = 12;
|
|
920
|
+
// Run the interval once
|
|
921
|
+
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 100);
|
|
922
|
+
_context27.next = 10;
|
|
935
923
|
return flushPromises();
|
|
936
|
-
case
|
|
937
|
-
|
|
938
|
-
expect(logSpy).
|
|
924
|
+
case 10:
|
|
925
|
+
expect(handleConnectionRestoreSpy).toHaveBeenCalledWith(true);
|
|
926
|
+
expect(logSpy).toHaveBeenCalledWith('Network is up again, re-registering with Webex Calling if needed', {
|
|
939
927
|
file: _constants.REGISTRATION_FILE,
|
|
940
928
|
method: 'handleConnectionRestoration'
|
|
941
929
|
});
|
|
942
|
-
expect(
|
|
943
|
-
|
|
930
|
+
expect(deRegSpy).toHaveBeenCalledWith();
|
|
931
|
+
expect(restoreSpy).toHaveBeenCalledWith('handleConnectionRestoration');
|
|
932
|
+
expect(restartRegisterSpy).toHaveBeenCalledWith('handleConnectionRestoration');
|
|
933
|
+
expect(registerSpy).toHaveBeenCalledWith('handleConnectionRestoration', [reg.getActiveMobiusUrl()]);
|
|
934
|
+
expect(registerSpy).toHaveBeenCalledWith('handleConnectionRestoration', [_callingClientFixtures.primaryUrl]);
|
|
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');
|
|
936
|
+
case 18:
|
|
944
937
|
case "end":
|
|
945
938
|
return _context27.stop();
|
|
946
939
|
}
|
|
947
940
|
}, _callee27);
|
|
948
941
|
})));
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
var callingClient;
|
|
952
|
-
var line;
|
|
953
|
-
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28() {
|
|
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() {
|
|
943
|
+
var handleConnectionRestoreSpy, mercuryOnlineCb;
|
|
954
944
|
return _regenerator.default.wrap(function _callee28$(_context28) {
|
|
955
945
|
while (1) switch (_context28.prev = _context28.next) {
|
|
956
946
|
case 0:
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
callingClient =
|
|
961
|
-
|
|
962
|
-
|
|
947
|
+
handleConnectionRestoreSpy = jest.spyOn(reg, 'handleConnectionRestoration');
|
|
948
|
+
callingClient['isNetworkDown'] = true;
|
|
949
|
+
callingClient['networkDownTimestamp'] = '2023-01-01T00:00:00.000Z';
|
|
950
|
+
callingClient['networkUpTimestamp'] = '2023-01-01T00:01:00.000Z';
|
|
951
|
+
reg.setStatus(_types2.RegistrationStatus.IDLE);
|
|
952
|
+
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
953
|
+
_context28.next = 8;
|
|
954
|
+
return mercuryOnlineCb();
|
|
955
|
+
case 8:
|
|
956
|
+
// Run the interval once
|
|
957
|
+
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 100);
|
|
958
|
+
_context28.next = 11;
|
|
959
|
+
return flushPromises();
|
|
960
|
+
case 11:
|
|
961
|
+
expect(handleConnectionRestoreSpy).not.toHaveBeenCalledWith(true);
|
|
962
|
+
expect(logSpy).not.toHaveBeenCalledWith('Network is up again, re-registering with Webex Calling if needed', {
|
|
963
|
+
file: _constants.REGISTRATION_FILE,
|
|
964
|
+
method: 'handleConnectionRestoration'
|
|
965
|
+
});
|
|
966
|
+
expect(deRegSpy).not.toHaveBeenCalledWith();
|
|
967
|
+
expect(restoreSpy).not.toHaveBeenCalledWith('handleConnectionRestoration');
|
|
968
|
+
expect(restartRegisterSpy).not.toHaveBeenCalledWith('handleConnectionRestoration');
|
|
969
|
+
expect(registerSpy).not.toHaveBeenCalledWith('handleConnectionRestoration', [reg.getActiveMobiusUrl()]);
|
|
970
|
+
expect(registerSpy).not.toHaveBeenCalledWith('handleConnectionRestoration', [_callingClientFixtures.primaryUrl]);
|
|
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');
|
|
972
|
+
case 19:
|
|
963
973
|
case "end":
|
|
964
974
|
return _context28.stop();
|
|
965
975
|
}
|
|
966
976
|
}, _callee28);
|
|
967
977
|
})));
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
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() {
|
|
979
|
+
var call, callKeepaliveSpy, deleteSpy, mercuryOnlineCb;
|
|
980
|
+
return _regenerator.default.wrap(function _callee29$(_context29) {
|
|
981
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
982
|
+
case 0:
|
|
983
|
+
callingClient['isNetworkDown'] = true;
|
|
984
|
+
call = callingClient['callManager'].createCall();
|
|
985
|
+
callKeepaliveSpy = jest.spyOn(call, 'postStatus').mockRejectedValueOnce(new Error('keepalive fail'));
|
|
986
|
+
deleteSpy = jest.spyOn(call, 'delete');
|
|
987
|
+
expect((0, _keys.default)(callingClient['callManager'].getActiveCalls()).length).toBe(1);
|
|
988
|
+
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
989
|
+
_context29.next = 8;
|
|
990
|
+
return mercuryOnlineCb();
|
|
991
|
+
case 8:
|
|
992
|
+
expect(callKeepaliveSpy).toHaveBeenCalled();
|
|
993
|
+
_context29.next = 11;
|
|
994
|
+
return flushPromises();
|
|
995
|
+
case 11:
|
|
996
|
+
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Call Keepalive failed'), {
|
|
997
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
998
|
+
method: 'checkCallStatus'
|
|
999
|
+
});
|
|
1000
|
+
expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
|
|
1001
|
+
expect(deleteSpy).toHaveBeenCalled();
|
|
1002
|
+
expect((0, _keys.default)(reg.callManager.getActiveCalls()).length).toBe(0);
|
|
1003
|
+
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.NETWORK_FLAP, _types4.METRIC_TYPE.BEHAVIORAL, expect.any(String), expect.any(String));
|
|
1004
|
+
case 16:
|
|
1005
|
+
case "end":
|
|
1006
|
+
return _context29.stop();
|
|
1007
|
+
}
|
|
1008
|
+
}, _callee29);
|
|
1009
|
+
})));
|
|
1010
|
+
it('handle calls status check once mercury comes back up with stable network', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
|
|
1011
|
+
var call, callKeepaliveSpy, deleteSpy, mercuryOnlineCb;
|
|
1012
|
+
return _regenerator.default.wrap(function _callee30$(_context30) {
|
|
1013
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
1014
|
+
case 0:
|
|
1015
|
+
call = callingClient['callManager'].createCall();
|
|
1016
|
+
callKeepaliveSpy = jest.spyOn(call, 'postStatus').mockRejectedValueOnce(new Error('keepalive fail'));
|
|
1017
|
+
deleteSpy = jest.spyOn(call, 'delete');
|
|
1018
|
+
expect((0, _keys.default)(callingClient['callManager'].getActiveCalls()).length).toBe(1);
|
|
1019
|
+
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
1020
|
+
_context30.next = 7;
|
|
1021
|
+
return mercuryOnlineCb();
|
|
1022
|
+
case 7:
|
|
1023
|
+
expect(callKeepaliveSpy).toHaveBeenCalled();
|
|
1024
|
+
_context30.next = 10;
|
|
1025
|
+
return flushPromises();
|
|
1026
|
+
case 10:
|
|
1027
|
+
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Call Keepalive failed'), {
|
|
1028
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
1029
|
+
method: 'checkCallStatus'
|
|
1030
|
+
});
|
|
1031
|
+
expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
|
|
1032
|
+
expect(deleteSpy).toHaveBeenCalled();
|
|
1033
|
+
expect((0, _keys.default)(reg.callManager.getActiveCalls()).length).toBe(0);
|
|
1034
|
+
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.MERCURY_UP, _types4.METRIC_TYPE.BEHAVIORAL, expect.any(String), expect.any(String));
|
|
1035
|
+
case 15:
|
|
1036
|
+
case "end":
|
|
1037
|
+
return _context30.stop();
|
|
1038
|
+
}
|
|
1039
|
+
}, _callee30);
|
|
1040
|
+
})));
|
|
985
1041
|
});
|
|
986
1042
|
|
|
987
1043
|
// Calling related test cases
|
|
@@ -998,15 +1054,15 @@ describe('CallingClient Tests', function () {
|
|
|
998
1054
|
});
|
|
999
1055
|
var callingClient;
|
|
1000
1056
|
var line;
|
|
1001
|
-
beforeAll(
|
|
1057
|
+
beforeAll(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
|
|
1002
1058
|
var calls;
|
|
1003
|
-
return _regenerator.default.wrap(function
|
|
1004
|
-
while (1) switch (
|
|
1059
|
+
return _regenerator.default.wrap(function _callee31$(_context31) {
|
|
1060
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1005
1061
|
case 0:
|
|
1006
|
-
|
|
1062
|
+
_context31.next = 2;
|
|
1007
1063
|
return (0, _CallingClient.createClient)(webex);
|
|
1008
1064
|
case 2:
|
|
1009
|
-
callingClient =
|
|
1065
|
+
callingClient = _context31.sent;
|
|
1010
1066
|
line = new _line.default(userId, clientDeviceUri, mutex, primaryMobiusUris(), backupMobiusUris(), _types.LOGGER.INFO);
|
|
1011
1067
|
calls = (0, _values.default)(callManager.getActiveCalls());
|
|
1012
1068
|
calls.forEach(function (call) {
|
|
@@ -1014,9 +1070,9 @@ describe('CallingClient Tests', function () {
|
|
|
1014
1070
|
});
|
|
1015
1071
|
case 6:
|
|
1016
1072
|
case "end":
|
|
1017
|
-
return
|
|
1073
|
+
return _context31.stop();
|
|
1018
1074
|
}
|
|
1019
|
-
},
|
|
1075
|
+
}, _callee31);
|
|
1020
1076
|
})));
|
|
1021
1077
|
afterAll(function () {
|
|
1022
1078
|
callingClient.removeAllListeners();
|
|
@@ -1099,23 +1155,23 @@ describe('CallingClient Tests', function () {
|
|
|
1099
1155
|
describe('Call Session Event test', function () {
|
|
1100
1156
|
var mockOn = webex.internal.mercury.on;
|
|
1101
1157
|
var callingClient;
|
|
1102
|
-
beforeEach(
|
|
1103
|
-
return _regenerator.default.wrap(function
|
|
1104
|
-
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) {
|
|
1105
1161
|
case 0:
|
|
1106
|
-
|
|
1162
|
+
_context32.next = 2;
|
|
1107
1163
|
return (0, _CallingClient.createClient)(webex, {
|
|
1108
1164
|
logger: {
|
|
1109
1165
|
level: _types.LOGGER.INFO
|
|
1110
1166
|
}
|
|
1111
1167
|
});
|
|
1112
1168
|
case 2:
|
|
1113
|
-
callingClient =
|
|
1169
|
+
callingClient = _context32.sent;
|
|
1114
1170
|
case 3:
|
|
1115
1171
|
case "end":
|
|
1116
|
-
return
|
|
1172
|
+
return _context32.stop();
|
|
1117
1173
|
}
|
|
1118
|
-
},
|
|
1174
|
+
}, _callee32);
|
|
1119
1175
|
})));
|
|
1120
1176
|
afterEach(function () {
|
|
1121
1177
|
callingClient.removeAllListeners();
|
|
@@ -1142,5 +1198,92 @@ describe('CallingClient Tests', function () {
|
|
|
1142
1198
|
callSessionCallback(_callRecordFixtures.MOCK_MULTIPLE_SESSIONS_EVENT);
|
|
1143
1199
|
});
|
|
1144
1200
|
});
|
|
1201
|
+
describe('windowsChromiumIceWarmup', function () {
|
|
1202
|
+
var origRTCPeerConnection;
|
|
1203
|
+
beforeAll(function () {
|
|
1204
|
+
var _class;
|
|
1205
|
+
origRTCPeerConnection = global.RTCPeerConnection;
|
|
1206
|
+
// Minimal mock for RTCPeerConnection
|
|
1207
|
+
global.RTCPeerConnection = (_class = /*#__PURE__*/function () {
|
|
1208
|
+
function _class() {
|
|
1209
|
+
(0, _classCallCheck2.default)(this, _class);
|
|
1210
|
+
(0, _defineProperty2.default)(this, "iceGatheringState", 'complete');
|
|
1211
|
+
(0, _defineProperty2.default)(this, "localDescription", null);
|
|
1212
|
+
(0, _defineProperty2.default)(this, "remoteDescription", null);
|
|
1213
|
+
(0, _defineProperty2.default)(this, "onicecandidate", null);
|
|
1214
|
+
this.constructor.instances.push(this);
|
|
1215
|
+
}
|
|
1216
|
+
(0, _createClass2.default)(_class, [{
|
|
1217
|
+
key: "createDataChannel",
|
|
1218
|
+
value: function createDataChannel() {
|
|
1219
|
+
return {};
|
|
1220
|
+
}
|
|
1221
|
+
}, {
|
|
1222
|
+
key: "addTransceiver",
|
|
1223
|
+
value: function addTransceiver() {
|
|
1224
|
+
return {};
|
|
1225
|
+
}
|
|
1226
|
+
}, {
|
|
1227
|
+
key: "createOffer",
|
|
1228
|
+
value: function createOffer() {
|
|
1229
|
+
return _promise.default.resolve({
|
|
1230
|
+
sdp: 'offer',
|
|
1231
|
+
type: 'offer'
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
}, {
|
|
1235
|
+
key: "setLocalDescription",
|
|
1236
|
+
value: function setLocalDescription(desc) {
|
|
1237
|
+
this.localDescription = desc;
|
|
1238
|
+
return _promise.default.resolve();
|
|
1239
|
+
}
|
|
1240
|
+
}, {
|
|
1241
|
+
key: "setRemoteDescription",
|
|
1242
|
+
value: function setRemoteDescription(desc) {
|
|
1243
|
+
this.remoteDescription = desc;
|
|
1244
|
+
return _promise.default.resolve();
|
|
1245
|
+
}
|
|
1246
|
+
}, {
|
|
1247
|
+
key: "createAnswer",
|
|
1248
|
+
value: function createAnswer() {
|
|
1249
|
+
return _promise.default.resolve({
|
|
1250
|
+
sdp: 'answer',
|
|
1251
|
+
type: 'answer'
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1254
|
+
}, {
|
|
1255
|
+
key: "addIceCandidate",
|
|
1256
|
+
value: function addIceCandidate() {
|
|
1257
|
+
return _promise.default.resolve();
|
|
1258
|
+
}
|
|
1259
|
+
}, {
|
|
1260
|
+
key: "close",
|
|
1261
|
+
value: function close() {}
|
|
1262
|
+
}, {
|
|
1263
|
+
key: "addEventListener",
|
|
1264
|
+
value: function addEventListener() {}
|
|
1265
|
+
}, {
|
|
1266
|
+
key: "removeEventListener",
|
|
1267
|
+
value: function removeEventListener() {}
|
|
1268
|
+
}]);
|
|
1269
|
+
return _class;
|
|
1270
|
+
}(), (0, _defineProperty2.default)(_class, "instances", []), _class);
|
|
1271
|
+
});
|
|
1272
|
+
afterAll(function () {
|
|
1273
|
+
global.RTCPeerConnection = origRTCPeerConnection;
|
|
1274
|
+
});
|
|
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) {
|
|
1278
|
+
case 0:
|
|
1279
|
+
_context33.next = 2;
|
|
1280
|
+
return expect((0, _windowsChromiumIceWarmupUtils.default)({})).resolves.not.toThrow();
|
|
1281
|
+
case 2:
|
|
1282
|
+
case "end":
|
|
1283
|
+
return _context33.stop();
|
|
1284
|
+
}
|
|
1285
|
+
}, _callee33);
|
|
1286
|
+
})));
|
|
1287
|
+
});
|
|
1145
1288
|
});
|
|
1146
1289
|
//# sourceMappingURL=CallingClient.test.js.map
|