@webex/calling 3.10.0-next.2 → 3.10.0-next.20
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 +128 -128
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +278 -181
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallSettings/CallSettings.js +17 -18
- package/dist/CallSettings/CallSettings.js.map +1 -1
- package/dist/CallSettings/CallSettings.test.js +14 -14
- package/dist/CallSettings/CallSettings.test.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.js +71 -24
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +136 -47
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +137 -138
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +145 -149
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +297 -345
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +267 -405
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.js +7 -8
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +24 -24
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +655 -611
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +762 -551
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +15 -18
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +113 -113
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/constants.js +5 -1
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +57 -74
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +22 -22
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +657 -526
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +657 -309
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +24 -24
- package/dist/CallingClient/registration/webWorker.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.test.js +20 -20
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +28 -28
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -1
- package/dist/Contacts/ContactsClient.js +258 -258
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +60 -60
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Errors/catalog/CallError.js +7 -10
- package/dist/Errors/catalog/CallError.js.map +1 -1
- package/dist/Errors/catalog/CallingDeviceError.js +6 -9
- package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
- package/dist/Errors/catalog/ExtendedError.js +6 -8
- package/dist/Errors/catalog/ExtendedError.js.map +1 -1
- package/dist/Errors/catalog/LineError.js +6 -9
- package/dist/Errors/catalog/LineError.js.map +1 -1
- package/dist/Events/impl/index.js +11 -13
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/Metrics/index.js +1 -2
- package/dist/Metrics/index.js.map +1 -1
- package/dist/SDKConnector/index.js +1 -2
- package/dist/SDKConnector/index.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +129 -128
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +98 -98
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +86 -86
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +72 -72
- package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +58 -61
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/Voicemail.test.js +20 -20
- package/dist/Voicemail/Voicemail.test.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +116 -117
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +140 -140
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
- package/dist/common/Utils.js +195 -165
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +432 -183
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/constants.js +3 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/testUtil.js +5 -4
- package/dist/common/testUtil.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +7 -3
- package/dist/module/CallSettings/UcmBackendConnector.js +20 -6
- package/dist/module/CallSettings/WxCallBackendConnector.js +3 -1
- package/dist/module/CallingClient/CallingClient.js +83 -121
- package/dist/module/CallingClient/calling/call.js +60 -39
- package/dist/module/CallingClient/constants.js +3 -0
- package/dist/module/CallingClient/registration/register.js +82 -2
- package/dist/module/Contacts/ContactsClient.js +9 -5
- package/dist/module/Voicemail/BroadworksBackendConnector.js +3 -1
- package/dist/module/Voicemail/UcmBackendConnector.js +2 -1
- package/dist/module/common/Utils.js +27 -3
- package/dist/module/common/constants.js +2 -0
- package/dist/module/common/testUtil.js +1 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts +1 -0
- 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 +4 -0
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +3 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +4 -0
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +6 -0
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/Contacts/ContactsClient.d.ts +1 -0
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +16 -0
- 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/common/Utils.d.ts +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/constants.d.ts +2 -0
- package/dist/types/common/constants.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +1 -0
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -36,7 +36,7 @@ var _registerFixtures = require("./registration/registerFixtures");
|
|
|
36
36
|
var _constants2 = require("../common/constants");
|
|
37
37
|
var _types4 = require("../Metrics/types");
|
|
38
38
|
var _windowsChromiumIceWarmupUtils = _interopRequireDefault(require("./windowsChromiumIceWarmupUtils"));
|
|
39
|
-
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
|
|
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 _t5 in e) "default" !== _t5 && {}.hasOwnProperty.call(e, _t5) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t5)) && (i.get || i.set) ? o(f, _t5, i) : f[_t5] = e[_t5]); return f; })(e, t); }
|
|
40
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; }
|
|
41
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 */
|
|
42
42
|
global.crypto = {
|
|
@@ -52,6 +52,7 @@ 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);
|
|
55
56
|
var defaultServiceIndicator = _types2.ServiceIndicator.CALLING;
|
|
56
57
|
var callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
|
|
57
58
|
var infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
@@ -69,51 +70,48 @@ describe('CallingClient Tests', function () {
|
|
|
69
70
|
webex.internal.services['_serviceUrls']['mobius'] = 'https://mobius.aintgen-a-1.int.infra.webex.com/api/v1';
|
|
70
71
|
webex.internal.services['_hostCatalog'] = _callingClientFixtures.mockCatalogUS;
|
|
71
72
|
});
|
|
72
|
-
it('should
|
|
73
|
-
var
|
|
74
|
-
return _regenerator.default.wrap(function
|
|
73
|
+
it('should use default mobius service host when Service URL is invalid', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
74
|
+
var callingClient;
|
|
75
|
+
return _regenerator.default.wrap(function (_context) {
|
|
75
76
|
while (1) switch (_context.prev = _context.next) {
|
|
76
77
|
case 0:
|
|
77
|
-
webex.internal.services._hostCatalog = _callingClientFixtures.
|
|
78
|
-
webex.internal.services
|
|
79
|
-
|
|
80
|
-
return new window.URL(url);
|
|
81
|
-
});
|
|
82
|
-
_context.next = 5;
|
|
78
|
+
webex.internal.services._hostCatalog = _callingClientFixtures.mockCatalogUS;
|
|
79
|
+
webex.internal.services._serviceUrls.mobius = 'invalid-url';
|
|
80
|
+
_context.next = 1;
|
|
83
81
|
return (0, _CallingClient.createClient)(webex, {
|
|
84
82
|
logger: {
|
|
85
83
|
level: _types.LOGGER.INFO
|
|
86
84
|
}
|
|
87
85
|
});
|
|
88
|
-
case
|
|
86
|
+
case 1:
|
|
89
87
|
callingClient = _context.sent;
|
|
90
|
-
expect(
|
|
91
|
-
expect(callingClient['mobiusClusters']).toStrictEqual(_callingClientFixtures.
|
|
92
|
-
|
|
93
|
-
case 9:
|
|
88
|
+
expect(setLoggerSpy).toHaveBeenCalledTimes(1);
|
|
89
|
+
expect(callingClient['mobiusClusters']).toStrictEqual(_callingClientFixtures.mockUSServiceHosts);
|
|
90
|
+
case 2:
|
|
94
91
|
case "end":
|
|
95
92
|
return _context.stop();
|
|
96
93
|
}
|
|
97
94
|
}, _callee);
|
|
98
95
|
})));
|
|
99
|
-
it('should
|
|
96
|
+
it('should set mobiusServiceHost correctly when URL is valid', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
100
97
|
var callingClient;
|
|
101
|
-
return _regenerator.default.wrap(function
|
|
98
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
102
99
|
while (1) switch (_context2.prev = _context2.next) {
|
|
103
100
|
case 0:
|
|
104
|
-
webex.internal.services._hostCatalog = _callingClientFixtures.
|
|
105
|
-
webex.internal.services.
|
|
106
|
-
|
|
101
|
+
webex.internal.services._hostCatalog = _callingClientFixtures.mockCatalogEU;
|
|
102
|
+
webex.internal.services.getMobiusClusters = jest.fn().mockReturnValue(_callingClientFixtures.mockEUServiceHosts);
|
|
103
|
+
webex.internal.services['_serviceUrls']['mobius'] = 'https://mobius-eu-central-1.prod.infra.webex.com/api/v1';
|
|
104
|
+
_context2.next = 1;
|
|
107
105
|
return (0, _CallingClient.createClient)(webex, {
|
|
108
106
|
logger: {
|
|
109
107
|
level: _types.LOGGER.INFO
|
|
110
108
|
}
|
|
111
109
|
});
|
|
112
|
-
case
|
|
110
|
+
case 1:
|
|
113
111
|
callingClient = _context2.sent;
|
|
114
|
-
expect(
|
|
115
|
-
expect(callingClient['mobiusClusters']).toStrictEqual(_callingClientFixtures.
|
|
116
|
-
case
|
|
112
|
+
expect(callingClient['mobiusHost']).toBe('https://mobius-eu-central-1.prod.infra.webex.com/api/v1');
|
|
113
|
+
expect(callingClient['mobiusClusters']).toStrictEqual(_callingClientFixtures.mockEUServiceHosts);
|
|
114
|
+
case 2:
|
|
117
115
|
case "end":
|
|
118
116
|
return _context2.stop();
|
|
119
117
|
}
|
|
@@ -132,19 +130,19 @@ describe('CallingClient Tests', function () {
|
|
|
132
130
|
* calling and empty domain value.
|
|
133
131
|
*/
|
|
134
132
|
it('Verify valid calling serviceData with no input sdk config', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
135
|
-
return _regenerator.default.wrap(function
|
|
133
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
136
134
|
while (1) switch (_context4.prev = _context4.next) {
|
|
137
135
|
case 0:
|
|
138
136
|
expect(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
139
|
-
return _regenerator.default.wrap(function
|
|
137
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
140
138
|
while (1) switch (_context3.prev = _context3.next) {
|
|
141
139
|
case 0:
|
|
142
|
-
_context3.next =
|
|
140
|
+
_context3.next = 1;
|
|
143
141
|
return (0, _CallingClient.createClient)(webex);
|
|
144
|
-
case
|
|
142
|
+
case 1:
|
|
145
143
|
callingClient = _context3.sent;
|
|
146
144
|
expect(callingClient).toBeTruthy();
|
|
147
|
-
case
|
|
145
|
+
case 2:
|
|
148
146
|
case "end":
|
|
149
147
|
return _context3.stop();
|
|
150
148
|
}
|
|
@@ -166,7 +164,7 @@ describe('CallingClient Tests', function () {
|
|
|
166
164
|
*/
|
|
167
165
|
it('Verify invalid empty service indicator, empty domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
168
166
|
var serviceDataObj;
|
|
169
|
-
return _regenerator.default.wrap(function
|
|
167
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
170
168
|
while (1) switch (_context6.prev = _context6.next) {
|
|
171
169
|
case 0:
|
|
172
170
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
@@ -175,23 +173,23 @@ describe('CallingClient Tests', function () {
|
|
|
175
173
|
domain: ''
|
|
176
174
|
};
|
|
177
175
|
expect(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
178
|
-
return _regenerator.default.wrap(function
|
|
176
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
179
177
|
while (1) switch (_context5.prev = _context5.next) {
|
|
180
178
|
case 0:
|
|
181
|
-
_context5.next =
|
|
179
|
+
_context5.next = 1;
|
|
182
180
|
return (0, _CallingClient.createClient)(webex, {
|
|
183
181
|
serviceData: serviceDataObj
|
|
184
182
|
});
|
|
185
|
-
case
|
|
183
|
+
case 1:
|
|
186
184
|
callingClient = _context5.sent;
|
|
187
185
|
expect(callingClient).toBeTruthy();
|
|
188
|
-
case
|
|
186
|
+
case 2:
|
|
189
187
|
case "end":
|
|
190
188
|
return _context5.stop();
|
|
191
189
|
}
|
|
192
190
|
}, _callee5);
|
|
193
191
|
}))).not.toThrow(Error);
|
|
194
|
-
case
|
|
192
|
+
case 1:
|
|
195
193
|
case "end":
|
|
196
194
|
return _context6.stop();
|
|
197
195
|
}
|
|
@@ -207,8 +205,8 @@ describe('CallingClient Tests', function () {
|
|
|
207
205
|
* INDICATOR value MUST MATCH with one of the values in ServiceIndicator enum.
|
|
208
206
|
*/
|
|
209
207
|
it('Verify invalid service indicator, valid domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
210
|
-
var serviceDataObj;
|
|
211
|
-
return _regenerator.default.wrap(function
|
|
208
|
+
var serviceDataObj, _t;
|
|
209
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
212
210
|
while (1) switch (_context7.prev = _context7.next) {
|
|
213
211
|
case 0:
|
|
214
212
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
@@ -217,25 +215,25 @@ describe('CallingClient Tests', function () {
|
|
|
217
215
|
domain: 'test.example.com'
|
|
218
216
|
};
|
|
219
217
|
_context7.prev = 1;
|
|
220
|
-
_context7.next =
|
|
218
|
+
_context7.next = 2;
|
|
221
219
|
return (0, _CallingClient.createClient)(webex, {
|
|
222
220
|
serviceData: serviceDataObj
|
|
223
221
|
});
|
|
224
|
-
case
|
|
222
|
+
case 2:
|
|
225
223
|
callingClient = _context7.sent;
|
|
226
|
-
_context7.next =
|
|
224
|
+
_context7.next = 4;
|
|
227
225
|
break;
|
|
228
|
-
case
|
|
229
|
-
_context7.prev =
|
|
230
|
-
|
|
231
|
-
expect(
|
|
232
|
-
case
|
|
226
|
+
case 3:
|
|
227
|
+
_context7.prev = 3;
|
|
228
|
+
_t = _context7["catch"](1);
|
|
229
|
+
expect(_t.message).toEqual('Invalid service indicator, Allowed values are: calling, contactcenter and guestcalling');
|
|
230
|
+
case 4:
|
|
233
231
|
expect.assertions(1);
|
|
234
|
-
case
|
|
232
|
+
case 5:
|
|
235
233
|
case "end":
|
|
236
234
|
return _context7.stop();
|
|
237
235
|
}
|
|
238
|
-
}, _callee7, null, [[1,
|
|
236
|
+
}, _callee7, null, [[1, 3]]);
|
|
239
237
|
})));
|
|
240
238
|
|
|
241
239
|
/**
|
|
@@ -248,8 +246,8 @@ describe('CallingClient Tests', function () {
|
|
|
248
246
|
* string then it must be of valid domain type.
|
|
249
247
|
*/
|
|
250
248
|
it('CALLING: verify invalid service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
251
|
-
var serviceDataObj;
|
|
252
|
-
return _regenerator.default.wrap(function
|
|
249
|
+
var serviceDataObj, _t2;
|
|
250
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
253
251
|
while (1) switch (_context8.prev = _context8.next) {
|
|
254
252
|
case 0:
|
|
255
253
|
serviceDataObj = {
|
|
@@ -257,25 +255,25 @@ describe('CallingClient Tests', function () {
|
|
|
257
255
|
domain: 'test'
|
|
258
256
|
};
|
|
259
257
|
_context8.prev = 1;
|
|
260
|
-
_context8.next =
|
|
258
|
+
_context8.next = 2;
|
|
261
259
|
return (0, _CallingClient.createClient)(webex, {
|
|
262
260
|
serviceData: serviceDataObj
|
|
263
261
|
});
|
|
264
|
-
case
|
|
262
|
+
case 2:
|
|
265
263
|
callingClient = _context8.sent;
|
|
266
|
-
_context8.next =
|
|
264
|
+
_context8.next = 4;
|
|
267
265
|
break;
|
|
268
|
-
case
|
|
269
|
-
_context8.prev =
|
|
270
|
-
|
|
271
|
-
expect(
|
|
272
|
-
case
|
|
266
|
+
case 3:
|
|
267
|
+
_context8.prev = 3;
|
|
268
|
+
_t2 = _context8["catch"](1);
|
|
269
|
+
expect(_t2.message).toEqual('Invalid service domain.');
|
|
270
|
+
case 4:
|
|
273
271
|
expect.assertions(1);
|
|
274
|
-
case
|
|
272
|
+
case 5:
|
|
275
273
|
case "end":
|
|
276
274
|
return _context8.stop();
|
|
277
275
|
}
|
|
278
|
-
}, _callee8, null, [[1,
|
|
276
|
+
}, _callee8, null, [[1, 3]]);
|
|
279
277
|
})));
|
|
280
278
|
|
|
281
279
|
/**
|
|
@@ -288,7 +286,7 @@ describe('CallingClient Tests', function () {
|
|
|
288
286
|
*/
|
|
289
287
|
it('CALLING: verify valid empty service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
|
|
290
288
|
var serviceDataObj;
|
|
291
|
-
return _regenerator.default.wrap(function
|
|
289
|
+
return _regenerator.default.wrap(function (_context0) {
|
|
292
290
|
while (1) switch (_context0.prev = _context0.next) {
|
|
293
291
|
case 0:
|
|
294
292
|
serviceDataObj = {
|
|
@@ -296,23 +294,23 @@ describe('CallingClient Tests', function () {
|
|
|
296
294
|
domain: ''
|
|
297
295
|
};
|
|
298
296
|
expect(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
299
|
-
return _regenerator.default.wrap(function
|
|
297
|
+
return _regenerator.default.wrap(function (_context9) {
|
|
300
298
|
while (1) switch (_context9.prev = _context9.next) {
|
|
301
299
|
case 0:
|
|
302
|
-
_context9.next =
|
|
300
|
+
_context9.next = 1;
|
|
303
301
|
return (0, _CallingClient.createClient)(webex, {
|
|
304
302
|
serviceData: serviceDataObj
|
|
305
303
|
});
|
|
306
|
-
case
|
|
304
|
+
case 1:
|
|
307
305
|
callingClient = _context9.sent;
|
|
308
306
|
expect(callingClient).toBeTruthy();
|
|
309
|
-
case
|
|
307
|
+
case 2:
|
|
310
308
|
case "end":
|
|
311
309
|
return _context9.stop();
|
|
312
310
|
}
|
|
313
311
|
}, _callee9);
|
|
314
312
|
}))).not.toThrow(Error);
|
|
315
|
-
case
|
|
313
|
+
case 1:
|
|
316
314
|
case "end":
|
|
317
315
|
return _context0.stop();
|
|
318
316
|
}
|
|
@@ -328,8 +326,8 @@ describe('CallingClient Tests', function () {
|
|
|
328
326
|
* DOMAIN field for service type 'contactcenter' must carry a non-empty valid domain type string.
|
|
329
327
|
*/
|
|
330
328
|
it('ContactCenter: verify empty invalid service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
331
|
-
var serviceDataObj;
|
|
332
|
-
return _regenerator.default.wrap(function
|
|
329
|
+
var serviceDataObj, _t3;
|
|
330
|
+
return _regenerator.default.wrap(function (_context1) {
|
|
333
331
|
while (1) switch (_context1.prev = _context1.next) {
|
|
334
332
|
case 0:
|
|
335
333
|
serviceDataObj = {
|
|
@@ -337,25 +335,25 @@ describe('CallingClient Tests', function () {
|
|
|
337
335
|
domain: ''
|
|
338
336
|
};
|
|
339
337
|
_context1.prev = 1;
|
|
340
|
-
_context1.next =
|
|
338
|
+
_context1.next = 2;
|
|
341
339
|
return (0, _CallingClient.createClient)(webex, {
|
|
342
340
|
serviceData: serviceDataObj
|
|
343
341
|
});
|
|
344
|
-
case
|
|
342
|
+
case 2:
|
|
345
343
|
callingClient = _context1.sent;
|
|
346
|
-
_context1.next =
|
|
344
|
+
_context1.next = 4;
|
|
347
345
|
break;
|
|
348
|
-
case
|
|
349
|
-
_context1.prev =
|
|
350
|
-
|
|
351
|
-
expect(
|
|
352
|
-
case
|
|
346
|
+
case 3:
|
|
347
|
+
_context1.prev = 3;
|
|
348
|
+
_t3 = _context1["catch"](1);
|
|
349
|
+
expect(_t3.message).toEqual('Invalid service domain.');
|
|
350
|
+
case 4:
|
|
353
351
|
expect.assertions(1);
|
|
354
|
-
case
|
|
352
|
+
case 5:
|
|
355
353
|
case "end":
|
|
356
354
|
return _context1.stop();
|
|
357
355
|
}
|
|
358
|
-
}, _callee1, null, [[1,
|
|
356
|
+
}, _callee1, null, [[1, 3]]);
|
|
359
357
|
})));
|
|
360
358
|
|
|
361
359
|
/**
|
|
@@ -368,7 +366,7 @@ describe('CallingClient Tests', function () {
|
|
|
368
366
|
*/
|
|
369
367
|
it('ContactCenter: verify valid service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
370
368
|
var serviceDataObj;
|
|
371
|
-
return _regenerator.default.wrap(function
|
|
369
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
372
370
|
while (1) switch (_context11.prev = _context11.next) {
|
|
373
371
|
case 0:
|
|
374
372
|
serviceDataObj = {
|
|
@@ -376,44 +374,44 @@ describe('CallingClient Tests', function () {
|
|
|
376
374
|
domain: 'test.example.com'
|
|
377
375
|
};
|
|
378
376
|
expect(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
379
|
-
return _regenerator.default.wrap(function
|
|
377
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
380
378
|
while (1) switch (_context10.prev = _context10.next) {
|
|
381
379
|
case 0:
|
|
382
|
-
_context10.next =
|
|
380
|
+
_context10.next = 1;
|
|
383
381
|
return (0, _CallingClient.createClient)(webex, {
|
|
384
382
|
serviceData: serviceDataObj
|
|
385
383
|
});
|
|
386
|
-
case
|
|
384
|
+
case 1:
|
|
387
385
|
callingClient = _context10.sent;
|
|
388
386
|
expect(callingClient).toBeTruthy();
|
|
389
|
-
case
|
|
387
|
+
case 2:
|
|
390
388
|
case "end":
|
|
391
389
|
return _context10.stop();
|
|
392
390
|
}
|
|
393
391
|
}, _callee10);
|
|
394
392
|
}))).not.toThrow(Error);
|
|
395
|
-
case
|
|
393
|
+
case 1:
|
|
396
394
|
case "end":
|
|
397
395
|
return _context11.stop();
|
|
398
396
|
}
|
|
399
397
|
}, _callee11);
|
|
400
398
|
})));
|
|
401
399
|
it('Get current log level', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
402
|
-
return _regenerator.default.wrap(function
|
|
400
|
+
return _regenerator.default.wrap(function (_context12) {
|
|
403
401
|
while (1) switch (_context12.prev = _context12.next) {
|
|
404
402
|
case 0:
|
|
405
|
-
_context12.next =
|
|
403
|
+
_context12.next = 1;
|
|
406
404
|
return (0, _CallingClient.createClient)(webex, {
|
|
407
405
|
logger: {
|
|
408
406
|
level: _types.LOGGER.INFO
|
|
409
407
|
}
|
|
410
408
|
});
|
|
411
|
-
case
|
|
409
|
+
case 1:
|
|
412
410
|
callingClient = _context12.sent;
|
|
413
411
|
expect(callingClient).toBeTruthy();
|
|
414
412
|
expect(callingClient.getLoggingLevel).toBeTruthy();
|
|
415
413
|
expect(callingClient.getLoggingLevel()).toEqual(_types.LOGGER.INFO);
|
|
416
|
-
case
|
|
414
|
+
case 2:
|
|
417
415
|
case "end":
|
|
418
416
|
return _context12.stop();
|
|
419
417
|
}
|
|
@@ -431,221 +429,84 @@ describe('CallingClient Tests', function () {
|
|
|
431
429
|
jest.useRealTimers();
|
|
432
430
|
});
|
|
433
431
|
it('verify successful mobius server url discovery', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
434
|
-
return _regenerator.default.wrap(function
|
|
432
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
435
433
|
while (1) switch (_context13.prev = _context13.next) {
|
|
436
434
|
case 0:
|
|
437
|
-
webex.request.mockResolvedValueOnce(_callingClientFixtures.
|
|
438
|
-
_context13.next =
|
|
435
|
+
webex.request.mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload);
|
|
436
|
+
_context13.next = 1;
|
|
439
437
|
return (0, _CallingClient.createClient)(webex, {
|
|
440
438
|
logger: {
|
|
441
439
|
level: _types.LOGGER.INFO
|
|
442
440
|
}
|
|
443
441
|
});
|
|
444
|
-
case
|
|
442
|
+
case 1:
|
|
445
443
|
callingClient = _context13.sent;
|
|
446
|
-
expect(webex.request).toBeCalledTimes(
|
|
444
|
+
expect(webex.request).toBeCalledTimes(2);
|
|
447
445
|
expect(callingClient.primaryMobiusUris).toEqual([_callingClientFixtures.primaryUrl]);
|
|
448
446
|
expect(handleErrorSpy).not.toBeCalled();
|
|
449
|
-
expect(webex.request).nthCalledWith(1,
|
|
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, {
|
|
447
|
+
expect(webex.request).nthCalledWith(1, {
|
|
455
448
|
method: 'GET',
|
|
456
|
-
uri: "".concat(_constants.DISCOVERY_URL
|
|
449
|
+
uri: "".concat(_constants.DISCOVERY_URL),
|
|
457
450
|
addAuthHeader: false,
|
|
458
451
|
headers: (0, _defineProperty2.default)({}, _constants.SPARK_USER_AGENT, null)
|
|
459
452
|
});
|
|
460
|
-
expect(webex.request).nthCalledWith(
|
|
453
|
+
expect(webex.request).nthCalledWith(2, _objectSpread(_objectSpread({
|
|
461
454
|
method: 'GET'
|
|
462
455
|
}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
463
456
|
uri: "".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT, "?regionCode=").concat(_callingClientFixtures.regionBody.clientRegion, "&countryCode=").concat(_callingClientFixtures.regionBody.countryCode)
|
|
464
457
|
}));
|
|
465
|
-
case
|
|
458
|
+
case 2:
|
|
466
459
|
case "end":
|
|
467
460
|
return _context13.stop();
|
|
468
461
|
}
|
|
469
462
|
}, _callee13);
|
|
470
463
|
})));
|
|
471
|
-
it('
|
|
464
|
+
it('when region discovery succeeds but region based mobius url discovery fails with final error', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
472
465
|
var failurePayload;
|
|
473
|
-
return _regenerator.default.wrap(function
|
|
466
|
+
return _regenerator.default.wrap(function (_context14) {
|
|
474
467
|
while (1) switch (_context14.prev = _context14.next) {
|
|
475
|
-
case 0:
|
|
476
|
-
failurePayload = {
|
|
477
|
-
statusCode: 500
|
|
478
|
-
};
|
|
479
|
-
webex.request.mockRejectedValue(failurePayload);
|
|
480
|
-
_context14.next = 4;
|
|
481
|
-
return (0, _CallingClient.createClient)(webex, {
|
|
482
|
-
logger: {
|
|
483
|
-
level: _types.LOGGER.INFO
|
|
484
|
-
}
|
|
485
|
-
});
|
|
486
|
-
case 4:
|
|
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
|
-
}));
|
|
504
|
-
expect(handleErrorSpy).toBeCalledWith(failurePayload, expect.anything(), {
|
|
505
|
-
file: _constants.CALLING_CLIENT_FILE,
|
|
506
|
-
method: 'getMobiusServers'
|
|
507
|
-
});
|
|
508
|
-
expect(callingClient.primaryMobiusUris).toEqual(["".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT)]);
|
|
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
|
-
}));
|
|
513
|
-
case 12:
|
|
514
|
-
case "end":
|
|
515
|
-
return _context14.stop();
|
|
516
|
-
}
|
|
517
|
-
}, _callee14);
|
|
518
|
-
})));
|
|
519
|
-
it('case when /myIP failed with 401', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
520
|
-
var failurePayload;
|
|
521
|
-
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
522
|
-
while (1) switch (_context15.prev = _context15.next) {
|
|
523
468
|
case 0:
|
|
524
469
|
failurePayload = {
|
|
525
470
|
statusCode: 401
|
|
526
471
|
};
|
|
527
|
-
webex.request.mockRejectedValueOnce(failurePayload);
|
|
528
|
-
|
|
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;
|
|
472
|
+
webex.request.mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockRejectedValueOnce(failurePayload);
|
|
473
|
+
_context14.next = 1;
|
|
565
474
|
return (0, _CallingClient.createClient)(webex, {
|
|
566
475
|
logger: {
|
|
567
476
|
level: _types.LOGGER.INFO
|
|
568
477
|
}
|
|
569
478
|
});
|
|
570
|
-
case
|
|
571
|
-
callingClient =
|
|
479
|
+
case 1:
|
|
480
|
+
callingClient = _context14.sent;
|
|
572
481
|
expect(handleErrorSpy).toBeCalledWith(failurePayload, expect.anything(), {
|
|
573
482
|
file: _constants.CALLING_CLIENT_FILE,
|
|
574
483
|
method: 'getMobiusServers'
|
|
575
484
|
});
|
|
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
485
|
expect(webex.request).toBeCalledTimes(2);
|
|
617
|
-
expect(
|
|
618
|
-
|
|
619
|
-
method: 'GET'
|
|
620
|
-
}));
|
|
621
|
-
expect(webex.request).nthCalledWith(2, {
|
|
486
|
+
expect(callingClient.primaryMobiusUris).toEqual(["".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT)]);
|
|
487
|
+
expect(webex.request).nthCalledWith(1, {
|
|
622
488
|
method: 'GET',
|
|
623
|
-
uri: "".concat(_constants.DISCOVERY_URL
|
|
489
|
+
uri: "".concat(_constants.DISCOVERY_URL),
|
|
624
490
|
addAuthHeader: false,
|
|
625
491
|
headers: (0, _defineProperty2.default)({}, _constants.SPARK_USER_AGENT, null)
|
|
626
492
|
});
|
|
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
493
|
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers", expect.objectContaining({
|
|
633
494
|
file: _constants.CALLING_CLIENT_FILE,
|
|
634
495
|
method: 'getMobiusServers'
|
|
635
496
|
}));
|
|
636
|
-
case
|
|
497
|
+
case 2:
|
|
637
498
|
case "end":
|
|
638
|
-
return
|
|
499
|
+
return _context14.stop();
|
|
639
500
|
}
|
|
640
|
-
},
|
|
501
|
+
}, _callee14);
|
|
641
502
|
})));
|
|
642
|
-
it('Verify successful mobius server url discovery after initializing callingClient through a config', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
643
|
-
return _regenerator.default.wrap(function
|
|
644
|
-
while (1) switch (
|
|
503
|
+
it('Verify successful mobius server url discovery after initializing callingClient through a config', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
504
|
+
return _regenerator.default.wrap(function (_context15) {
|
|
505
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
645
506
|
case 0:
|
|
646
507
|
infoSpy.mockReset();
|
|
647
508
|
webex.request.mockResolvedValueOnce(_callingClientFixtures.discoveryPayload);
|
|
648
|
-
|
|
509
|
+
_context15.next = 1;
|
|
649
510
|
return (0, _CallingClient.createClient)(webex, {
|
|
650
511
|
discovery: {
|
|
651
512
|
region: 'AP-SOUTHEAST',
|
|
@@ -655,8 +516,8 @@ describe('CallingClient Tests', function () {
|
|
|
655
516
|
level: _types.LOGGER.INFO
|
|
656
517
|
}
|
|
657
518
|
});
|
|
658
|
-
case
|
|
659
|
-
callingClient =
|
|
519
|
+
case 1:
|
|
520
|
+
callingClient = _context15.sent;
|
|
660
521
|
expect(callingClient.primaryMobiusUris).toEqual([_callingClientFixtures.primaryUrl]);
|
|
661
522
|
expect(infoSpy).toHaveBeenCalledWith(_constants2.METHOD_START_MESSAGE, {
|
|
662
523
|
file: 'CallingClient',
|
|
@@ -667,88 +528,90 @@ describe('CallingClient Tests', function () {
|
|
|
667
528
|
method: 'GET'
|
|
668
529
|
}));
|
|
669
530
|
expect(handleErrorSpy).not.toHaveBeenCalled();
|
|
670
|
-
case
|
|
531
|
+
case 2:
|
|
671
532
|
case "end":
|
|
672
|
-
return
|
|
533
|
+
return _context15.stop();
|
|
673
534
|
}
|
|
674
|
-
},
|
|
535
|
+
}, _callee15);
|
|
675
536
|
})));
|
|
676
537
|
});
|
|
677
538
|
describe('Testing each cluster present withing host catalog', function () {
|
|
678
539
|
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'];
|
|
679
540
|
var checkCluster = /*#__PURE__*/function () {
|
|
680
|
-
var
|
|
541
|
+
var _ref16 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16(mockServiceHosts, mockCatalog) {
|
|
681
542
|
var callingClient;
|
|
682
|
-
return _regenerator.default.wrap(function
|
|
683
|
-
while (1) switch (
|
|
543
|
+
return _regenerator.default.wrap(function (_context16) {
|
|
544
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
684
545
|
case 0:
|
|
685
546
|
webex.internal.services._hostCatalog = mockCatalog;
|
|
686
|
-
|
|
547
|
+
webex.internal.services.getMobiusClusters = jest.fn().mockReturnValue(mockServiceHosts);
|
|
548
|
+
_context16.next = 1;
|
|
687
549
|
return (0, _CallingClient.createClient)(webex, {
|
|
688
550
|
logger: {
|
|
689
551
|
level: _types.LOGGER.INFO
|
|
690
552
|
}
|
|
691
553
|
});
|
|
692
|
-
case
|
|
693
|
-
callingClient =
|
|
554
|
+
case 1:
|
|
555
|
+
callingClient = _context16.sent;
|
|
694
556
|
expect(callingClient['mobiusClusters']).toStrictEqual(mockServiceHosts);
|
|
695
|
-
case
|
|
557
|
+
case 2:
|
|
696
558
|
case "end":
|
|
697
|
-
return
|
|
559
|
+
return _context16.stop();
|
|
698
560
|
}
|
|
699
|
-
},
|
|
561
|
+
}, _callee16);
|
|
700
562
|
}));
|
|
701
563
|
return function checkCluster(_x, _x2) {
|
|
702
|
-
return
|
|
564
|
+
return _ref16.apply(this, arguments);
|
|
703
565
|
};
|
|
704
566
|
}();
|
|
705
567
|
it.each(mobiusCluster)('%s', /*#__PURE__*/function () {
|
|
706
|
-
var
|
|
707
|
-
|
|
708
|
-
|
|
568
|
+
var _ref17 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17(clusterName) {
|
|
569
|
+
var _t4;
|
|
570
|
+
return _regenerator.default.wrap(function (_context17) {
|
|
571
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
709
572
|
case 0:
|
|
710
|
-
|
|
711
|
-
|
|
573
|
+
_t4 = clusterName;
|
|
574
|
+
_context17.next = _t4 === 'mobius-eu-central-1.prod.infra.webex.com' ? 1 : _t4 === 'mobius-us-east-1.int.infra.webex.com' ? 2 : _t4 === 'mobius-eu-central-1.int.infra.webex.com' ? 3 : 4;
|
|
712
575
|
break;
|
|
713
|
-
case
|
|
576
|
+
case 1:
|
|
714
577
|
checkCluster(_callingClientFixtures.mockEUServiceHosts, _callingClientFixtures.mockCatalogEU);
|
|
715
|
-
return
|
|
716
|
-
case
|
|
578
|
+
return _context17.abrupt("continue", 5);
|
|
579
|
+
case 2:
|
|
717
580
|
checkCluster(_callingClientFixtures.mockIntServiceHosts, _callingClientFixtures.mockCatalogUSInt);
|
|
718
|
-
return
|
|
719
|
-
case
|
|
581
|
+
return _context17.abrupt("continue", 5);
|
|
582
|
+
case 3:
|
|
720
583
|
checkCluster(_callingClientFixtures.mockEUIntServiceHosts, _callingClientFixtures.mockCatalogEUInt);
|
|
721
|
-
return
|
|
722
|
-
case
|
|
723
|
-
return
|
|
724
|
-
case
|
|
584
|
+
return _context17.abrupt("continue", 5);
|
|
585
|
+
case 4:
|
|
586
|
+
return _context17.abrupt("continue", 5);
|
|
587
|
+
case 5:
|
|
725
588
|
case "end":
|
|
726
|
-
return
|
|
589
|
+
return _context17.stop();
|
|
727
590
|
}
|
|
728
|
-
},
|
|
591
|
+
}, _callee17);
|
|
729
592
|
}));
|
|
730
593
|
return function (_x3) {
|
|
731
|
-
return
|
|
594
|
+
return _ref17.apply(this, arguments);
|
|
732
595
|
};
|
|
733
596
|
}());
|
|
734
597
|
});
|
|
735
598
|
describe('Line creation tests', function () {
|
|
736
599
|
var callingClient;
|
|
737
600
|
var line;
|
|
738
|
-
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
739
|
-
return _regenerator.default.wrap(function
|
|
740
|
-
while (1) switch (
|
|
601
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
602
|
+
return _regenerator.default.wrap(function (_context18) {
|
|
603
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
741
604
|
case 0:
|
|
742
|
-
|
|
605
|
+
_context18.next = 1;
|
|
743
606
|
return (0, _CallingClient.createClient)(webex);
|
|
744
|
-
case
|
|
745
|
-
callingClient =
|
|
607
|
+
case 1:
|
|
608
|
+
callingClient = _context18.sent;
|
|
746
609
|
line = (0, _values.default)(callingClient.lineDict)[0];
|
|
747
|
-
case
|
|
610
|
+
case 2:
|
|
748
611
|
case "end":
|
|
749
|
-
return
|
|
612
|
+
return _context18.stop();
|
|
750
613
|
}
|
|
751
|
-
},
|
|
614
|
+
}, _callee18);
|
|
752
615
|
})));
|
|
753
616
|
afterEach(function () {
|
|
754
617
|
jest.clearAllTimers();
|
|
@@ -778,36 +641,36 @@ describe('CallingClient Tests', function () {
|
|
|
778
641
|
var restartRegisterSpy;
|
|
779
642
|
var registerSpy;
|
|
780
643
|
var metricSpy;
|
|
781
|
-
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
782
|
-
return _regenerator.default.wrap(function
|
|
783
|
-
while (1) switch (
|
|
644
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
645
|
+
return _regenerator.default.wrap(function (_context19) {
|
|
646
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
784
647
|
case 0:
|
|
785
648
|
jest.useFakeTimers();
|
|
786
|
-
webex.request.mockResolvedValueOnce(_callingClientFixtures.
|
|
649
|
+
webex.request.mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload).mockResolvedValueOnce(_callingClientFixtures.registrationPayload);
|
|
787
650
|
windowEventSpy = jest.spyOn(window, 'addEventListener');
|
|
788
|
-
|
|
651
|
+
_context19.next = 1;
|
|
789
652
|
return (0, _CallingClient.createClient)(webex, {
|
|
790
653
|
logger: {
|
|
791
654
|
level: _types.LOGGER.INFO
|
|
792
655
|
}
|
|
793
656
|
});
|
|
794
|
-
case
|
|
795
|
-
callingClient =
|
|
657
|
+
case 1:
|
|
658
|
+
callingClient = _context19.sent;
|
|
796
659
|
line = (0, _values.default)(callingClient.lineDict)[0];
|
|
797
660
|
reg = line.registration;
|
|
798
|
-
|
|
661
|
+
_context19.next = 2;
|
|
799
662
|
return line.register();
|
|
800
|
-
case
|
|
663
|
+
case 2:
|
|
801
664
|
deRegSpy = jest.spyOn(reg, 'deregister');
|
|
802
665
|
restoreSpy = jest.spyOn(reg, 'restorePreviousRegistration');
|
|
803
666
|
restartRegisterSpy = jest.spyOn(reg, 'restartRegistration');
|
|
804
667
|
registerSpy = jest.spyOn(reg, 'attemptRegistrationWithServers');
|
|
805
668
|
metricSpy = jest.spyOn(callingClient['metricManager'], 'submitConnectionMetrics');
|
|
806
|
-
case
|
|
669
|
+
case 3:
|
|
807
670
|
case "end":
|
|
808
|
-
return
|
|
671
|
+
return _context19.stop();
|
|
809
672
|
}
|
|
810
|
-
},
|
|
673
|
+
}, _callee19);
|
|
811
674
|
})));
|
|
812
675
|
afterEach(function () {
|
|
813
676
|
jest.clearAllTimers();
|
|
@@ -818,110 +681,110 @@ describe('CallingClient Tests', function () {
|
|
|
818
681
|
callingClient = undefined;
|
|
819
682
|
jest.useRealTimers();
|
|
820
683
|
});
|
|
821
|
-
it('window offline handler sets networkDown and clears keepalive when network is unreachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
684
|
+
it('window offline handler sets networkDown and clears keepalive when network is unreachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
822
685
|
var g, clearKeepaliveSpy, offlineCb;
|
|
823
|
-
return _regenerator.default.wrap(function
|
|
824
|
-
while (1) switch (
|
|
686
|
+
return _regenerator.default.wrap(function (_context20) {
|
|
687
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
825
688
|
case 0:
|
|
826
689
|
g = global;
|
|
827
690
|
g.fetch = jest.fn().mockRejectedValueOnce(new Error('network fail'));
|
|
828
691
|
clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
829
692
|
offlineCb = windowEventSpy.mock.calls[1][1];
|
|
830
|
-
|
|
693
|
+
_context20.next = 1;
|
|
831
694
|
return offlineCb();
|
|
832
|
-
case
|
|
695
|
+
case 1:
|
|
833
696
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Network connectivity probe failed'), {
|
|
834
697
|
file: _constants.CALLING_CLIENT_FILE,
|
|
835
698
|
method: 'pingExternal'
|
|
836
699
|
});
|
|
837
700
|
expect(callingClient['isNetworkDown']).toBe(true);
|
|
838
701
|
expect(clearKeepaliveSpy).toHaveBeenCalled();
|
|
839
|
-
case
|
|
702
|
+
case 2:
|
|
840
703
|
case "end":
|
|
841
|
-
return
|
|
704
|
+
return _context20.stop();
|
|
842
705
|
}
|
|
843
|
-
},
|
|
706
|
+
}, _callee20);
|
|
844
707
|
})));
|
|
845
|
-
it('window offline handler does not clear keepalive when network is reachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
708
|
+
it('window offline handler does not clear keepalive when network is reachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
846
709
|
var g, clearKeepaliveSpy, offlineCb;
|
|
847
|
-
return _regenerator.default.wrap(function
|
|
848
|
-
while (1) switch (
|
|
710
|
+
return _regenerator.default.wrap(function (_context21) {
|
|
711
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
849
712
|
case 0:
|
|
850
713
|
g = global;
|
|
851
714
|
g.fetch = jest.fn().mockResolvedValueOnce({});
|
|
852
715
|
clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
853
716
|
offlineCb = windowEventSpy.mock.calls[1][1];
|
|
854
|
-
|
|
717
|
+
_context21.next = 1;
|
|
855
718
|
return offlineCb();
|
|
856
|
-
case
|
|
719
|
+
case 1:
|
|
857
720
|
expect(g.fetch).toHaveBeenCalledWith('https://www.google.com/generate_204', expect.any(Object));
|
|
858
721
|
expect(callingClient['isNetworkDown']).toBe(false);
|
|
859
722
|
expect(clearKeepaliveSpy).not.toHaveBeenCalled();
|
|
860
|
-
case
|
|
723
|
+
case 2:
|
|
861
724
|
case "end":
|
|
862
|
-
return
|
|
725
|
+
return _context21.stop();
|
|
863
726
|
}
|
|
864
|
-
},
|
|
727
|
+
}, _callee21);
|
|
865
728
|
})));
|
|
866
|
-
it('window online handler sets networkUpTimestamp and logs', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
729
|
+
it('window online handler sets networkUpTimestamp and logs', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
867
730
|
var onlineCb;
|
|
868
|
-
return _regenerator.default.wrap(function
|
|
869
|
-
while (1) switch (
|
|
731
|
+
return _regenerator.default.wrap(function (_context22) {
|
|
732
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
870
733
|
case 0:
|
|
871
734
|
onlineCb = windowEventSpy.mock.calls[0][1];
|
|
872
|
-
|
|
735
|
+
_context22.next = 1;
|
|
873
736
|
return onlineCb();
|
|
874
|
-
case
|
|
737
|
+
case 1:
|
|
875
738
|
expect(callingClient['networkUpTimestamp']).toEqual(expect.any(String));
|
|
876
739
|
expect(infoSpy).toHaveBeenCalledWith(_constants2.METHOD_START_MESSAGE, {
|
|
877
740
|
file: _constants.CALLING_CLIENT_FILE,
|
|
878
741
|
method: 'handleNetworkOnline'
|
|
879
742
|
});
|
|
880
|
-
case
|
|
743
|
+
case 2:
|
|
881
744
|
case "end":
|
|
882
|
-
return
|
|
745
|
+
return _context22.stop();
|
|
883
746
|
}
|
|
884
|
-
},
|
|
747
|
+
}, _callee22);
|
|
885
748
|
})));
|
|
886
|
-
it('mercury offline submits metrics and sets timestamp', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
749
|
+
it('mercury offline submits metrics and sets timestamp', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
887
750
|
var mercuryOfflineCb;
|
|
888
|
-
return _regenerator.default.wrap(function
|
|
889
|
-
while (1) switch (
|
|
751
|
+
return _regenerator.default.wrap(function (_context23) {
|
|
752
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
890
753
|
case 0:
|
|
891
754
|
mercuryOfflineCb = webex.internal.mercury.on.mock.calls[1][1];
|
|
892
|
-
|
|
755
|
+
_context23.next = 1;
|
|
893
756
|
return mercuryOfflineCb();
|
|
894
|
-
case
|
|
757
|
+
case 1:
|
|
895
758
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Mercury down, waiting for connection to be up'), {
|
|
896
759
|
file: _constants.CALLING_CLIENT_FILE,
|
|
897
760
|
method: 'handleMercuryOffline'
|
|
898
761
|
});
|
|
899
762
|
expect(callingClient['mercuryDownTimestamp']).toEqual(expect.any(String));
|
|
900
763
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.MERCURY_DOWN, _types4.METRIC_TYPE.BEHAVIORAL, expect.any(String), '');
|
|
901
|
-
case
|
|
764
|
+
case 2:
|
|
902
765
|
case "end":
|
|
903
|
-
return
|
|
766
|
+
return _context23.stop();
|
|
904
767
|
}
|
|
905
|
-
},
|
|
768
|
+
}, _callee23);
|
|
906
769
|
})));
|
|
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
|
|
770
|
+
it('handles reconnection with no active calls after network flap, once mercury comes back up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
908
771
|
var handleConnectionRestoreSpy, mercuryOnlineCb;
|
|
909
|
-
return _regenerator.default.wrap(function
|
|
910
|
-
while (1) switch (
|
|
772
|
+
return _regenerator.default.wrap(function (_context24) {
|
|
773
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
911
774
|
case 0:
|
|
912
775
|
handleConnectionRestoreSpy = jest.spyOn(reg, 'handleConnectionRestoration');
|
|
913
776
|
callingClient['isNetworkDown'] = true;
|
|
914
777
|
callingClient['networkDownTimestamp'] = '2023-01-01T00:00:00.000Z';
|
|
915
778
|
callingClient['networkUpTimestamp'] = '2023-01-01T00:01:00.000Z';
|
|
916
779
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
917
|
-
|
|
780
|
+
_context24.next = 1;
|
|
918
781
|
return mercuryOnlineCb();
|
|
919
|
-
case
|
|
782
|
+
case 1:
|
|
920
783
|
// Run the interval once
|
|
921
784
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 100);
|
|
922
|
-
|
|
785
|
+
_context24.next = 2;
|
|
923
786
|
return flushPromises();
|
|
924
|
-
case
|
|
787
|
+
case 2:
|
|
925
788
|
expect(handleConnectionRestoreSpy).toHaveBeenCalledWith(true);
|
|
926
789
|
expect(logSpy).toHaveBeenCalledWith('Network is up again, re-registering with Webex Calling if needed', {
|
|
927
790
|
file: _constants.REGISTRATION_FILE,
|
|
@@ -933,16 +796,16 @@ describe('CallingClient Tests', function () {
|
|
|
933
796
|
expect(registerSpy).toHaveBeenCalledWith('handleConnectionRestoration', [reg.getActiveMobiusUrl()]);
|
|
934
797
|
expect(registerSpy).toHaveBeenCalledWith('handleConnectionRestoration', [_callingClientFixtures.primaryUrl]);
|
|
935
798
|
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
|
|
799
|
+
case 3:
|
|
937
800
|
case "end":
|
|
938
|
-
return
|
|
801
|
+
return _context24.stop();
|
|
939
802
|
}
|
|
940
|
-
},
|
|
803
|
+
}, _callee24);
|
|
941
804
|
})));
|
|
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
|
|
805
|
+
it('no reconnection for idle registration with no active calls after network flap, once mercury comes back up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
943
806
|
var handleConnectionRestoreSpy, mercuryOnlineCb;
|
|
944
|
-
return _regenerator.default.wrap(function
|
|
945
|
-
while (1) switch (
|
|
807
|
+
return _regenerator.default.wrap(function (_context25) {
|
|
808
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
946
809
|
case 0:
|
|
947
810
|
handleConnectionRestoreSpy = jest.spyOn(reg, 'handleConnectionRestoration');
|
|
948
811
|
callingClient['isNetworkDown'] = true;
|
|
@@ -950,14 +813,14 @@ describe('CallingClient Tests', function () {
|
|
|
950
813
|
callingClient['networkUpTimestamp'] = '2023-01-01T00:01:00.000Z';
|
|
951
814
|
reg.setStatus(_types2.RegistrationStatus.IDLE);
|
|
952
815
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
953
|
-
|
|
816
|
+
_context25.next = 1;
|
|
954
817
|
return mercuryOnlineCb();
|
|
955
|
-
case
|
|
818
|
+
case 1:
|
|
956
819
|
// Run the interval once
|
|
957
820
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 100);
|
|
958
|
-
|
|
821
|
+
_context25.next = 2;
|
|
959
822
|
return flushPromises();
|
|
960
|
-
case
|
|
823
|
+
case 2:
|
|
961
824
|
expect(handleConnectionRestoreSpy).not.toHaveBeenCalledWith(true);
|
|
962
825
|
expect(logSpy).not.toHaveBeenCalledWith('Network is up again, re-registering with Webex Calling if needed', {
|
|
963
826
|
file: _constants.REGISTRATION_FILE,
|
|
@@ -969,16 +832,16 @@ describe('CallingClient Tests', function () {
|
|
|
969
832
|
expect(registerSpy).not.toHaveBeenCalledWith('handleConnectionRestoration', [reg.getActiveMobiusUrl()]);
|
|
970
833
|
expect(registerSpy).not.toHaveBeenCalledWith('handleConnectionRestoration', [_callingClientFixtures.primaryUrl]);
|
|
971
834
|
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
|
|
835
|
+
case 3:
|
|
973
836
|
case "end":
|
|
974
|
-
return
|
|
837
|
+
return _context25.stop();
|
|
975
838
|
}
|
|
976
|
-
},
|
|
839
|
+
}, _callee25);
|
|
977
840
|
})));
|
|
978
|
-
it('handle calls status check once mercury comes back up after a network flap', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
841
|
+
it('handle calls status check once mercury comes back up after a network flap', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
979
842
|
var call, callKeepaliveSpy, deleteSpy, mercuryOnlineCb;
|
|
980
|
-
return _regenerator.default.wrap(function
|
|
981
|
-
while (1) switch (
|
|
843
|
+
return _regenerator.default.wrap(function (_context26) {
|
|
844
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
982
845
|
case 0:
|
|
983
846
|
callingClient['isNetworkDown'] = true;
|
|
984
847
|
call = callingClient['callManager'].createCall();
|
|
@@ -986,13 +849,13 @@ describe('CallingClient Tests', function () {
|
|
|
986
849
|
deleteSpy = jest.spyOn(call, 'delete');
|
|
987
850
|
expect((0, _keys.default)(callingClient['callManager'].getActiveCalls()).length).toBe(1);
|
|
988
851
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
989
|
-
|
|
852
|
+
_context26.next = 1;
|
|
990
853
|
return mercuryOnlineCb();
|
|
991
|
-
case
|
|
854
|
+
case 1:
|
|
992
855
|
expect(callKeepaliveSpy).toHaveBeenCalled();
|
|
993
|
-
|
|
856
|
+
_context26.next = 2;
|
|
994
857
|
return flushPromises();
|
|
995
|
-
case
|
|
858
|
+
case 2:
|
|
996
859
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Call Keepalive failed'), {
|
|
997
860
|
file: _constants.CALLING_CLIENT_FILE,
|
|
998
861
|
method: 'checkCallStatus'
|
|
@@ -1001,29 +864,29 @@ describe('CallingClient Tests', function () {
|
|
|
1001
864
|
expect(deleteSpy).toHaveBeenCalled();
|
|
1002
865
|
expect((0, _keys.default)(reg.callManager.getActiveCalls()).length).toBe(0);
|
|
1003
866
|
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
|
|
867
|
+
case 3:
|
|
1005
868
|
case "end":
|
|
1006
|
-
return
|
|
869
|
+
return _context26.stop();
|
|
1007
870
|
}
|
|
1008
|
-
},
|
|
871
|
+
}, _callee26);
|
|
1009
872
|
})));
|
|
1010
|
-
it('handle calls status check once mercury comes back up with stable network', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
873
|
+
it('handle calls status check once mercury comes back up with stable network', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
|
|
1011
874
|
var call, callKeepaliveSpy, deleteSpy, mercuryOnlineCb;
|
|
1012
|
-
return _regenerator.default.wrap(function
|
|
1013
|
-
while (1) switch (
|
|
875
|
+
return _regenerator.default.wrap(function (_context27) {
|
|
876
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1014
877
|
case 0:
|
|
1015
878
|
call = callingClient['callManager'].createCall();
|
|
1016
879
|
callKeepaliveSpy = jest.spyOn(call, 'postStatus').mockRejectedValueOnce(new Error('keepalive fail'));
|
|
1017
880
|
deleteSpy = jest.spyOn(call, 'delete');
|
|
1018
881
|
expect((0, _keys.default)(callingClient['callManager'].getActiveCalls()).length).toBe(1);
|
|
1019
882
|
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
1020
|
-
|
|
883
|
+
_context27.next = 1;
|
|
1021
884
|
return mercuryOnlineCb();
|
|
1022
|
-
case
|
|
885
|
+
case 1:
|
|
1023
886
|
expect(callKeepaliveSpy).toHaveBeenCalled();
|
|
1024
|
-
|
|
887
|
+
_context27.next = 2;
|
|
1025
888
|
return flushPromises();
|
|
1026
|
-
case
|
|
889
|
+
case 2:
|
|
1027
890
|
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Call Keepalive failed'), {
|
|
1028
891
|
file: _constants.CALLING_CLIENT_FILE,
|
|
1029
892
|
method: 'checkCallStatus'
|
|
@@ -1032,11 +895,11 @@ describe('CallingClient Tests', function () {
|
|
|
1032
895
|
expect(deleteSpy).toHaveBeenCalled();
|
|
1033
896
|
expect((0, _keys.default)(reg.callManager.getActiveCalls()).length).toBe(0);
|
|
1034
897
|
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
|
|
898
|
+
case 3:
|
|
1036
899
|
case "end":
|
|
1037
|
-
return
|
|
900
|
+
return _context27.stop();
|
|
1038
901
|
}
|
|
1039
|
-
},
|
|
902
|
+
}, _callee27);
|
|
1040
903
|
})));
|
|
1041
904
|
});
|
|
1042
905
|
|
|
@@ -1054,25 +917,25 @@ describe('CallingClient Tests', function () {
|
|
|
1054
917
|
});
|
|
1055
918
|
var callingClient;
|
|
1056
919
|
var line;
|
|
1057
|
-
beforeAll(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
920
|
+
beforeAll(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
|
|
1058
921
|
var calls;
|
|
1059
|
-
return _regenerator.default.wrap(function
|
|
1060
|
-
while (1) switch (
|
|
922
|
+
return _regenerator.default.wrap(function (_context28) {
|
|
923
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1061
924
|
case 0:
|
|
1062
|
-
|
|
925
|
+
_context28.next = 1;
|
|
1063
926
|
return (0, _CallingClient.createClient)(webex);
|
|
1064
|
-
case
|
|
1065
|
-
callingClient =
|
|
927
|
+
case 1:
|
|
928
|
+
callingClient = _context28.sent;
|
|
1066
929
|
line = new _line.default(userId, clientDeviceUri, mutex, primaryMobiusUris(), backupMobiusUris(), _types.LOGGER.INFO);
|
|
1067
930
|
calls = (0, _values.default)(callManager.getActiveCalls());
|
|
1068
931
|
calls.forEach(function (call) {
|
|
1069
932
|
call.end();
|
|
1070
933
|
});
|
|
1071
|
-
case
|
|
934
|
+
case 2:
|
|
1072
935
|
case "end":
|
|
1073
|
-
return
|
|
936
|
+
return _context28.stop();
|
|
1074
937
|
}
|
|
1075
|
-
},
|
|
938
|
+
}, _callee28);
|
|
1076
939
|
})));
|
|
1077
940
|
afterAll(function () {
|
|
1078
941
|
callingClient.removeAllListeners();
|
|
@@ -1155,23 +1018,23 @@ describe('CallingClient Tests', function () {
|
|
|
1155
1018
|
describe('Call Session Event test', function () {
|
|
1156
1019
|
var mockOn = webex.internal.mercury.on;
|
|
1157
1020
|
var callingClient;
|
|
1158
|
-
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1159
|
-
return _regenerator.default.wrap(function
|
|
1160
|
-
while (1) switch (
|
|
1021
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
|
|
1022
|
+
return _regenerator.default.wrap(function (_context29) {
|
|
1023
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1161
1024
|
case 0:
|
|
1162
|
-
|
|
1025
|
+
_context29.next = 1;
|
|
1163
1026
|
return (0, _CallingClient.createClient)(webex, {
|
|
1164
1027
|
logger: {
|
|
1165
1028
|
level: _types.LOGGER.INFO
|
|
1166
1029
|
}
|
|
1167
1030
|
});
|
|
1031
|
+
case 1:
|
|
1032
|
+
callingClient = _context29.sent;
|
|
1168
1033
|
case 2:
|
|
1169
|
-
callingClient = _context32.sent;
|
|
1170
|
-
case 3:
|
|
1171
1034
|
case "end":
|
|
1172
|
-
return
|
|
1035
|
+
return _context29.stop();
|
|
1173
1036
|
}
|
|
1174
|
-
},
|
|
1037
|
+
}, _callee29);
|
|
1175
1038
|
})));
|
|
1176
1039
|
afterEach(function () {
|
|
1177
1040
|
callingClient.removeAllListeners();
|
|
@@ -1201,19 +1064,19 @@ describe('CallingClient Tests', function () {
|
|
|
1201
1064
|
describe('windowsChromiumIceWarmup', function () {
|
|
1202
1065
|
var origRTCPeerConnection;
|
|
1203
1066
|
beforeAll(function () {
|
|
1204
|
-
var
|
|
1067
|
+
var _Class;
|
|
1205
1068
|
origRTCPeerConnection = global.RTCPeerConnection;
|
|
1206
1069
|
// Minimal mock for RTCPeerConnection
|
|
1207
|
-
global.RTCPeerConnection = (
|
|
1208
|
-
function
|
|
1209
|
-
(0, _classCallCheck2.default)(this,
|
|
1070
|
+
global.RTCPeerConnection = (_Class = /*#__PURE__*/function () {
|
|
1071
|
+
function _Class() {
|
|
1072
|
+
(0, _classCallCheck2.default)(this, _Class);
|
|
1210
1073
|
(0, _defineProperty2.default)(this, "iceGatheringState", 'complete');
|
|
1211
1074
|
(0, _defineProperty2.default)(this, "localDescription", null);
|
|
1212
1075
|
(0, _defineProperty2.default)(this, "remoteDescription", null);
|
|
1213
1076
|
(0, _defineProperty2.default)(this, "onicecandidate", null);
|
|
1214
1077
|
this.constructor.instances.push(this);
|
|
1215
1078
|
}
|
|
1216
|
-
(0, _createClass2.default)(
|
|
1079
|
+
return (0, _createClass2.default)(_Class, [{
|
|
1217
1080
|
key: "createDataChannel",
|
|
1218
1081
|
value: function createDataChannel() {
|
|
1219
1082
|
return {};
|
|
@@ -1266,23 +1129,22 @@ describe('CallingClient Tests', function () {
|
|
|
1266
1129
|
key: "removeEventListener",
|
|
1267
1130
|
value: function removeEventListener() {}
|
|
1268
1131
|
}]);
|
|
1269
|
-
|
|
1270
|
-
}(), (0, _defineProperty2.default)(_class, "instances", []), _class);
|
|
1132
|
+
}(), (0, _defineProperty2.default)(_Class, "instances", []), _Class);
|
|
1271
1133
|
});
|
|
1272
1134
|
afterAll(function () {
|
|
1273
1135
|
global.RTCPeerConnection = origRTCPeerConnection;
|
|
1274
1136
|
});
|
|
1275
|
-
it('should complete without throwing', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1276
|
-
return _regenerator.default.wrap(function
|
|
1277
|
-
while (1) switch (
|
|
1137
|
+
it('should complete without throwing', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
|
|
1138
|
+
return _regenerator.default.wrap(function (_context30) {
|
|
1139
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
1278
1140
|
case 0:
|
|
1279
|
-
|
|
1141
|
+
_context30.next = 1;
|
|
1280
1142
|
return expect((0, _windowsChromiumIceWarmupUtils.default)({})).resolves.not.toThrow();
|
|
1281
|
-
case
|
|
1143
|
+
case 1:
|
|
1282
1144
|
case "end":
|
|
1283
|
-
return
|
|
1145
|
+
return _context30.stop();
|
|
1284
1146
|
}
|
|
1285
|
-
},
|
|
1147
|
+
}, _callee30);
|
|
1286
1148
|
})));
|
|
1287
1149
|
});
|
|
1288
1150
|
});
|