@webex/calling 3.8.1-web-workers-keepalive.2 → 3.9.0-multi-llms.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CallHistory/CallHistory.js +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 +68 -61
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +168 -102
- 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 +491 -200
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +501 -294
- 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 +10 -8
- 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 +321 -232
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +242 -160
- 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 +5 -4
- package/dist/CallingClient/registration/webWorker.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.test.js +14 -14
- package/dist/CallingClient/registration/webWorker.test.js.map +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 +166 -84
- package/dist/Metrics/index.js.map +1 -1
- package/dist/Metrics/index.test.js +60 -0
- 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 +97 -72
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +283 -143
- 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 +8 -1
- package/dist/module/CallingClient/CallingClient.js +197 -40
- package/dist/module/CallingClient/calling/call.js +79 -43
- package/dist/module/CallingClient/constants.js +9 -6
- package/dist/module/CallingClient/line/index.js +3 -3
- package/dist/module/CallingClient/registration/register.js +50 -14
- package/dist/module/CallingClient/registration/webWorker.js +2 -1
- 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 +86 -32
- 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 +35 -11
- 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/CallSettings/types.d.ts +1 -1
- package/dist/types/CallSettings/types.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 +9 -6
- 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/types.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/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 -9
|
@@ -10,11 +10,13 @@ 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"));
|
|
15
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
16
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
13
17
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
14
18
|
var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
|
|
15
19
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
|
|
16
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
17
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
18
20
|
var _asyncMutex = require("async-mutex");
|
|
19
21
|
var Media = _interopRequireWildcard(require("@webex/internal-media-core"));
|
|
20
22
|
var _types = require("../Logger/types");
|
|
@@ -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 = {
|
|
@@ -41,15 +44,6 @@ global.crypto = {
|
|
|
41
44
|
return '12345678-1234-5678-1234-567812345678';
|
|
42
45
|
}
|
|
43
46
|
};
|
|
44
|
-
jest.mock('../common/Utils', function () {
|
|
45
|
-
var originalModule = jest.requireActual('../common/Utils');
|
|
46
|
-
return _objectSpread(_objectSpread({}, originalModule), {}, {
|
|
47
|
-
uploadLogs: jest.fn().mockImplementation(function () {
|
|
48
|
-
return _promise.default.resolve(undefined);
|
|
49
|
-
}),
|
|
50
|
-
handleCallingClientErrors: jest.fn()
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
47
|
jest.spyOn(utils, 'uploadLogs').mockResolvedValue(undefined);
|
|
54
48
|
describe('CallingClient Tests', function () {
|
|
55
49
|
// Common initializers
|
|
@@ -60,7 +54,8 @@ describe('CallingClient Tests', function () {
|
|
|
60
54
|
webex.internal.services['_hostCatalog'] = _callingClientFixtures.mockCatalogUS;
|
|
61
55
|
var defaultServiceIndicator = _types2.ServiceIndicator.CALLING;
|
|
62
56
|
var callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
|
|
63
|
-
var
|
|
57
|
+
var infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
58
|
+
var logSpy = jest.spyOn(_Logger.default, 'log');
|
|
64
59
|
var warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
65
60
|
var originalProcessNextTick = process.nextTick;
|
|
66
61
|
function flushPromises() {
|
|
@@ -74,7 +69,7 @@ describe('CallingClient Tests', function () {
|
|
|
74
69
|
webex.internal.services['_serviceUrls']['mobius'] = 'https://mobius.aintgen-a-1.int.infra.webex.com/api/v1';
|
|
75
70
|
webex.internal.services['_hostCatalog'] = _callingClientFixtures.mockCatalogUS;
|
|
76
71
|
});
|
|
77
|
-
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() {
|
|
78
73
|
var urlSpy, callingClient;
|
|
79
74
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
80
75
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -101,7 +96,7 @@ describe('CallingClient Tests', function () {
|
|
|
101
96
|
}
|
|
102
97
|
}, _callee);
|
|
103
98
|
})));
|
|
104
|
-
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() {
|
|
105
100
|
var callingClient;
|
|
106
101
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
107
102
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -136,11 +131,11 @@ describe('CallingClient Tests', function () {
|
|
|
136
131
|
* No input sdk config to callingClient, it should default to service type
|
|
137
132
|
* calling and empty domain value.
|
|
138
133
|
*/
|
|
139
|
-
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() {
|
|
140
135
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
141
136
|
while (1) switch (_context4.prev = _context4.next) {
|
|
142
137
|
case 0:
|
|
143
|
-
expect(
|
|
138
|
+
expect(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
144
139
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
145
140
|
while (1) switch (_context3.prev = _context3.next) {
|
|
146
141
|
case 0:
|
|
@@ -169,7 +164,7 @@ describe('CallingClient Tests', function () {
|
|
|
169
164
|
* It should default to service type calling and empty domain value.
|
|
170
165
|
*
|
|
171
166
|
*/
|
|
172
|
-
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() {
|
|
173
168
|
var serviceDataObj;
|
|
174
169
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
175
170
|
while (1) switch (_context6.prev = _context6.next) {
|
|
@@ -179,7 +174,7 @@ describe('CallingClient Tests', function () {
|
|
|
179
174
|
indicator: '',
|
|
180
175
|
domain: ''
|
|
181
176
|
};
|
|
182
|
-
expect(
|
|
177
|
+
expect(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
183
178
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
184
179
|
while (1) switch (_context5.prev = _context5.next) {
|
|
185
180
|
case 0:
|
|
@@ -211,7 +206,7 @@ describe('CallingClient Tests', function () {
|
|
|
211
206
|
*
|
|
212
207
|
* INDICATOR value MUST MATCH with one of the values in ServiceIndicator enum.
|
|
213
208
|
*/
|
|
214
|
-
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() {
|
|
215
210
|
var serviceDataObj;
|
|
216
211
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
217
212
|
while (1) switch (_context7.prev = _context7.next) {
|
|
@@ -252,7 +247,7 @@ describe('CallingClient Tests', function () {
|
|
|
252
247
|
* DOMAIN field for service type calling is allowed to be empty but if it carries a non-empty
|
|
253
248
|
* string then it must be of valid domain type.
|
|
254
249
|
*/
|
|
255
|
-
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() {
|
|
256
251
|
var serviceDataObj;
|
|
257
252
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
258
253
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -291,16 +286,16 @@ describe('CallingClient Tests', function () {
|
|
|
291
286
|
*
|
|
292
287
|
* DOMAIN field for service type 'calling' is allowed to be empty.
|
|
293
288
|
*/
|
|
294
|
-
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() {
|
|
295
290
|
var serviceDataObj;
|
|
296
|
-
return _regenerator.default.wrap(function
|
|
297
|
-
while (1) switch (
|
|
291
|
+
return _regenerator.default.wrap(function _callee0$(_context0) {
|
|
292
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
298
293
|
case 0:
|
|
299
294
|
serviceDataObj = {
|
|
300
295
|
indicator: _types2.ServiceIndicator.CALLING,
|
|
301
296
|
domain: ''
|
|
302
297
|
};
|
|
303
|
-
expect(
|
|
298
|
+
expect(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
304
299
|
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
305
300
|
while (1) switch (_context9.prev = _context9.next) {
|
|
306
301
|
case 0:
|
|
@@ -319,9 +314,9 @@ describe('CallingClient Tests', function () {
|
|
|
319
314
|
}))).not.toThrow(Error);
|
|
320
315
|
case 2:
|
|
321
316
|
case "end":
|
|
322
|
-
return
|
|
317
|
+
return _context0.stop();
|
|
323
318
|
}
|
|
324
|
-
},
|
|
319
|
+
}, _callee0);
|
|
325
320
|
})));
|
|
326
321
|
|
|
327
322
|
/**
|
|
@@ -332,35 +327,35 @@ describe('CallingClient Tests', function () {
|
|
|
332
327
|
*
|
|
333
328
|
* DOMAIN field for service type 'contactcenter' must carry a non-empty valid domain type string.
|
|
334
329
|
*/
|
|
335
|
-
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() {
|
|
336
331
|
var serviceDataObj;
|
|
337
|
-
return _regenerator.default.wrap(function
|
|
338
|
-
while (1) switch (
|
|
332
|
+
return _regenerator.default.wrap(function _callee1$(_context1) {
|
|
333
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
339
334
|
case 0:
|
|
340
335
|
serviceDataObj = {
|
|
341
336
|
indicator: _types2.ServiceIndicator.CONTACT_CENTER,
|
|
342
337
|
domain: ''
|
|
343
338
|
};
|
|
344
|
-
|
|
345
|
-
|
|
339
|
+
_context1.prev = 1;
|
|
340
|
+
_context1.next = 4;
|
|
346
341
|
return (0, _CallingClient.createClient)(webex, {
|
|
347
342
|
serviceData: serviceDataObj
|
|
348
343
|
});
|
|
349
344
|
case 4:
|
|
350
|
-
callingClient =
|
|
351
|
-
|
|
345
|
+
callingClient = _context1.sent;
|
|
346
|
+
_context1.next = 10;
|
|
352
347
|
break;
|
|
353
348
|
case 7:
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
expect(
|
|
349
|
+
_context1.prev = 7;
|
|
350
|
+
_context1.t0 = _context1["catch"](1);
|
|
351
|
+
expect(_context1.t0.message).toEqual('Invalid service domain.');
|
|
357
352
|
case 10:
|
|
358
353
|
expect.assertions(1);
|
|
359
354
|
case 11:
|
|
360
355
|
case "end":
|
|
361
|
-
return
|
|
356
|
+
return _context1.stop();
|
|
362
357
|
}
|
|
363
|
-
},
|
|
358
|
+
}, _callee1, null, [[1, 7]]);
|
|
364
359
|
})));
|
|
365
360
|
|
|
366
361
|
/**
|
|
@@ -371,58 +366,58 @@ describe('CallingClient Tests', function () {
|
|
|
371
366
|
*
|
|
372
367
|
* DOMAIN field for service type 'contactcenter' must carry a non-empty valid domain type string.
|
|
373
368
|
*/
|
|
374
|
-
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() {
|
|
375
370
|
var serviceDataObj;
|
|
376
|
-
return _regenerator.default.wrap(function
|
|
377
|
-
while (1) switch (
|
|
371
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
372
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
378
373
|
case 0:
|
|
379
374
|
serviceDataObj = {
|
|
380
375
|
indicator: _types2.ServiceIndicator.CONTACT_CENTER,
|
|
381
376
|
domain: 'test.example.com'
|
|
382
377
|
};
|
|
383
|
-
expect(
|
|
384
|
-
return _regenerator.default.wrap(function
|
|
385
|
-
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) {
|
|
386
381
|
case 0:
|
|
387
|
-
|
|
382
|
+
_context10.next = 2;
|
|
388
383
|
return (0, _CallingClient.createClient)(webex, {
|
|
389
384
|
serviceData: serviceDataObj
|
|
390
385
|
});
|
|
391
386
|
case 2:
|
|
392
|
-
callingClient =
|
|
387
|
+
callingClient = _context10.sent;
|
|
393
388
|
expect(callingClient).toBeTruthy();
|
|
394
389
|
case 4:
|
|
395
390
|
case "end":
|
|
396
|
-
return
|
|
391
|
+
return _context10.stop();
|
|
397
392
|
}
|
|
398
|
-
},
|
|
393
|
+
}, _callee10);
|
|
399
394
|
}))).not.toThrow(Error);
|
|
400
395
|
case 2:
|
|
401
396
|
case "end":
|
|
402
|
-
return
|
|
397
|
+
return _context11.stop();
|
|
403
398
|
}
|
|
404
|
-
},
|
|
399
|
+
}, _callee11);
|
|
405
400
|
})));
|
|
406
|
-
it('Get current log level', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
407
|
-
return _regenerator.default.wrap(function
|
|
408
|
-
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) {
|
|
409
404
|
case 0:
|
|
410
|
-
|
|
405
|
+
_context12.next = 2;
|
|
411
406
|
return (0, _CallingClient.createClient)(webex, {
|
|
412
407
|
logger: {
|
|
413
408
|
level: _types.LOGGER.INFO
|
|
414
409
|
}
|
|
415
410
|
});
|
|
416
411
|
case 2:
|
|
417
|
-
callingClient =
|
|
412
|
+
callingClient = _context12.sent;
|
|
418
413
|
expect(callingClient).toBeTruthy();
|
|
419
414
|
expect(callingClient.getLoggingLevel).toBeTruthy();
|
|
420
415
|
expect(callingClient.getLoggingLevel()).toEqual(_types.LOGGER.INFO);
|
|
421
416
|
case 6:
|
|
422
417
|
case "end":
|
|
423
|
-
return
|
|
418
|
+
return _context12.stop();
|
|
424
419
|
}
|
|
425
|
-
},
|
|
420
|
+
}, _callee12);
|
|
426
421
|
})));
|
|
427
422
|
});
|
|
428
423
|
describe('Mobius Server discovery tests', function () {
|
|
@@ -435,19 +430,19 @@ describe('CallingClient Tests', function () {
|
|
|
435
430
|
callingClient = undefined;
|
|
436
431
|
jest.useRealTimers();
|
|
437
432
|
});
|
|
438
|
-
it('verify successful mobius server url discovery', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
439
|
-
return _regenerator.default.wrap(function
|
|
440
|
-
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) {
|
|
441
436
|
case 0:
|
|
442
437
|
webex.request.mockResolvedValueOnce(_callingClientFixtures.ipPayload).mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload);
|
|
443
|
-
|
|
438
|
+
_context13.next = 3;
|
|
444
439
|
return (0, _CallingClient.createClient)(webex, {
|
|
445
440
|
logger: {
|
|
446
441
|
level: _types.LOGGER.INFO
|
|
447
442
|
}
|
|
448
443
|
});
|
|
449
444
|
case 3:
|
|
450
|
-
callingClient =
|
|
445
|
+
callingClient = _context13.sent;
|
|
451
446
|
expect(webex.request).toBeCalledTimes(3);
|
|
452
447
|
expect(callingClient.primaryMobiusUris).toEqual([_callingClientFixtures.primaryUrl]);
|
|
453
448
|
expect(handleErrorSpy).not.toBeCalled();
|
|
@@ -469,27 +464,27 @@ describe('CallingClient Tests', function () {
|
|
|
469
464
|
}));
|
|
470
465
|
case 10:
|
|
471
466
|
case "end":
|
|
472
|
-
return
|
|
467
|
+
return _context13.stop();
|
|
473
468
|
}
|
|
474
|
-
},
|
|
469
|
+
}, _callee13);
|
|
475
470
|
})));
|
|
476
|
-
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() {
|
|
477
472
|
var failurePayload;
|
|
478
|
-
return _regenerator.default.wrap(function
|
|
479
|
-
while (1) switch (
|
|
473
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
474
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
480
475
|
case 0:
|
|
481
476
|
failurePayload = {
|
|
482
477
|
statusCode: 500
|
|
483
478
|
};
|
|
484
|
-
webex.request.
|
|
485
|
-
|
|
479
|
+
webex.request.mockRejectedValue(failurePayload);
|
|
480
|
+
_context14.next = 4;
|
|
486
481
|
return (0, _CallingClient.createClient)(webex, {
|
|
487
482
|
logger: {
|
|
488
483
|
level: _types.LOGGER.INFO
|
|
489
484
|
}
|
|
490
485
|
});
|
|
491
486
|
case 4:
|
|
492
|
-
callingClient =
|
|
487
|
+
callingClient = _context14.sent;
|
|
493
488
|
expect(webex.request).nthCalledWith(1, _objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
494
489
|
uri: 'https://mobius-us-east-1.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
495
490
|
method: 'GET'
|
|
@@ -511,30 +506,69 @@ describe('CallingClient Tests', function () {
|
|
|
511
506
|
method: 'getMobiusServers'
|
|
512
507
|
});
|
|
513
508
|
expect(callingClient.primaryMobiusUris).toEqual(["".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT)]);
|
|
514
|
-
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
|
+
}));
|
|
515
513
|
case 12:
|
|
516
514
|
case "end":
|
|
517
|
-
return
|
|
515
|
+
return _context14.stop();
|
|
518
516
|
}
|
|
519
|
-
},
|
|
517
|
+
}, _callee14);
|
|
520
518
|
})));
|
|
521
|
-
it('when
|
|
519
|
+
it('case when /myIP failed with 401', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
522
520
|
var failurePayload;
|
|
523
|
-
return _regenerator.default.wrap(function
|
|
524
|
-
while (1) switch (
|
|
521
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
522
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
523
|
+
case 0:
|
|
524
|
+
failurePayload = {
|
|
525
|
+
statusCode: 401
|
|
526
|
+
};
|
|
527
|
+
webex.request.mockRejectedValueOnce(failurePayload);
|
|
528
|
+
_context15.next = 4;
|
|
529
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
530
|
+
logger: {
|
|
531
|
+
level: _types.LOGGER.INFO
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
case 4:
|
|
535
|
+
callingClient = _context15.sent;
|
|
536
|
+
expect(webex.request).toBeCalledOnceWith(_objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
537
|
+
uri: 'https://mobius-us-east-1.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
538
|
+
method: 'GET'
|
|
539
|
+
}));
|
|
540
|
+
expect(handleErrorSpy).toBeCalledOnceWith(failurePayload, expect.anything(), {
|
|
541
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
542
|
+
method: 'getMobiusServers'
|
|
543
|
+
});
|
|
544
|
+
expect(callingClient.primaryMobiusUris).toEqual(["".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT)]);
|
|
545
|
+
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers", expect.objectContaining({
|
|
546
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
547
|
+
method: 'getMobiusServers'
|
|
548
|
+
}));
|
|
549
|
+
case 9:
|
|
550
|
+
case "end":
|
|
551
|
+
return _context15.stop();
|
|
552
|
+
}
|
|
553
|
+
}, _callee15);
|
|
554
|
+
})));
|
|
555
|
+
it('when region discovery succeeds but region based mobius url discovery fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
556
|
+
var failurePayload;
|
|
557
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
558
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
525
559
|
case 0:
|
|
526
560
|
failurePayload = {
|
|
527
561
|
statusCode: 500
|
|
528
562
|
};
|
|
529
563
|
webex.request.mockResolvedValueOnce(_callingClientFixtures.ipPayload).mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockRejectedValueOnce(failurePayload);
|
|
530
|
-
|
|
564
|
+
_context16.next = 4;
|
|
531
565
|
return (0, _CallingClient.createClient)(webex, {
|
|
532
566
|
logger: {
|
|
533
567
|
level: _types.LOGGER.INFO
|
|
534
568
|
}
|
|
535
569
|
});
|
|
536
570
|
case 4:
|
|
537
|
-
callingClient =
|
|
571
|
+
callingClient = _context16.sent;
|
|
538
572
|
expect(handleErrorSpy).toBeCalledWith(failurePayload, expect.anything(), {
|
|
539
573
|
file: _constants.CALLING_CLIENT_FILE,
|
|
540
574
|
method: 'getMobiusServers'
|
|
@@ -552,22 +586,66 @@ describe('CallingClient Tests', function () {
|
|
|
552
586
|
addAuthHeader: false,
|
|
553
587
|
headers: (0, _defineProperty2.default)({}, _constants.SPARK_USER_AGENT, null)
|
|
554
588
|
});
|
|
555
|
-
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
|
+
}));
|
|
593
|
+
case 11:
|
|
594
|
+
case "end":
|
|
595
|
+
return _context16.stop();
|
|
596
|
+
}
|
|
597
|
+
}, _callee16);
|
|
598
|
+
})));
|
|
599
|
+
it('case when discovery failed with 401', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
600
|
+
var failurePayload;
|
|
601
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
602
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
603
|
+
case 0:
|
|
604
|
+
failurePayload = {
|
|
605
|
+
statusCode: 401
|
|
606
|
+
};
|
|
607
|
+
webex.request.mockResolvedValueOnce(_callingClientFixtures.ipPayload).mockRejectedValueOnce(failurePayload);
|
|
608
|
+
_context17.next = 4;
|
|
609
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
610
|
+
logger: {
|
|
611
|
+
level: _types.LOGGER.INFO
|
|
612
|
+
}
|
|
613
|
+
});
|
|
614
|
+
case 4:
|
|
615
|
+
callingClient = _context17.sent;
|
|
616
|
+
expect(webex.request).toBeCalledTimes(2);
|
|
617
|
+
expect(webex.request).nthCalledWith(1, _objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
618
|
+
uri: 'https://mobius-us-east-1.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
619
|
+
method: 'GET'
|
|
620
|
+
}));
|
|
621
|
+
expect(webex.request).nthCalledWith(2, {
|
|
622
|
+
method: 'GET',
|
|
623
|
+
uri: "".concat(_constants.DISCOVERY_URL, "/").concat(_callingClientFixtures.myIP),
|
|
624
|
+
addAuthHeader: false,
|
|
625
|
+
headers: (0, _defineProperty2.default)({}, _constants.SPARK_USER_AGENT, null)
|
|
626
|
+
});
|
|
627
|
+
expect(handleErrorSpy).toBeCalledOnceWith(failurePayload, expect.anything(), {
|
|
628
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
629
|
+
method: 'getMobiusServers'
|
|
630
|
+
});
|
|
631
|
+
expect(callingClient.primaryMobiusUris).toEqual(["".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT)]);
|
|
632
|
+
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers", expect.objectContaining({
|
|
633
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
634
|
+
method: 'getMobiusServers'
|
|
635
|
+
}));
|
|
556
636
|
case 11:
|
|
557
637
|
case "end":
|
|
558
638
|
return _context17.stop();
|
|
559
639
|
}
|
|
560
640
|
}, _callee17);
|
|
561
641
|
})));
|
|
562
|
-
it('Verify successful mobius server url discovery after initializing callingClient through a config', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
563
|
-
var infoSpy;
|
|
642
|
+
it('Verify successful mobius server url discovery after initializing callingClient through a config', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
564
643
|
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
565
644
|
while (1) switch (_context18.prev = _context18.next) {
|
|
566
645
|
case 0:
|
|
567
|
-
infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
568
646
|
infoSpy.mockReset();
|
|
569
647
|
webex.request.mockResolvedValueOnce(_callingClientFixtures.discoveryPayload);
|
|
570
|
-
_context18.next =
|
|
648
|
+
_context18.next = 4;
|
|
571
649
|
return (0, _CallingClient.createClient)(webex, {
|
|
572
650
|
discovery: {
|
|
573
651
|
region: 'AP-SOUTHEAST',
|
|
@@ -577,7 +655,7 @@ describe('CallingClient Tests', function () {
|
|
|
577
655
|
level: _types.LOGGER.INFO
|
|
578
656
|
}
|
|
579
657
|
});
|
|
580
|
-
case
|
|
658
|
+
case 4:
|
|
581
659
|
callingClient = _context18.sent;
|
|
582
660
|
expect(callingClient.primaryMobiusUris).toEqual([_callingClientFixtures.primaryUrl]);
|
|
583
661
|
expect(infoSpy).toHaveBeenCalledWith(_constants2.METHOD_START_MESSAGE, {
|
|
@@ -589,7 +667,7 @@ describe('CallingClient Tests', function () {
|
|
|
589
667
|
method: 'GET'
|
|
590
668
|
}));
|
|
591
669
|
expect(handleErrorSpy).not.toHaveBeenCalled();
|
|
592
|
-
case
|
|
670
|
+
case 9:
|
|
593
671
|
case "end":
|
|
594
672
|
return _context18.stop();
|
|
595
673
|
}
|
|
@@ -599,7 +677,7 @@ describe('CallingClient Tests', function () {
|
|
|
599
677
|
describe('Testing each cluster present withing host catalog', function () {
|
|
600
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'];
|
|
601
679
|
var checkCluster = /*#__PURE__*/function () {
|
|
602
|
-
var _ref19 = (0, _asyncToGenerator2.default)(
|
|
680
|
+
var _ref19 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19(mockServiceHosts, mockCatalog) {
|
|
603
681
|
var callingClient;
|
|
604
682
|
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
605
683
|
while (1) switch (_context19.prev = _context19.next) {
|
|
@@ -625,7 +703,7 @@ describe('CallingClient Tests', function () {
|
|
|
625
703
|
};
|
|
626
704
|
}();
|
|
627
705
|
it.each(mobiusCluster)('%s', /*#__PURE__*/function () {
|
|
628
|
-
var _ref20 = (0, _asyncToGenerator2.default)(
|
|
706
|
+
var _ref20 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20(clusterName) {
|
|
629
707
|
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
630
708
|
while (1) switch (_context20.prev = _context20.next) {
|
|
631
709
|
case 0:
|
|
@@ -654,270 +732,312 @@ describe('CallingClient Tests', function () {
|
|
|
654
732
|
};
|
|
655
733
|
}());
|
|
656
734
|
});
|
|
657
|
-
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 () {
|
|
658
772
|
var callingClient;
|
|
659
773
|
var line;
|
|
660
774
|
var reg;
|
|
661
|
-
var
|
|
662
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
775
|
+
var windowEventSpy;
|
|
663
776
|
var deRegSpy;
|
|
777
|
+
var restoreSpy;
|
|
664
778
|
var restartRegisterSpy;
|
|
665
779
|
var registerSpy;
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
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) {
|
|
669
784
|
case 0:
|
|
670
785
|
jest.useFakeTimers();
|
|
671
786
|
webex.request.mockResolvedValueOnce(_callingClientFixtures.ipPayload).mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload).mockResolvedValueOnce(_callingClientFixtures.registrationPayload);
|
|
672
|
-
|
|
787
|
+
windowEventSpy = jest.spyOn(window, 'addEventListener');
|
|
788
|
+
_context22.next = 5;
|
|
673
789
|
return (0, _CallingClient.createClient)(webex, {
|
|
674
790
|
logger: {
|
|
675
791
|
level: _types.LOGGER.INFO
|
|
676
792
|
}
|
|
677
793
|
});
|
|
678
|
-
case
|
|
679
|
-
callingClient =
|
|
794
|
+
case 5:
|
|
795
|
+
callingClient = _context22.sent;
|
|
680
796
|
line = (0, _values.default)(callingClient.lineDict)[0];
|
|
681
797
|
reg = line.registration;
|
|
682
|
-
|
|
798
|
+
_context22.next = 10;
|
|
683
799
|
return line.register();
|
|
684
|
-
case
|
|
685
|
-
deRegSpy = jest.spyOn(
|
|
800
|
+
case 10:
|
|
801
|
+
deRegSpy = jest.spyOn(reg, 'deregister');
|
|
686
802
|
restoreSpy = jest.spyOn(reg, 'restorePreviousRegistration');
|
|
687
803
|
restartRegisterSpy = jest.spyOn(reg, 'restartRegistration');
|
|
688
804
|
registerSpy = jest.spyOn(reg, 'attemptRegistrationWithServers');
|
|
689
|
-
|
|
805
|
+
metricSpy = jest.spyOn(callingClient['metricManager'], 'submitConnectionMetrics');
|
|
806
|
+
case 15:
|
|
690
807
|
case "end":
|
|
691
|
-
return
|
|
808
|
+
return _context22.stop();
|
|
692
809
|
}
|
|
693
|
-
},
|
|
810
|
+
}, _callee22);
|
|
694
811
|
})));
|
|
695
812
|
afterEach(function () {
|
|
696
813
|
jest.clearAllTimers();
|
|
697
814
|
jest.clearAllMocks();
|
|
698
815
|
callingClient.removeAllListeners();
|
|
816
|
+
callingClient['callManager'].callCollection = {};
|
|
699
817
|
callManager.removeAllListeners();
|
|
700
818
|
callingClient = undefined;
|
|
701
819
|
jest.useRealTimers();
|
|
702
820
|
});
|
|
703
|
-
it('
|
|
704
|
-
|
|
705
|
-
|
|
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) {
|
|
706
825
|
case 0:
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
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'), {
|
|
716
834
|
file: _constants.CALLING_CLIENT_FILE,
|
|
717
|
-
method:
|
|
718
|
-
});
|
|
719
|
-
|
|
720
|
-
/* Set mercury connection to be up and execute a delay of 2.5 seconds */
|
|
721
|
-
webex.internal.mercury.connected = true;
|
|
722
|
-
logSpy.mockReset();
|
|
723
|
-
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
724
|
-
_context22.next = 10;
|
|
725
|
-
return flushPromises();
|
|
726
|
-
case 10:
|
|
727
|
-
_Logger.default.info('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
728
|
-
file: _constants.REGISTRATION_FILE,
|
|
729
|
-
method: 'handleConnectionRestoration'
|
|
835
|
+
method: 'pingExternal'
|
|
730
836
|
});
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
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:
|
|
861
|
+
case "end":
|
|
862
|
+
return _context24.stop();
|
|
863
|
+
}
|
|
864
|
+
}, _callee24);
|
|
865
|
+
})));
|
|
866
|
+
it('window online handler sets networkUpTimestamp and logs', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
867
|
+
var onlineCb;
|
|
868
|
+
return _regenerator.default.wrap(function _callee25$(_context25) {
|
|
869
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
870
|
+
case 0:
|
|
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, {
|
|
877
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
878
|
+
method: 'handleNetworkOnline'
|
|
736
879
|
});
|
|
737
|
-
|
|
738
|
-
expect(restartRegisterSpy).toHaveBeenCalledWith('handleConnectionRestoration');
|
|
739
|
-
expect(webex.request).toHaveBeenCalledTimes(6);
|
|
740
|
-
expect(registerSpy).toHaveBeenCalledWith('handleConnectionRestoration', [reg.getActiveMobiusUrl()]);
|
|
741
|
-
expect(registerSpy).toHaveBeenCalledWith('handleConnectionRestoration', [_callingClientFixtures.primaryUrl]);
|
|
742
|
-
case 17:
|
|
880
|
+
case 5:
|
|
743
881
|
case "end":
|
|
744
|
-
return
|
|
882
|
+
return _context25.stop();
|
|
745
883
|
}
|
|
746
|
-
},
|
|
884
|
+
}, _callee25);
|
|
747
885
|
})));
|
|
748
|
-
it('
|
|
749
|
-
var
|
|
750
|
-
return _regenerator.default.wrap(function
|
|
751
|
-
while (1) switch (
|
|
886
|
+
it('mercury offline submits metrics and sets timestamp', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
887
|
+
var mercuryOfflineCb;
|
|
888
|
+
return _regenerator.default.wrap(function _callee26$(_context26) {
|
|
889
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
752
890
|
case 0:
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
mockRegistrationBody = (0, _testUtil.getMockDeviceInfo)();
|
|
759
|
-
successPayload = {
|
|
760
|
-
statusCode: 200,
|
|
761
|
-
body: mockRegistrationBody
|
|
762
|
-
};
|
|
763
|
-
webex.request.mockRejectedValueOnce(failurePayload).mockResolvedValueOnce(successPayload);
|
|
764
|
-
|
|
765
|
-
/* Set mercury connection to be down and execute a delay of 2.5 seconds */
|
|
766
|
-
webex.internal.mercury.connected = false;
|
|
767
|
-
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
768
|
-
|
|
769
|
-
/* We should be detecting the network flap */
|
|
770
|
-
expect(warnSpy).toBeCalledWith('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'), {
|
|
771
896
|
file: _constants.CALLING_CLIENT_FILE,
|
|
772
|
-
method:
|
|
897
|
+
method: 'handleMercuryOffline'
|
|
773
898
|
});
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
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:
|
|
902
|
+
case "end":
|
|
903
|
+
return _context26.stop();
|
|
904
|
+
}
|
|
905
|
+
}, _callee26);
|
|
906
|
+
})));
|
|
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;
|
|
909
|
+
return _regenerator.default.wrap(function _callee27$(_context27) {
|
|
910
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
911
|
+
case 0:
|
|
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];
|
|
917
|
+
_context27.next = 7;
|
|
918
|
+
return mercuryOnlineCb();
|
|
919
|
+
case 7:
|
|
920
|
+
// Run the interval once
|
|
921
|
+
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 100);
|
|
922
|
+
_context27.next = 10;
|
|
780
923
|
return flushPromises();
|
|
781
|
-
case
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
method: 'handleConnectionRestoration'
|
|
785
|
-
});
|
|
786
|
-
|
|
787
|
-
/* We should be detecting the network recovery */
|
|
788
|
-
expect(logSpy).toBeCalledWith('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
924
|
+
case 10:
|
|
925
|
+
expect(handleConnectionRestoreSpy).toHaveBeenCalledWith(true);
|
|
926
|
+
expect(logSpy).toHaveBeenCalledWith('Network is up again, re-registering with Webex Calling if needed', {
|
|
789
927
|
file: _constants.REGISTRATION_FILE,
|
|
790
928
|
method: 'handleConnectionRestoration'
|
|
791
929
|
});
|
|
930
|
+
expect(deRegSpy).toHaveBeenCalledWith();
|
|
792
931
|
expect(restoreSpy).toHaveBeenCalledWith('handleConnectionRestoration');
|
|
793
932
|
expect(restartRegisterSpy).toHaveBeenCalledWith('handleConnectionRestoration');
|
|
794
|
-
expect(webex.request).toHaveBeenCalledTimes(6);
|
|
795
933
|
expect(registerSpy).toHaveBeenCalledWith('handleConnectionRestoration', [reg.getActiveMobiusUrl()]);
|
|
796
934
|
expect(registerSpy).toHaveBeenCalledWith('handleConnectionRestoration', [_callingClientFixtures.primaryUrl]);
|
|
797
|
-
|
|
935
|
+
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.NETWORK_FLAP, _types4.METRIC_TYPE.BEHAVIORAL, '2023-01-01T00:00:00.000Z', '2023-01-01T00:01:00.000Z');
|
|
936
|
+
case 18:
|
|
798
937
|
case "end":
|
|
799
|
-
return
|
|
938
|
+
return _context27.stop();
|
|
800
939
|
}
|
|
801
|
-
},
|
|
940
|
+
}, _callee27);
|
|
802
941
|
})));
|
|
803
|
-
it('
|
|
804
|
-
var handleConnectionRestoreSpy;
|
|
805
|
-
return _regenerator.default.wrap(function
|
|
806
|
-
while (1) switch (
|
|
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;
|
|
944
|
+
return _regenerator.default.wrap(function _callee28$(_context28) {
|
|
945
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
807
946
|
case 0:
|
|
808
|
-
warnSpy.mockClear();
|
|
809
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';
|
|
810
951
|
reg.setStatus(_types2.RegistrationStatus.IDLE);
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
file: _constants.CALLING_CLIENT_FILE,
|
|
819
|
-
method: _constants.NETWORK_CHANGE_DETECTION_UTIL
|
|
820
|
-
});
|
|
821
|
-
|
|
822
|
-
/* Set mercury connection to be up and execute a delay of 2.5 seconds */
|
|
823
|
-
webex.internal.mercury.connected = true;
|
|
824
|
-
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
825
|
-
_context24.next = 10;
|
|
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;
|
|
826
959
|
return flushPromises();
|
|
827
|
-
case
|
|
828
|
-
|
|
829
|
-
expect(logSpy).not.
|
|
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', {
|
|
830
963
|
file: _constants.REGISTRATION_FILE,
|
|
831
964
|
method: 'handleConnectionRestoration'
|
|
832
965
|
});
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
expect(
|
|
839
|
-
case
|
|
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:
|
|
840
973
|
case "end":
|
|
841
|
-
return
|
|
974
|
+
return _context28.stop();
|
|
842
975
|
}
|
|
843
|
-
},
|
|
976
|
+
}, _callee28);
|
|
844
977
|
})));
|
|
845
|
-
it('
|
|
846
|
-
|
|
847
|
-
|
|
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) {
|
|
848
982
|
case 0:
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
expect((0, _keys.default)(
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
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;
|
|
859
994
|
return flushPromises();
|
|
860
|
-
case
|
|
861
|
-
|
|
862
|
-
expect(warnSpy).not.toBeCalledOnceWith('Network has flapped, waiting for mercury connection to be up', {
|
|
995
|
+
case 11:
|
|
996
|
+
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Call Keepalive failed'), {
|
|
863
997
|
file: _constants.CALLING_CLIENT_FILE,
|
|
864
|
-
method: '
|
|
865
|
-
});
|
|
866
|
-
|
|
867
|
-
/* Set mercury connection to be up and execute a delay of 2.5 seconds */
|
|
868
|
-
webex.internal.mercury.connected = true;
|
|
869
|
-
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
870
|
-
_context25.next = 12;
|
|
871
|
-
return flushPromises();
|
|
872
|
-
case 12:
|
|
873
|
-
/* We should be detecting the network recovery */
|
|
874
|
-
expect(logSpy).not.toBeCalledOnceWith('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
875
|
-
file: _constants.REGISTRATION_FILE,
|
|
876
|
-
method: 'handleConnectionRestoration'
|
|
998
|
+
method: 'checkCallStatus'
|
|
877
999
|
});
|
|
878
|
-
expect(
|
|
879
|
-
|
|
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:
|
|
880
1005
|
case "end":
|
|
881
|
-
return
|
|
1006
|
+
return _context29.stop();
|
|
882
1007
|
}
|
|
883
|
-
},
|
|
1008
|
+
}, _callee29);
|
|
884
1009
|
})));
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
890
|
-
return _regenerator.default.wrap(function _callee26$(_context26) {
|
|
891
|
-
while (1) switch (_context26.prev = _context26.next) {
|
|
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) {
|
|
892
1014
|
case 0:
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
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:
|
|
899
1036
|
case "end":
|
|
900
|
-
return
|
|
1037
|
+
return _context30.stop();
|
|
901
1038
|
}
|
|
902
|
-
},
|
|
1039
|
+
}, _callee30);
|
|
903
1040
|
})));
|
|
904
|
-
afterEach(function () {
|
|
905
|
-
jest.clearAllTimers();
|
|
906
|
-
jest.clearAllMocks();
|
|
907
|
-
callingClient.removeAllListeners();
|
|
908
|
-
callManager.removeAllListeners();
|
|
909
|
-
callingClient = undefined;
|
|
910
|
-
jest.useRealTimers();
|
|
911
|
-
});
|
|
912
|
-
it('verify line dict successfully created', function () {
|
|
913
|
-
expect(callingClient.lineDict).toBeTruthy();
|
|
914
|
-
expect(line).toBeTruthy();
|
|
915
|
-
expect((0, _keys.default)(callingClient.lineDict).length).toEqual(1);
|
|
916
|
-
});
|
|
917
|
-
it('verify getLines response', function () {
|
|
918
|
-
expect(callingClient.getLines).toBeTruthy();
|
|
919
|
-
expect(callingClient.getLines()).toEqual(callingClient.lineDict);
|
|
920
|
-
});
|
|
921
1041
|
});
|
|
922
1042
|
|
|
923
1043
|
// Calling related test cases
|
|
@@ -934,15 +1054,15 @@ describe('CallingClient Tests', function () {
|
|
|
934
1054
|
});
|
|
935
1055
|
var callingClient;
|
|
936
1056
|
var line;
|
|
937
|
-
beforeAll(
|
|
1057
|
+
beforeAll(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
|
|
938
1058
|
var calls;
|
|
939
|
-
return _regenerator.default.wrap(function
|
|
940
|
-
while (1) switch (
|
|
1059
|
+
return _regenerator.default.wrap(function _callee31$(_context31) {
|
|
1060
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
941
1061
|
case 0:
|
|
942
|
-
|
|
1062
|
+
_context31.next = 2;
|
|
943
1063
|
return (0, _CallingClient.createClient)(webex);
|
|
944
1064
|
case 2:
|
|
945
|
-
callingClient =
|
|
1065
|
+
callingClient = _context31.sent;
|
|
946
1066
|
line = new _line.default(userId, clientDeviceUri, mutex, primaryMobiusUris(), backupMobiusUris(), _types.LOGGER.INFO);
|
|
947
1067
|
calls = (0, _values.default)(callManager.getActiveCalls());
|
|
948
1068
|
calls.forEach(function (call) {
|
|
@@ -950,9 +1070,9 @@ describe('CallingClient Tests', function () {
|
|
|
950
1070
|
});
|
|
951
1071
|
case 6:
|
|
952
1072
|
case "end":
|
|
953
|
-
return
|
|
1073
|
+
return _context31.stop();
|
|
954
1074
|
}
|
|
955
|
-
},
|
|
1075
|
+
}, _callee31);
|
|
956
1076
|
})));
|
|
957
1077
|
afterAll(function () {
|
|
958
1078
|
callingClient.removeAllListeners();
|
|
@@ -1035,23 +1155,23 @@ describe('CallingClient Tests', function () {
|
|
|
1035
1155
|
describe('Call Session Event test', function () {
|
|
1036
1156
|
var mockOn = webex.internal.mercury.on;
|
|
1037
1157
|
var callingClient;
|
|
1038
|
-
beforeEach(
|
|
1039
|
-
return _regenerator.default.wrap(function
|
|
1040
|
-
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) {
|
|
1041
1161
|
case 0:
|
|
1042
|
-
|
|
1162
|
+
_context32.next = 2;
|
|
1043
1163
|
return (0, _CallingClient.createClient)(webex, {
|
|
1044
1164
|
logger: {
|
|
1045
1165
|
level: _types.LOGGER.INFO
|
|
1046
1166
|
}
|
|
1047
1167
|
});
|
|
1048
1168
|
case 2:
|
|
1049
|
-
callingClient =
|
|
1169
|
+
callingClient = _context32.sent;
|
|
1050
1170
|
case 3:
|
|
1051
1171
|
case "end":
|
|
1052
|
-
return
|
|
1172
|
+
return _context32.stop();
|
|
1053
1173
|
}
|
|
1054
|
-
},
|
|
1174
|
+
}, _callee32);
|
|
1055
1175
|
})));
|
|
1056
1176
|
afterEach(function () {
|
|
1057
1177
|
callingClient.removeAllListeners();
|
|
@@ -1078,5 +1198,92 @@ describe('CallingClient Tests', function () {
|
|
|
1078
1198
|
callSessionCallback(_callRecordFixtures.MOCK_MULTIPLE_SESSIONS_EVENT);
|
|
1079
1199
|
});
|
|
1080
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
|
+
});
|
|
1081
1288
|
});
|
|
1082
1289
|
//# sourceMappingURL=CallingClient.test.js.map
|