@webex/calling 3.9.0 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CallHistory/CallHistory.js +51 -46
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +146 -147
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallHistory/callHistoryFixtures.js.map +1 -1
- package/dist/CallHistory/constants.js.map +1 -1
- package/dist/CallHistory/types.js.map +1 -1
- package/dist/CallSettings/CallSettings.js +8 -8
- package/dist/CallSettings/CallSettings.js.map +1 -1
- package/dist/CallSettings/CallSettings.test.js +1 -1
- package/dist/CallSettings/CallSettings.test.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.js +12 -11
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +9 -10
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +66 -59
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +108 -109
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/constants.js.map +1 -1
- package/dist/CallSettings/testFixtures.js.map +1 -1
- package/dist/CallSettings/types.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +457 -201
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +458 -315
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/callRecordFixtures.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.js +2 -2
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +8 -7
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/types.js.map +1 -1
- package/dist/CallingClient/calling/call.js +369 -333
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +411 -410
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +3 -4
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +67 -68
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/calling/index.js.map +1 -1
- package/dist/CallingClient/calling/types.js.map +1 -1
- package/dist/CallingClient/callingClientFixtures.js.map +1 -1
- package/dist/CallingClient/constants.js +9 -6
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +10 -11
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +10 -9
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/line/types.js.map +1 -1
- package/dist/CallingClient/registration/index.js.map +1 -1
- package/dist/CallingClient/registration/register.js +280 -201
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +251 -180
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/registerFixtures.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +25 -10
- package/dist/CallingClient/registration/webWorker.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.test.js +85 -38
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
- package/dist/CallingClient/types.js.map +1 -1
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +142 -0
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -0
- package/dist/Contacts/ContactsClient.js +244 -238
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +89 -90
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Contacts/constants.js +2 -2
- package/dist/Contacts/constants.js.map +1 -1
- package/dist/Contacts/contactFixtures.js.map +1 -1
- package/dist/Contacts/types.js.map +1 -1
- package/dist/Errors/catalog/CallError.js +2 -2
- package/dist/Errors/catalog/CallError.js.map +1 -1
- package/dist/Errors/catalog/CallingDeviceError.js +2 -2
- package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
- package/dist/Errors/catalog/ExtendedError.js +3 -3
- package/dist/Errors/catalog/ExtendedError.js.map +1 -1
- package/dist/Errors/catalog/LineError.js +2 -2
- package/dist/Errors/catalog/LineError.js.map +1 -1
- package/dist/Errors/index.js.map +1 -1
- package/dist/Errors/types.js.map +1 -1
- package/dist/Events/impl/index.js +2 -2
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/Events/types.js.map +1 -1
- package/dist/Logger/index.js.map +1 -1
- package/dist/Logger/index.test.js.map +1 -1
- package/dist/Logger/types.js.map +1 -1
- package/dist/Metrics/index.js +221 -104
- package/dist/Metrics/index.js.map +1 -1
- package/dist/Metrics/index.test.js +112 -23
- package/dist/Metrics/index.test.js.map +1 -1
- package/dist/Metrics/types.js +15 -1
- package/dist/Metrics/types.js.map +1 -1
- package/dist/SDKConnector/index.js +0 -1
- package/dist/SDKConnector/index.js.map +1 -1
- package/dist/SDKConnector/index.test.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/SDKConnector/utils.js.map +1 -1
- package/dist/SDKConnector/utils.test.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +42 -39
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +119 -120
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +54 -47
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +73 -74
- package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +12 -11
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/Voicemail.test.js +2 -2
- package/dist/Voicemail/Voicemail.test.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +78 -70
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +184 -185
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/constants.js.map +1 -1
- package/dist/Voicemail/types.js.map +1 -1
- package/dist/Voicemail/voicemailFixture.js.map +1 -1
- package/dist/api.js.map +1 -1
- package/dist/common/Utils.js +84 -65
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +111 -117
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/index.js.map +1 -1
- package/dist/common/testUtil.js +1 -1
- package/dist/common/testUtil.js.map +1 -1
- package/dist/common/types.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +4 -0
- package/dist/module/CallSettings/UcmBackendConnector.js +1 -0
- package/dist/module/CallSettings/WxCallBackendConnector.js +7 -0
- package/dist/module/CallingClient/CallingClient.js +174 -32
- package/dist/module/CallingClient/calling/call.js +79 -43
- package/dist/module/CallingClient/constants.js +8 -4
- package/dist/module/CallingClient/line/index.js +3 -3
- package/dist/module/CallingClient/registration/register.js +34 -10
- package/dist/module/CallingClient/registration/webWorker.js +17 -3
- package/dist/module/CallingClient/registration/webWorkerStr.js +19 -3
- package/dist/module/CallingClient/windowsChromiumIceWarmupUtils.js +59 -0
- package/dist/module/Contacts/ContactsClient.js +23 -17
- package/dist/module/Contacts/constants.js +1 -1
- package/dist/module/Metrics/index.js +142 -55
- package/dist/module/Metrics/types.js +14 -0
- package/dist/module/Voicemail/BroadworksBackendConnector.js +3 -0
- package/dist/module/Voicemail/UcmBackendConnector.js +6 -0
- package/dist/module/Voicemail/WxCallBackendConnector.js +8 -0
- package/dist/module/common/Utils.js +27 -10
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts +12 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/types.d.ts +2 -1
- package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +8 -4
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +1 -0
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorker.d.ts +2 -1
- package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts +1 -1
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -1
- package/dist/types/CallingClient/windowsChromiumIceWarmupUtils.d.ts +5 -0
- package/dist/types/CallingClient/windowsChromiumIceWarmupUtils.d.ts.map +1 -0
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/Contacts/constants.d.ts +1 -1
- package/dist/types/Contacts/constants.d.ts.map +1 -1
- package/dist/types/Metrics/index.d.ts.map +1 -1
- package/dist/types/Metrics/types.d.ts +18 -3
- package/dist/types/Metrics/types.d.ts.map +1 -1
- package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +1 -0
- package/dist/types/common/types.d.ts.map +1 -1
- package/package.json +10 -8
|
@@ -29,8 +29,7 @@ var _constants = require("../constants");
|
|
|
29
29
|
var _types4 = require("../line/types");
|
|
30
30
|
var _LineError = require("../../Errors/catalog/LineError");
|
|
31
31
|
var _types5 = require("../../Metrics/types");
|
|
32
|
-
function
|
|
33
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? _Object$getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? _Object$defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
32
|
+
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); }
|
|
34
33
|
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; }
|
|
35
34
|
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 @typescript-eslint/no-shadow */
|
|
36
35
|
var webex = (0, _testUtil.getTestUtilsWebex)();
|
|
@@ -143,7 +142,7 @@ describe('Registration Tests', function () {
|
|
|
143
142
|
jest.clearAllMocks();
|
|
144
143
|
jest.useRealTimers();
|
|
145
144
|
});
|
|
146
|
-
it('verify successful registration', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
145
|
+
it('verify successful registration', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
147
146
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
148
147
|
while (1) switch (_context.prev = _context.next) {
|
|
149
148
|
case 0:
|
|
@@ -165,9 +164,9 @@ describe('Registration Tests', function () {
|
|
|
165
164
|
expect(lineEmitter).toBeCalledWith(_types4.LINE_EVENTS.REGISTERED, _registerFixtures.mockPostResponse);
|
|
166
165
|
|
|
167
166
|
// Check that log.log was called for successful registration
|
|
168
|
-
expect(logSpy).toBeCalledWith("Registration successful for deviceId: ".concat(_registerFixtures.mockPostResponse.device.deviceId, " userId: ").concat(_registerFixtures.mockPostResponse.userId), expect.objectContaining({
|
|
167
|
+
expect(logSpy).toBeCalledWith("Registration successful for deviceId: ".concat(_registerFixtures.mockPostResponse.device.deviceId, " userId: ").concat(_registerFixtures.mockPostResponse.userId, " responseTrackingId: webex-js-sdk_06bafdd0-2f9b-4cd7-b438-9c0d95ecec9b_15"), expect.objectContaining({
|
|
169
168
|
file: _constants.REGISTRATION_FILE,
|
|
170
|
-
method:
|
|
169
|
+
method: 'register'
|
|
171
170
|
}));
|
|
172
171
|
expect(metricSpy).toBeCalledWith(_types5.METRIC_EVENT.REGISTRATION, _types5.REG_ACTION.REGISTER, _types5.METRIC_TYPE.BEHAVIORAL, _constants.REGISTRATION_UTIL, 'PRIMARY', 'webex-js-sdk_06bafdd0-2f9b-4cd7-b438-9c0d95ecec9b_15', undefined, undefined);
|
|
173
172
|
case 10:
|
|
@@ -176,7 +175,7 @@ describe('Registration Tests', function () {
|
|
|
176
175
|
}
|
|
177
176
|
}, _callee);
|
|
178
177
|
})));
|
|
179
|
-
it('verify failure registration', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
178
|
+
it('verify failure registration', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
180
179
|
var error;
|
|
181
180
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
182
181
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -204,7 +203,7 @@ describe('Registration Tests', function () {
|
|
|
204
203
|
}
|
|
205
204
|
}, _callee2);
|
|
206
205
|
})));
|
|
207
|
-
it('verify failure registration 403-101', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
206
|
+
it('verify failure registration 403-101', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
208
207
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
209
208
|
while (1) switch (_context3.prev = _context3.next) {
|
|
210
209
|
case 0:
|
|
@@ -270,7 +269,7 @@ describe('Registration Tests', function () {
|
|
|
270
269
|
mobiusUris.backup.push(_registerFixtures.URL);
|
|
271
270
|
jest.clearAllMocks();
|
|
272
271
|
});
|
|
273
|
-
it('handle 429 received during initial registration failure and first attempt with primary', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
272
|
+
it('handle 429 received during initial registration failure and first attempt with primary', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
274
273
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
275
274
|
while (1) switch (_context4.prev = _context4.next) {
|
|
276
275
|
case 0:
|
|
@@ -332,7 +331,7 @@ describe('Registration Tests', function () {
|
|
|
332
331
|
}
|
|
333
332
|
}, _callee4);
|
|
334
333
|
})));
|
|
335
|
-
it('handle 429 received with higher retryAfter than the interval when interval with elapsedTime is already reaching threshold timer so we failover immediately', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
334
|
+
it('handle 429 received with higher retryAfter than the interval when interval with elapsedTime is already reaching threshold timer so we failover immediately', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
336
335
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
337
336
|
while (1) switch (_context5.prev = _context5.next) {
|
|
338
337
|
case 0:
|
|
@@ -388,7 +387,7 @@ describe('Registration Tests', function () {
|
|
|
388
387
|
}
|
|
389
388
|
}, _callee5);
|
|
390
389
|
})));
|
|
391
|
-
it('handle 429 received while the last attempt for primary', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
390
|
+
it('handle 429 received while the last attempt for primary', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
392
391
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
393
392
|
while (1) switch (_context6.prev = _context6.next) {
|
|
394
393
|
case 0:
|
|
@@ -459,7 +458,7 @@ describe('Registration Tests', function () {
|
|
|
459
458
|
}
|
|
460
459
|
}, _callee6);
|
|
461
460
|
})));
|
|
462
|
-
it('handle 429 received while failing over to backup server for CC flow', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
461
|
+
it('handle 429 received while failing over to backup server for CC flow', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
463
462
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
464
463
|
while (1) switch (_context7.prev = _context7.next) {
|
|
465
464
|
case 0:
|
|
@@ -508,7 +507,7 @@ describe('Registration Tests', function () {
|
|
|
508
507
|
}
|
|
509
508
|
}, _callee7);
|
|
510
509
|
})));
|
|
511
|
-
it('checking the retryAfter exceeding the threshold timers in first attempt itself', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
510
|
+
it('checking the retryAfter exceeding the threshold timers in first attempt itself', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
512
511
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
513
512
|
while (1) switch (_context8.prev = _context8.next) {
|
|
514
513
|
case 0:
|
|
@@ -538,7 +537,7 @@ describe('Registration Tests', function () {
|
|
|
538
537
|
}
|
|
539
538
|
}, _callee8);
|
|
540
539
|
})));
|
|
541
|
-
it('checking the retryAfter exceeding the threshold timers in later attempts', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
540
|
+
it('checking the retryAfter exceeding the threshold timers in later attempts', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
542
541
|
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
543
542
|
while (1) switch (_context9.prev = _context9.next) {
|
|
544
543
|
case 0:
|
|
@@ -583,19 +582,19 @@ describe('Registration Tests', function () {
|
|
|
583
582
|
})));
|
|
584
583
|
});
|
|
585
584
|
describe('Registration failover tests', function () {
|
|
586
|
-
it('verify unreachable primary with reachable backup servers', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
587
|
-
return _regenerator.default.wrap(function
|
|
588
|
-
while (1) switch (
|
|
585
|
+
it('verify unreachable primary with reachable backup servers', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
|
|
586
|
+
return _regenerator.default.wrap(function _callee0$(_context0) {
|
|
587
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
589
588
|
case 0:
|
|
590
589
|
jest.useFakeTimers();
|
|
591
590
|
// try the primary twice and register successfully with backup servers
|
|
592
591
|
webex.request.mockRejectedValueOnce(failurePayload).mockRejectedValueOnce(failurePayload).mockResolvedValueOnce(successPayload);
|
|
593
592
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.IDLE);
|
|
594
|
-
|
|
593
|
+
_context0.next = 5;
|
|
595
594
|
return reg.triggerRegistration();
|
|
596
595
|
case 5:
|
|
597
596
|
jest.advanceTimersByTime(_constants.REG_TRY_BACKUP_TIMER_VAL_IN_SEC * _constants.SEC_TO_MSEC_MFACTOR);
|
|
598
|
-
|
|
597
|
+
_context0.next = 8;
|
|
599
598
|
return flushPromises();
|
|
600
599
|
case 8:
|
|
601
600
|
expect(webex.request).toBeCalledTimes(3);
|
|
@@ -613,13 +612,13 @@ describe('Registration Tests', function () {
|
|
|
613
612
|
expect(metricSpy).toHaveBeenNthCalledWith(3, _types5.METRIC_EVENT.REGISTRATION, _types5.REG_ACTION.REGISTER, _types5.METRIC_TYPE.BEHAVIORAL, _constants.FAILOVER_UTIL, 'BACKUP', 'webex-js-sdk_06bafdd0-2f9b-4cd7-b438-9c0d95ecec9b_15', undefined, undefined);
|
|
614
613
|
case 14:
|
|
615
614
|
case "end":
|
|
616
|
-
return
|
|
615
|
+
return _context0.stop();
|
|
617
616
|
}
|
|
618
|
-
},
|
|
617
|
+
}, _callee0);
|
|
619
618
|
})));
|
|
620
|
-
it('cc: verify unreachable primary with reachable backup server', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
621
|
-
return _regenerator.default.wrap(function
|
|
622
|
-
while (1) switch (
|
|
619
|
+
it('cc: verify unreachable primary with reachable backup server', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
620
|
+
return _regenerator.default.wrap(function _callee1$(_context1) {
|
|
621
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
623
622
|
case 0:
|
|
624
623
|
setupRegistration(_objectSpread(_objectSpread({}, MockServiceData), {}, {
|
|
625
624
|
indicator: _types.ServiceIndicator.CONTACT_CENTER
|
|
@@ -627,11 +626,11 @@ describe('Registration Tests', function () {
|
|
|
627
626
|
jest.useFakeTimers();
|
|
628
627
|
webex.request.mockRejectedValueOnce(failurePayload).mockRejectedValueOnce(failurePayload).mockResolvedValueOnce(successPayload);
|
|
629
628
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.IDLE);
|
|
630
|
-
|
|
629
|
+
_context1.next = 6;
|
|
631
630
|
return reg.triggerRegistration();
|
|
632
631
|
case 6:
|
|
633
632
|
jest.advanceTimersByTime(_constants.REG_TRY_BACKUP_TIMER_VAL_IN_SEC * _constants.SEC_TO_MSEC_MFACTOR);
|
|
634
|
-
|
|
633
|
+
_context1.next = 9;
|
|
635
634
|
return flushPromises();
|
|
636
635
|
case 9:
|
|
637
636
|
expect(webex.request).toBeCalledTimes(3);
|
|
@@ -648,27 +647,27 @@ describe('Registration Tests', function () {
|
|
|
648
647
|
expect(reg.getActiveMobiusUrl()).toEqual(mobiusUris.backup[0]);
|
|
649
648
|
case 14:
|
|
650
649
|
case "end":
|
|
651
|
-
return
|
|
650
|
+
return _context1.stop();
|
|
652
651
|
}
|
|
653
|
-
},
|
|
652
|
+
}, _callee1);
|
|
654
653
|
})));
|
|
655
|
-
it('verify unreachable primary and backup servers', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
656
|
-
return _regenerator.default.wrap(function
|
|
657
|
-
while (1) switch (
|
|
654
|
+
it('verify unreachable primary and backup servers', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
655
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
656
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
658
657
|
case 0:
|
|
659
658
|
jest.useFakeTimers();
|
|
660
659
|
// try the primary twice and register successfully with backup servers
|
|
661
660
|
webex.request.mockRejectedValue(failurePayload);
|
|
662
661
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.IDLE);
|
|
663
|
-
|
|
662
|
+
_context10.next = 5;
|
|
664
663
|
return reg.triggerRegistration();
|
|
665
664
|
case 5:
|
|
666
665
|
jest.advanceTimersByTime(_constants.REG_TRY_BACKUP_TIMER_VAL_IN_SEC * _constants.SEC_TO_MSEC_MFACTOR);
|
|
667
|
-
|
|
666
|
+
_context10.next = 8;
|
|
668
667
|
return flushPromises();
|
|
669
668
|
case 8:
|
|
670
669
|
jest.advanceTimersByTime(_constants.REG_TRY_BACKUP_TIMER_VAL_IN_SEC * _constants.SEC_TO_MSEC_MFACTOR);
|
|
671
|
-
|
|
670
|
+
_context10.next = 11;
|
|
672
671
|
return flushPromises();
|
|
673
672
|
case 11:
|
|
674
673
|
/*
|
|
@@ -693,27 +692,27 @@ describe('Registration Tests', function () {
|
|
|
693
692
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.INACTIVE);
|
|
694
693
|
case 17:
|
|
695
694
|
case "end":
|
|
696
|
-
return
|
|
695
|
+
return _context10.stop();
|
|
697
696
|
}
|
|
698
|
-
},
|
|
697
|
+
}, _callee10);
|
|
699
698
|
})));
|
|
700
699
|
});
|
|
701
700
|
describe('Registration failback tests', function () {
|
|
702
701
|
var isPrimaryActiveSpy;
|
|
703
|
-
beforeEach(
|
|
704
|
-
return _regenerator.default.wrap(function
|
|
705
|
-
while (1) switch (
|
|
702
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
703
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
704
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
706
705
|
case 0:
|
|
707
706
|
isPrimaryActiveSpy = jest.spyOn(reg, 'isPrimaryActive');
|
|
708
707
|
isPrimaryActiveSpy.mockReturnValue(true);
|
|
709
708
|
/* keep keepalive as active so that it wont interfere with the failback tests */
|
|
710
709
|
jest.useFakeTimers();
|
|
711
710
|
postRegistrationSpy.mockRejectedValueOnce(failurePayload).mockRejectedValueOnce(failurePayload).mockResolvedValueOnce(successPayload);
|
|
712
|
-
|
|
711
|
+
_context11.next = 6;
|
|
713
712
|
return reg.triggerRegistration();
|
|
714
713
|
case 6:
|
|
715
714
|
jest.advanceTimersByTime(_constants.REG_TRY_BACKUP_TIMER_VAL_IN_SEC * _constants.SEC_TO_MSEC_MFACTOR);
|
|
716
|
-
|
|
715
|
+
_context11.next = 9;
|
|
717
716
|
return flushPromises();
|
|
718
717
|
case 9:
|
|
719
718
|
reg.rehomingIntervalMin = _constants.DEFAULT_REHOMING_INTERVAL_MIN;
|
|
@@ -727,17 +726,17 @@ describe('Registration Tests', function () {
|
|
|
727
726
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.ACTIVE);
|
|
728
727
|
case 14:
|
|
729
728
|
case "end":
|
|
730
|
-
return
|
|
729
|
+
return _context11.stop();
|
|
731
730
|
}
|
|
732
|
-
},
|
|
731
|
+
}, _callee11);
|
|
733
732
|
})));
|
|
734
733
|
afterEach(function () {
|
|
735
734
|
jest.clearAllTimers();
|
|
736
735
|
jest.clearAllMocks();
|
|
737
736
|
});
|
|
738
|
-
it('verify 429 error with failback to primary after initial registration with backup: Restore failure', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
739
|
-
return _regenerator.default.wrap(function
|
|
740
|
-
while (1) switch (
|
|
737
|
+
it('verify 429 error with failback to primary after initial registration with backup: Restore failure', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
738
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
739
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
741
740
|
case 0:
|
|
742
741
|
// delete should be successful
|
|
743
742
|
global.fetch = jest.fn(function () {
|
|
@@ -751,7 +750,7 @@ describe('Registration Tests', function () {
|
|
|
751
750
|
|
|
752
751
|
/* Wait for failback to be triggered. */
|
|
753
752
|
jest.advanceTimersByTime(reg.rehomingIntervalMax * _constants.MINUTES_TO_SEC_MFACTOR * _constants.SEC_TO_MSEC_MFACTOR);
|
|
754
|
-
|
|
753
|
+
_context12.next = 5;
|
|
755
754
|
return flushPromises();
|
|
756
755
|
case 5:
|
|
757
756
|
expect(infoSpy).toBeCalledWith("Attempting failback to primary.", {
|
|
@@ -759,7 +758,7 @@ describe('Registration Tests', function () {
|
|
|
759
758
|
file: _constants.REGISTRATION_FILE
|
|
760
759
|
});
|
|
761
760
|
jest.advanceTimersByTime(10000);
|
|
762
|
-
|
|
761
|
+
_context12.next = 9;
|
|
763
762
|
return flushPromises();
|
|
764
763
|
case 9:
|
|
765
764
|
expect(retry429Spy).toBeCalledWith(failurePayload429Two.headers['retry-after'], 'executeFailback');
|
|
@@ -772,19 +771,19 @@ describe('Registration Tests', function () {
|
|
|
772
771
|
expect(reg.rehomingIntervalMax).toBe(_constants.DEFAULT_REHOMING_INTERVAL_MAX);
|
|
773
772
|
case 17:
|
|
774
773
|
case "end":
|
|
775
|
-
return
|
|
774
|
+
return _context12.stop();
|
|
776
775
|
}
|
|
777
|
-
},
|
|
776
|
+
}, _callee12);
|
|
778
777
|
})));
|
|
779
|
-
it('verify unsuccessful failback to primary after initial registration with backup: Restore failure', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
780
|
-
return _regenerator.default.wrap(function
|
|
781
|
-
while (1) switch (
|
|
778
|
+
it('verify unsuccessful failback to primary after initial registration with backup: Restore failure', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
779
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
780
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
782
781
|
case 0:
|
|
783
782
|
postRegistrationSpy.mockRejectedValue(failurePayload);
|
|
784
783
|
|
|
785
784
|
/* Wait for failback to be triggered. */
|
|
786
785
|
jest.advanceTimersByTime(reg.rehomingIntervalMax * _constants.MINUTES_TO_SEC_MFACTOR * _constants.SEC_TO_MSEC_MFACTOR);
|
|
787
|
-
|
|
786
|
+
_context13.next = 4;
|
|
788
787
|
return flushPromises();
|
|
789
788
|
case 4:
|
|
790
789
|
expect(infoSpy).toBeCalledWith("Attempting failback to primary.", {
|
|
@@ -799,14 +798,14 @@ describe('Registration Tests', function () {
|
|
|
799
798
|
expect(reg.rehomingIntervalMax).toBe(_constants.DEFAULT_REHOMING_INTERVAL_MAX);
|
|
800
799
|
case 11:
|
|
801
800
|
case "end":
|
|
802
|
-
return
|
|
801
|
+
return _context13.stop();
|
|
803
802
|
}
|
|
804
|
-
},
|
|
803
|
+
}, _callee13);
|
|
805
804
|
})));
|
|
806
|
-
it('verify unsuccessful failback to primary after initial registration with backup: Restore failure with final error', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
805
|
+
it('verify unsuccessful failback to primary after initial registration with backup: Restore failure with final error', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
807
806
|
var finalErrorPayload;
|
|
808
|
-
return _regenerator.default.wrap(function
|
|
809
|
-
while (1) switch (
|
|
807
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
808
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
810
809
|
case 0:
|
|
811
810
|
finalErrorPayload = {
|
|
812
811
|
statusCode: 401,
|
|
@@ -816,7 +815,7 @@ describe('Registration Tests', function () {
|
|
|
816
815
|
postRegistrationSpy.mockRejectedValue(finalErrorPayload).mockRejectedValueOnce(failurePayload);
|
|
817
816
|
/* Wait for failback to be triggered. */
|
|
818
817
|
jest.advanceTimersByTime(reg.rehomingIntervalMax * _constants.MINUTES_TO_SEC_MFACTOR * _constants.SEC_TO_MSEC_MFACTOR);
|
|
819
|
-
|
|
818
|
+
_context14.next = 6;
|
|
820
819
|
return flushPromises();
|
|
821
820
|
case 6:
|
|
822
821
|
expect(infoSpy).toBeCalledWith("Attempting failback to primary.", {
|
|
@@ -831,19 +830,19 @@ describe('Registration Tests', function () {
|
|
|
831
830
|
expect(reg.rehomingIntervalMax).toBe(_constants.DEFAULT_REHOMING_INTERVAL_MAX);
|
|
832
831
|
case 13:
|
|
833
832
|
case "end":
|
|
834
|
-
return
|
|
833
|
+
return _context14.stop();
|
|
835
834
|
}
|
|
836
|
-
},
|
|
835
|
+
}, _callee14);
|
|
837
836
|
})));
|
|
838
|
-
it('verify unsuccessful failback to primary after initial registration with backup: Restore success', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
839
|
-
return _regenerator.default.wrap(function
|
|
840
|
-
while (1) switch (
|
|
837
|
+
it('verify unsuccessful failback to primary after initial registration with backup: Restore success', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
838
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
839
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
841
840
|
case 0:
|
|
842
841
|
postRegistrationSpy.mockRejectedValueOnce(failurePayload).mockResolvedValue(successPayload);
|
|
843
842
|
|
|
844
843
|
/* Wait for failback to be triggered. */
|
|
845
844
|
jest.advanceTimersByTime(reg.rehomingIntervalMax * _constants.MINUTES_TO_SEC_MFACTOR * _constants.SEC_TO_MSEC_MFACTOR);
|
|
846
|
-
|
|
845
|
+
_context15.next = 4;
|
|
847
846
|
return flushPromises();
|
|
848
847
|
case 4:
|
|
849
848
|
expect(infoSpy).toBeCalledWith("Attempting failback to primary.", {
|
|
@@ -859,19 +858,19 @@ describe('Registration Tests', function () {
|
|
|
859
858
|
expect(reg.rehomingIntervalMax).toBe(_constants.DEFAULT_REHOMING_INTERVAL_MAX);
|
|
860
859
|
case 11:
|
|
861
860
|
case "end":
|
|
862
|
-
return
|
|
861
|
+
return _context15.stop();
|
|
863
862
|
}
|
|
864
|
-
},
|
|
863
|
+
}, _callee15);
|
|
865
864
|
})));
|
|
866
|
-
it('verify successful failback to primary after initial registration with backup', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
867
|
-
return _regenerator.default.wrap(function
|
|
868
|
-
while (1) switch (
|
|
865
|
+
it('verify successful failback to primary after initial registration with backup', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
866
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
867
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
869
868
|
case 0:
|
|
870
869
|
postRegistrationSpy.mockResolvedValue(successPayload);
|
|
871
870
|
|
|
872
871
|
/* Wait for failback to be triggered. */
|
|
873
872
|
jest.advanceTimersByTime(reg.rehomingIntervalMax * _constants.MINUTES_TO_SEC_MFACTOR * _constants.SEC_TO_MSEC_MFACTOR);
|
|
874
|
-
|
|
873
|
+
_context16.next = 4;
|
|
875
874
|
return flushPromises();
|
|
876
875
|
case 4:
|
|
877
876
|
expect(infoSpy).toBeCalledWith("Attempting failback to primary.", {
|
|
@@ -889,13 +888,13 @@ describe('Registration Tests', function () {
|
|
|
889
888
|
expect(reg.rehomingIntervalMax).toBe(_registerFixtures.mockPostResponse.rehomingIntervalMax);
|
|
890
889
|
case 12:
|
|
891
890
|
case "end":
|
|
892
|
-
return
|
|
891
|
+
return _context16.stop();
|
|
893
892
|
}
|
|
894
|
-
},
|
|
893
|
+
}, _callee16);
|
|
895
894
|
})));
|
|
896
|
-
it('verify unsuccessful failback attempt due to active call', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
897
|
-
return _regenerator.default.wrap(function
|
|
898
|
-
while (1) switch (
|
|
895
|
+
it('verify unsuccessful failback attempt due to active call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
896
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
897
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
899
898
|
case 0:
|
|
900
899
|
/** create a new call */
|
|
901
900
|
reg.callManager.createCall();
|
|
@@ -904,7 +903,7 @@ describe('Registration Tests', function () {
|
|
|
904
903
|
|
|
905
904
|
/* Wait for failback to be triggered. */
|
|
906
905
|
jest.advanceTimersByTime(reg.rehomingIntervalMax * _constants.MINUTES_TO_SEC_MFACTOR * _constants.SEC_TO_MSEC_MFACTOR);
|
|
907
|
-
|
|
906
|
+
_context17.next = 6;
|
|
908
907
|
return flushPromises();
|
|
909
908
|
case 6:
|
|
910
909
|
expect(infoSpy).toBeCalledWith("Active calls present or primary Mobius is down, deferring failback to next cycle.", {
|
|
@@ -926,19 +925,19 @@ describe('Registration Tests', function () {
|
|
|
926
925
|
expect(reg.rehomingIntervalMax).toBe(_constants.DEFAULT_REHOMING_INTERVAL_MAX);
|
|
927
926
|
case 15:
|
|
928
927
|
case "end":
|
|
929
|
-
return
|
|
928
|
+
return _context17.stop();
|
|
930
929
|
}
|
|
931
|
-
},
|
|
930
|
+
}, _callee17);
|
|
932
931
|
})));
|
|
933
|
-
it('verify unsuccessful failback attempt due to primary server being down', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
934
|
-
return _regenerator.default.wrap(function
|
|
935
|
-
while (1) switch (
|
|
932
|
+
it('verify unsuccessful failback attempt due to primary server being down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
933
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
934
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
936
935
|
case 0:
|
|
937
936
|
isPrimaryActiveSpy.mockReturnValue(false);
|
|
938
937
|
|
|
939
938
|
/* Wait for failback to be triggered. */
|
|
940
939
|
jest.advanceTimersByTime(reg.rehomingIntervalMax * _constants.MINUTES_TO_SEC_MFACTOR * _constants.SEC_TO_MSEC_MFACTOR);
|
|
941
|
-
|
|
940
|
+
_context18.next = 4;
|
|
942
941
|
return flushPromises();
|
|
943
942
|
case 4:
|
|
944
943
|
expect(infoSpy).toBeCalledWith("Active calls present or primary Mobius is down, deferring failback to next cycle.", {
|
|
@@ -952,34 +951,34 @@ describe('Registration Tests', function () {
|
|
|
952
951
|
expect(reg.getStatus()).toBe(_types.RegistrationStatus.ACTIVE);
|
|
953
952
|
case 8:
|
|
954
953
|
case "end":
|
|
955
|
-
return
|
|
954
|
+
return _context18.stop();
|
|
956
955
|
}
|
|
957
|
-
},
|
|
956
|
+
}, _callee18);
|
|
958
957
|
})));
|
|
959
958
|
});
|
|
960
959
|
|
|
961
960
|
// Keep-alive related test cases
|
|
962
961
|
describe('Keep-alive Tests', function () {
|
|
963
962
|
var beforeEachSetupForKeepalive = /*#__PURE__*/function () {
|
|
964
|
-
var
|
|
965
|
-
return _regenerator.default.wrap(function
|
|
966
|
-
while (1) switch (
|
|
963
|
+
var _ref19 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
964
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
965
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
967
966
|
case 0:
|
|
968
967
|
postRegistrationSpy.mockResolvedValueOnce(successPayload);
|
|
969
968
|
jest.useFakeTimers();
|
|
970
|
-
|
|
969
|
+
_context19.next = 4;
|
|
971
970
|
return reg.triggerRegistration();
|
|
972
971
|
case 4:
|
|
973
972
|
expect(reg.getStatus()).toBe(_types.RegistrationStatus.ACTIVE);
|
|
974
973
|
expect(reg.webWorker).toBeDefined();
|
|
975
974
|
case 6:
|
|
976
975
|
case "end":
|
|
977
|
-
return
|
|
976
|
+
return _context19.stop();
|
|
978
977
|
}
|
|
979
|
-
},
|
|
978
|
+
}, _callee19);
|
|
980
979
|
}));
|
|
981
980
|
return function beforeEachSetupForKeepalive() {
|
|
982
|
-
return
|
|
981
|
+
return _ref19.apply(this, arguments);
|
|
983
982
|
};
|
|
984
983
|
}();
|
|
985
984
|
afterEach(function () {
|
|
@@ -992,13 +991,13 @@ describe('Registration Tests', function () {
|
|
|
992
991
|
call.end();
|
|
993
992
|
});
|
|
994
993
|
});
|
|
995
|
-
it('verify successful keep-alive cases', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
994
|
+
it('verify successful keep-alive cases', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
996
995
|
var postMessageSpy;
|
|
997
|
-
return _regenerator.default.wrap(function
|
|
998
|
-
while (1) switch (
|
|
996
|
+
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
997
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
999
998
|
case 0:
|
|
1000
999
|
postMessageSpy = jest.spyOn(Worker.prototype, 'postMessage');
|
|
1001
|
-
|
|
1000
|
+
_context20.next = 3;
|
|
1002
1001
|
return beforeEachSetupForKeepalive();
|
|
1003
1002
|
case 3:
|
|
1004
1003
|
expect(reg.webWorker).toBeDefined();
|
|
@@ -1019,16 +1018,16 @@ describe('Registration Tests', function () {
|
|
|
1019
1018
|
expect(lineEmitter).toBeCalledWith(_types4.LINE_EVENTS.RECONNECTED);
|
|
1020
1019
|
case 7:
|
|
1021
1020
|
case "end":
|
|
1022
|
-
return
|
|
1021
|
+
return _context20.stop();
|
|
1023
1022
|
}
|
|
1024
|
-
},
|
|
1023
|
+
}, _callee20);
|
|
1025
1024
|
})));
|
|
1026
|
-
it('verify failure keep-alive cases: Retry Success', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1025
|
+
it('verify failure keep-alive cases: Retry Success', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
1027
1026
|
var worker;
|
|
1028
|
-
return _regenerator.default.wrap(function
|
|
1029
|
-
while (1) switch (
|
|
1027
|
+
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
1028
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1030
1029
|
case 0:
|
|
1031
|
-
|
|
1030
|
+
_context21.next = 2;
|
|
1032
1031
|
return beforeEachSetupForKeepalive();
|
|
1033
1032
|
case 2:
|
|
1034
1033
|
worker = reg.webWorker;
|
|
@@ -1051,16 +1050,16 @@ describe('Registration Tests', function () {
|
|
|
1051
1050
|
expect(lineEmitter).toHaveBeenCalledWith(_types4.LINE_EVENTS.RECONNECTED);
|
|
1052
1051
|
case 7:
|
|
1053
1052
|
case "end":
|
|
1054
|
-
return
|
|
1053
|
+
return _context21.stop();
|
|
1055
1054
|
}
|
|
1056
|
-
},
|
|
1055
|
+
}, _callee21);
|
|
1057
1056
|
})));
|
|
1058
|
-
it('verify failure keep-alive cases: Restore failure', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1057
|
+
it('verify failure keep-alive cases: Restore failure', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
1059
1058
|
var reconnectSpy, restoreSpy, restartRegSpy, RETRY_COUNT_THRESHOLD, failureEvent;
|
|
1060
|
-
return _regenerator.default.wrap(function
|
|
1061
|
-
while (1) switch (
|
|
1059
|
+
return _regenerator.default.wrap(function _callee22$(_context22) {
|
|
1060
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1062
1061
|
case 0:
|
|
1063
|
-
|
|
1062
|
+
_context22.next = 2;
|
|
1064
1063
|
return beforeEachSetupForKeepalive();
|
|
1065
1064
|
case 2:
|
|
1066
1065
|
reconnectSpy = jest.spyOn(reg, 'reconnectOnFailure');
|
|
@@ -1087,7 +1086,7 @@ describe('Registration Tests', function () {
|
|
|
1087
1086
|
}
|
|
1088
1087
|
};
|
|
1089
1088
|
reg.webWorker.onmessage(failureEvent);
|
|
1090
|
-
|
|
1089
|
+
_context22.next = 14;
|
|
1091
1090
|
return flushPromises();
|
|
1092
1091
|
case 14:
|
|
1093
1092
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.INACTIVE);
|
|
@@ -1102,16 +1101,16 @@ describe('Registration Tests', function () {
|
|
|
1102
1101
|
}));
|
|
1103
1102
|
case 21:
|
|
1104
1103
|
case "end":
|
|
1105
|
-
return
|
|
1104
|
+
return _context22.stop();
|
|
1106
1105
|
}
|
|
1107
|
-
},
|
|
1106
|
+
}, _callee22);
|
|
1108
1107
|
})));
|
|
1109
|
-
it('verify failure keep-alive cases: Restore Success', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1108
|
+
it('verify failure keep-alive cases: Restore Success', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
1110
1109
|
var reconnectSpy, url;
|
|
1111
|
-
return _regenerator.default.wrap(function
|
|
1112
|
-
while (1) switch (
|
|
1110
|
+
return _regenerator.default.wrap(function _callee23$(_context23) {
|
|
1111
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1113
1112
|
case 0:
|
|
1114
|
-
|
|
1113
|
+
_context23.next = 2;
|
|
1115
1114
|
return beforeEachSetupForKeepalive();
|
|
1116
1115
|
case 2:
|
|
1117
1116
|
expect(reg.webWorker).toBeDefined();
|
|
@@ -1127,16 +1126,16 @@ describe('Registration Tests', function () {
|
|
|
1127
1126
|
}
|
|
1128
1127
|
});
|
|
1129
1128
|
jest.advanceTimersByTime(1000);
|
|
1130
|
-
|
|
1129
|
+
_context23.next = 9;
|
|
1131
1130
|
return flushPromises();
|
|
1132
1131
|
case 9:
|
|
1133
1132
|
expect(reg.webWorker).toBeUndefined();
|
|
1134
1133
|
expect(reconnectSpy).toBeCalledOnceWith(reg.startKeepaliveTimer.name);
|
|
1135
1134
|
webex.request.mockResolvedValueOnce(successPayload);
|
|
1136
|
-
|
|
1135
|
+
_context23.next = 14;
|
|
1137
1136
|
return reg.triggerRegistration();
|
|
1138
1137
|
case 14:
|
|
1139
|
-
|
|
1138
|
+
_context23.next = 16;
|
|
1140
1139
|
return flushPromises();
|
|
1141
1140
|
case 16:
|
|
1142
1141
|
expect(reg.webWorker).toBeDefined();
|
|
@@ -1149,7 +1148,7 @@ describe('Registration Tests', function () {
|
|
|
1149
1148
|
|
|
1150
1149
|
// Advance timers and flush any remaining promises.
|
|
1151
1150
|
jest.advanceTimersByTime(1000);
|
|
1152
|
-
|
|
1151
|
+
_context23.next = 21;
|
|
1153
1152
|
return flushPromises();
|
|
1154
1153
|
case 21:
|
|
1155
1154
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.ACTIVE);
|
|
@@ -1161,15 +1160,15 @@ describe('Registration Tests', function () {
|
|
|
1161
1160
|
expect(reg.getActiveMobiusUrl()).toStrictEqual(url);
|
|
1162
1161
|
case 26:
|
|
1163
1162
|
case "end":
|
|
1164
|
-
return
|
|
1163
|
+
return _context23.stop();
|
|
1165
1164
|
}
|
|
1166
|
-
},
|
|
1165
|
+
}, _callee23);
|
|
1167
1166
|
})));
|
|
1168
|
-
it('verify failure followed by recovery of keepalive', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1169
|
-
return _regenerator.default.wrap(function
|
|
1170
|
-
while (1) switch (
|
|
1167
|
+
it('verify failure followed by recovery of keepalive', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
1168
|
+
return _regenerator.default.wrap(function _callee24$(_context24) {
|
|
1169
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1171
1170
|
case 0:
|
|
1172
|
-
|
|
1171
|
+
_context24.next = 2;
|
|
1173
1172
|
return beforeEachSetupForKeepalive();
|
|
1174
1173
|
case 2:
|
|
1175
1174
|
expect(reg.getStatus()).toBe(_types.RegistrationStatus.ACTIVE);
|
|
@@ -1182,15 +1181,15 @@ describe('Registration Tests', function () {
|
|
|
1182
1181
|
keepAliveRetryCount: reg.isCCFlow ? 4 : 5
|
|
1183
1182
|
}
|
|
1184
1183
|
});
|
|
1185
|
-
|
|
1184
|
+
_context24.next = 8;
|
|
1186
1185
|
return flushPromises();
|
|
1187
1186
|
case 8:
|
|
1188
1187
|
expect(reg.webWorker).toBeUndefined();
|
|
1189
1188
|
expect(handleErrorSpy).toBeCalledTimes(3);
|
|
1190
|
-
|
|
1189
|
+
_context24.next = 12;
|
|
1191
1190
|
return reg.triggerRegistration();
|
|
1192
1191
|
case 12:
|
|
1193
|
-
|
|
1192
|
+
_context24.next = 14;
|
|
1194
1193
|
return flushPromises();
|
|
1195
1194
|
case 14:
|
|
1196
1195
|
expect(reg.webWorker).toBeDefined();
|
|
@@ -1200,7 +1199,7 @@ describe('Registration Tests', function () {
|
|
|
1200
1199
|
statusCode: 200
|
|
1201
1200
|
}
|
|
1202
1201
|
});
|
|
1203
|
-
|
|
1202
|
+
_context24.next = 18;
|
|
1204
1203
|
return flushPromises();
|
|
1205
1204
|
case 18:
|
|
1206
1205
|
// In a complete failure‐then-recovery scenario, we expect another failure event to have been handled.
|
|
@@ -1212,16 +1211,16 @@ describe('Registration Tests', function () {
|
|
|
1212
1211
|
keepAliveRetryCount: reg.isCCFlow ? 4 : 5
|
|
1213
1212
|
}
|
|
1214
1213
|
});
|
|
1215
|
-
|
|
1214
|
+
_context24.next = 21;
|
|
1216
1215
|
return flushPromises();
|
|
1217
1216
|
case 21:
|
|
1218
1217
|
expect(handleErrorSpy).toBeCalledTimes(4);
|
|
1219
1218
|
|
|
1220
1219
|
// And then re-register successfully:
|
|
1221
|
-
|
|
1220
|
+
_context24.next = 24;
|
|
1222
1221
|
return reg.triggerRegistration();
|
|
1223
1222
|
case 24:
|
|
1224
|
-
|
|
1223
|
+
_context24.next = 26;
|
|
1225
1224
|
return flushPromises();
|
|
1226
1225
|
case 26:
|
|
1227
1226
|
expect(reg.webWorker).toBeDefined();
|
|
@@ -1231,31 +1230,31 @@ describe('Registration Tests', function () {
|
|
|
1231
1230
|
statusCode: 200
|
|
1232
1231
|
}
|
|
1233
1232
|
});
|
|
1234
|
-
|
|
1233
|
+
_context24.next = 30;
|
|
1235
1234
|
return flushPromises();
|
|
1236
1235
|
case 30:
|
|
1237
1236
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.ACTIVE);
|
|
1238
1237
|
expect(reg.webWorker).toBeDefined();
|
|
1239
1238
|
case 32:
|
|
1240
1239
|
case "end":
|
|
1241
|
-
return
|
|
1240
|
+
return _context24.stop();
|
|
1242
1241
|
}
|
|
1243
|
-
},
|
|
1242
|
+
}, _callee24);
|
|
1244
1243
|
})));
|
|
1245
|
-
it('cc: verify failover to backup server after 4 keep alive failure with primary server', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1244
|
+
it('cc: verify failover to backup server after 4 keep alive failure with primary server', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
1246
1245
|
var clearKeepaliveSpy, reconnectSpy;
|
|
1247
|
-
return _regenerator.default.wrap(function
|
|
1248
|
-
while (1) switch (
|
|
1246
|
+
return _regenerator.default.wrap(function _callee25$(_context25) {
|
|
1247
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1249
1248
|
case 0:
|
|
1250
1249
|
// Register with contact center service
|
|
1251
1250
|
setupRegistration(_objectSpread(_objectSpread({}, MockServiceData), {}, {
|
|
1252
1251
|
indicator: _types.ServiceIndicator.CONTACT_CENTER
|
|
1253
1252
|
}));
|
|
1254
|
-
|
|
1253
|
+
_context25.next = 3;
|
|
1255
1254
|
return beforeEachSetupForKeepalive();
|
|
1256
1255
|
case 3:
|
|
1257
1256
|
webex.request.mockResolvedValueOnce(successPayload);
|
|
1258
|
-
|
|
1257
|
+
_context25.next = 6;
|
|
1259
1258
|
return reg.triggerRegistration();
|
|
1260
1259
|
case 6:
|
|
1261
1260
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.ACTIVE);
|
|
@@ -1275,7 +1274,7 @@ describe('Registration Tests', function () {
|
|
|
1275
1274
|
});
|
|
1276
1275
|
|
|
1277
1276
|
// Wait for any asynchronous actions to complete
|
|
1278
|
-
|
|
1277
|
+
_context25.next = 13;
|
|
1279
1278
|
return flushPromises();
|
|
1280
1279
|
case 13:
|
|
1281
1280
|
// Verify that the keepalive timer was cleared and reconnectOnFailure was triggered
|
|
@@ -1287,16 +1286,16 @@ describe('Registration Tests', function () {
|
|
|
1287
1286
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.ACTIVE);
|
|
1288
1287
|
case 17:
|
|
1289
1288
|
case "end":
|
|
1290
|
-
return
|
|
1289
|
+
return _context25.stop();
|
|
1291
1290
|
}
|
|
1292
|
-
},
|
|
1291
|
+
}, _callee25);
|
|
1293
1292
|
})));
|
|
1294
|
-
it('verify failure keep-alive case with active call present: Restore Success after call ends', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1293
|
+
it('verify failure keep-alive case with active call present: Restore Success after call ends', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
1295
1294
|
var reconnectSpy, restoreSpy, restartRegSpy, clearTimerSpy, threshold, failureEvent;
|
|
1296
|
-
return _regenerator.default.wrap(function
|
|
1297
|
-
while (1) switch (
|
|
1295
|
+
return _regenerator.default.wrap(function _callee26$(_context26) {
|
|
1296
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1298
1297
|
case 0:
|
|
1299
|
-
|
|
1298
|
+
_context26.next = 2;
|
|
1300
1299
|
return beforeEachSetupForKeepalive();
|
|
1301
1300
|
case 2:
|
|
1302
1301
|
reconnectSpy = jest.spyOn(reg, 'reconnectOnFailure');
|
|
@@ -1316,7 +1315,7 @@ describe('Registration Tests', function () {
|
|
|
1316
1315
|
}
|
|
1317
1316
|
};
|
|
1318
1317
|
reg.webWorker.onmessage(failureEvent);
|
|
1319
|
-
|
|
1318
|
+
_context26.next = 13;
|
|
1320
1319
|
return flushPromises();
|
|
1321
1320
|
case 13:
|
|
1322
1321
|
// At this point, clearKeepaliveTimer was called so the worker is terminated.
|
|
@@ -1341,10 +1340,10 @@ describe('Registration Tests', function () {
|
|
|
1341
1340
|
webex.request.mockResolvedValueOnce(successPayload);
|
|
1342
1341
|
|
|
1343
1342
|
// Call reconnectOnFailure manually. With no active calls, this should trigger re-registration.
|
|
1344
|
-
|
|
1343
|
+
_context26.next = 29;
|
|
1345
1344
|
return reg.reconnectOnFailure(_constants.CALLS_CLEARED_HANDLER_UTIL);
|
|
1346
1345
|
case 29:
|
|
1347
|
-
|
|
1346
|
+
_context26.next = 31;
|
|
1348
1347
|
return flushPromises();
|
|
1349
1348
|
case 31:
|
|
1350
1349
|
expect((0, _keys.default)(reg.callManager.getActiveCalls()).length).toBe(0);
|
|
@@ -1357,23 +1356,25 @@ describe('Registration Tests', function () {
|
|
|
1357
1356
|
expect(reg.reconnectPending).toStrictEqual(false);
|
|
1358
1357
|
case 38:
|
|
1359
1358
|
case "end":
|
|
1360
|
-
return
|
|
1359
|
+
return _context26.stop();
|
|
1361
1360
|
}
|
|
1362
|
-
},
|
|
1361
|
+
}, _callee26);
|
|
1363
1362
|
})));
|
|
1364
|
-
it('checks for keep-alive failure with final error: 404', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1365
|
-
var reconnectSpy, restoreSpy, restartRegSpy, clearTimerSpy;
|
|
1366
|
-
return _regenerator.default.wrap(function
|
|
1367
|
-
while (1) switch (
|
|
1363
|
+
it('checks for keep-alive failure with final error: 404', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
|
|
1364
|
+
var reconnectSpy, restoreSpy, restartRegSpy, clearTimerSpy, handle404CbSpy, registerSpy;
|
|
1365
|
+
return _regenerator.default.wrap(function _callee27$(_context27) {
|
|
1366
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1368
1367
|
case 0:
|
|
1369
|
-
|
|
1368
|
+
_context27.next = 2;
|
|
1370
1369
|
return beforeEachSetupForKeepalive();
|
|
1371
1370
|
case 2:
|
|
1371
|
+
webex.request.mockResolvedValueOnce(successPayload);
|
|
1372
1372
|
reconnectSpy = jest.spyOn(reg, 'reconnectOnFailure');
|
|
1373
1373
|
restoreSpy = jest.spyOn(reg, 'restorePreviousRegistration');
|
|
1374
1374
|
restartRegSpy = jest.spyOn(reg, 'restartRegistration');
|
|
1375
1375
|
clearTimerSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
1376
|
-
jest.spyOn(
|
|
1376
|
+
handle404CbSpy = jest.spyOn(reg, 'handle404KeepaliveFailure');
|
|
1377
|
+
registerSpy = jest.spyOn(reg, 'attemptRegistrationWithServers');
|
|
1377
1378
|
reg.webWorker.onmessage({
|
|
1378
1379
|
data: {
|
|
1379
1380
|
type: _types.WorkerMessageType.KEEPALIVE_FAILURE,
|
|
@@ -1383,9 +1384,9 @@ describe('Registration Tests', function () {
|
|
|
1383
1384
|
keepAliveRetryCount: 1
|
|
1384
1385
|
}
|
|
1385
1386
|
});
|
|
1386
|
-
|
|
1387
|
+
_context27.next = 12;
|
|
1387
1388
|
return flushPromises();
|
|
1388
|
-
case
|
|
1389
|
+
case 12:
|
|
1389
1390
|
expect(warnSpy).toBeCalledWith('Keep-alive missed 1 times. Status -> 404 ', expect.objectContaining({
|
|
1390
1391
|
file: _constants.REGISTRATION_FILE,
|
|
1391
1392
|
method: 'startKeepaliveTimer'
|
|
@@ -1395,37 +1396,107 @@ describe('Registration Tests', function () {
|
|
|
1395
1396
|
}, expect.anything(), {
|
|
1396
1397
|
file: _constants.REGISTRATION_FILE,
|
|
1397
1398
|
method: _constants.KEEPALIVE_UTIL
|
|
1398
|
-
});
|
|
1399
|
-
expect(
|
|
1399
|
+
}, expect.anything());
|
|
1400
|
+
expect(lineEmitter).toHaveBeenCalledWith(_types4.LINE_EVENTS.ERROR, undefined, expect.anything());
|
|
1400
1401
|
expect(lineEmitter).toHaveBeenCalledWith(_types4.LINE_EVENTS.UNREGISTERED);
|
|
1401
|
-
expect(clearTimerSpy).toBeCalledTimes(
|
|
1402
|
+
expect(clearTimerSpy).toBeCalledTimes(2);
|
|
1402
1403
|
expect(reconnectSpy).not.toHaveBeenCalled();
|
|
1403
1404
|
expect(restoreSpy).not.toHaveBeenCalled();
|
|
1404
1405
|
expect(restartRegSpy).not.toHaveBeenCalled();
|
|
1405
1406
|
expect(reg.reconnectPending).toStrictEqual(false);
|
|
1407
|
+
expect(handle404CbSpy).toBeCalledOnceWith(_constants.KEEPALIVE_UTIL);
|
|
1408
|
+
expect(registerSpy).toBeCalledOnceWith(_constants.KEEPALIVE_UTIL);
|
|
1409
|
+
case 23:
|
|
1410
|
+
case "end":
|
|
1411
|
+
return _context27.stop();
|
|
1412
|
+
}
|
|
1413
|
+
}, _callee27);
|
|
1414
|
+
})));
|
|
1415
|
+
it('checks for keep-alive failure with 429', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
|
|
1416
|
+
var _reg$deviceInfo$devic;
|
|
1417
|
+
var keepaliveSpy, postMessageSpy, clearTimerSpy, retry429Spy;
|
|
1418
|
+
return _regenerator.default.wrap(function _callee28$(_context28) {
|
|
1419
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1420
|
+
case 0:
|
|
1421
|
+
_context28.next = 2;
|
|
1422
|
+
return beforeEachSetupForKeepalive();
|
|
1423
|
+
case 2:
|
|
1424
|
+
keepaliveSpy = jest.spyOn(reg, 'startKeepaliveTimer');
|
|
1425
|
+
postMessageSpy = jest.spyOn(Worker.prototype, 'postMessage');
|
|
1426
|
+
clearTimerSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
1427
|
+
retry429Spy = jest.spyOn(reg, 'handle429Retry');
|
|
1428
|
+
reg.webWorker.onmessage({
|
|
1429
|
+
data: {
|
|
1430
|
+
type: _types.WorkerMessageType.KEEPALIVE_FAILURE,
|
|
1431
|
+
err: {
|
|
1432
|
+
statusCode: 429,
|
|
1433
|
+
headers: {
|
|
1434
|
+
'retry-after': 20
|
|
1435
|
+
}
|
|
1436
|
+
},
|
|
1437
|
+
keepAliveRetryCount: 1
|
|
1438
|
+
}
|
|
1439
|
+
});
|
|
1440
|
+
_context28.next = 9;
|
|
1441
|
+
return flushPromises();
|
|
1442
|
+
case 9:
|
|
1443
|
+
expect(warnSpy).toBeCalledWith('Keep-alive missed 1 times. Status -> 429 ', expect.objectContaining({
|
|
1444
|
+
file: _constants.REGISTRATION_FILE,
|
|
1445
|
+
method: 'startKeepaliveTimer'
|
|
1446
|
+
}));
|
|
1447
|
+
expect(handleErrorSpy).toBeCalledOnceWith({
|
|
1448
|
+
statusCode: 429,
|
|
1449
|
+
headers: {
|
|
1450
|
+
'retry-after': 20
|
|
1451
|
+
}
|
|
1452
|
+
}, expect.anything(), {
|
|
1453
|
+
file: _constants.REGISTRATION_FILE,
|
|
1454
|
+
method: _constants.KEEPALIVE_UTIL
|
|
1455
|
+
}, expect.anything());
|
|
1456
|
+
expect(retry429Spy).toBeCalledOnceWith(20, 'startKeepaliveTimer');
|
|
1457
|
+
expect(clearTimerSpy).toBeCalledTimes(1);
|
|
1458
|
+
expect(reg.reconnectPending).toStrictEqual(false);
|
|
1406
1459
|
expect(reg.keepaliveTimer).toBe(undefined);
|
|
1407
1460
|
expect(reg.webWorker).toBeUndefined();
|
|
1408
|
-
|
|
1461
|
+
jest.advanceTimersByTime(20 * _constants.SEC_TO_MSEC_MFACTOR);
|
|
1462
|
+
_context28.next = 19;
|
|
1463
|
+
return flushPromises();
|
|
1464
|
+
case 19:
|
|
1465
|
+
expect(keepaliveSpy).toBeCalledOnceWith((_reg$deviceInfo$devic = reg.deviceInfo.device) === null || _reg$deviceInfo$devic === void 0 ? void 0 : _reg$deviceInfo$devic.uri, reg.deviceInfo.keepaliveInterval, 'UNKNOWN');
|
|
1466
|
+
expect(logSpy).toBeCalledWith('Resuming keepalive after 20 seconds', {
|
|
1467
|
+
file: _constants.REGISTRATION_FILE,
|
|
1468
|
+
method: 'handle429Retry'
|
|
1469
|
+
});
|
|
1470
|
+
expect(reg.webWorker).toBeDefined();
|
|
1471
|
+
expect(postMessageSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
1472
|
+
type: 'START_KEEPALIVE',
|
|
1473
|
+
accessToken: expect.any(String),
|
|
1474
|
+
deviceUrl: expect.any(String),
|
|
1475
|
+
interval: expect.any(Number),
|
|
1476
|
+
retryCountThreshold: expect.any(Number),
|
|
1477
|
+
url: expect.any(String)
|
|
1478
|
+
}));
|
|
1479
|
+
case 23:
|
|
1409
1480
|
case "end":
|
|
1410
|
-
return
|
|
1481
|
+
return _context28.stop();
|
|
1411
1482
|
}
|
|
1412
|
-
},
|
|
1483
|
+
}, _callee28);
|
|
1413
1484
|
})));
|
|
1414
1485
|
});
|
|
1415
1486
|
describe('Primary server status checks', function () {
|
|
1416
|
-
it('success: primary server status to be up', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1487
|
+
it('success: primary server status to be up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
|
|
1417
1488
|
var pingSuccessPayload, status;
|
|
1418
|
-
return _regenerator.default.wrap(function
|
|
1419
|
-
while (1) switch (
|
|
1489
|
+
return _regenerator.default.wrap(function _callee29$(_context29) {
|
|
1490
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1420
1491
|
case 0:
|
|
1421
1492
|
pingSuccessPayload = {
|
|
1422
1493
|
statusCode: 200
|
|
1423
1494
|
};
|
|
1424
1495
|
webex.request.mockResolvedValue(pingSuccessPayload);
|
|
1425
|
-
|
|
1496
|
+
_context29.next = 4;
|
|
1426
1497
|
return reg.isPrimaryActive();
|
|
1427
1498
|
case 4:
|
|
1428
|
-
status =
|
|
1499
|
+
status = _context29.sent;
|
|
1429
1500
|
expect(webex.request).toBeCalledWith(_objectSpread({
|
|
1430
1501
|
method: 'GET',
|
|
1431
1502
|
uri: "https://mobius-dfw.webex.com/api/v1/ping"
|
|
@@ -1433,23 +1504,23 @@ describe('Registration Tests', function () {
|
|
|
1433
1504
|
expect(status).toEqual(true);
|
|
1434
1505
|
case 7:
|
|
1435
1506
|
case "end":
|
|
1436
|
-
return
|
|
1507
|
+
return _context29.stop();
|
|
1437
1508
|
}
|
|
1438
|
-
},
|
|
1509
|
+
}, _callee29);
|
|
1439
1510
|
})));
|
|
1440
|
-
it('failed: primary server status to be down', /*#__PURE__*/(0, _asyncToGenerator2.default)(
|
|
1511
|
+
it('failed: primary server status to be down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
|
|
1441
1512
|
var pingFailurePayload, status;
|
|
1442
|
-
return _regenerator.default.wrap(function
|
|
1443
|
-
while (1) switch (
|
|
1513
|
+
return _regenerator.default.wrap(function _callee30$(_context30) {
|
|
1514
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
1444
1515
|
case 0:
|
|
1445
1516
|
pingFailurePayload = {
|
|
1446
1517
|
statusCode: 500
|
|
1447
1518
|
};
|
|
1448
1519
|
webex.request.mockResolvedValue(pingFailurePayload);
|
|
1449
|
-
|
|
1520
|
+
_context30.next = 4;
|
|
1450
1521
|
return reg.isPrimaryActive();
|
|
1451
1522
|
case 4:
|
|
1452
|
-
status =
|
|
1523
|
+
status = _context30.sent;
|
|
1453
1524
|
expect(webex.request).toBeCalledWith(_objectSpread({
|
|
1454
1525
|
method: 'GET',
|
|
1455
1526
|
uri: "https://mobius-dfw.webex.com/api/v1/ping"
|
|
@@ -1457,9 +1528,9 @@ describe('Registration Tests', function () {
|
|
|
1457
1528
|
expect(status).toEqual(false);
|
|
1458
1529
|
case 7:
|
|
1459
1530
|
case "end":
|
|
1460
|
-
return
|
|
1531
|
+
return _context30.stop();
|
|
1461
1532
|
}
|
|
1462
|
-
},
|
|
1533
|
+
}, _callee30);
|
|
1463
1534
|
})));
|
|
1464
1535
|
});
|
|
1465
1536
|
});
|