@webex/calling 3.4.0 → 3.5.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 +103 -4
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +143 -0
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallHistory/callHistoryFixtures.js +224 -1
- package/dist/CallHistory/callHistoryFixtures.js.map +1 -1
- package/dist/CallHistory/constants.js +8 -2
- package/dist/CallHistory/constants.js.map +1 -1
- package/dist/CallHistory/types.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.js +1 -1
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/constants.js +1 -3
- package/dist/CallSettings/constants.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +11 -2
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +249 -193
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +81 -0
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +332 -217
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/constants.js +2 -1
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/registration/register.js +18 -13
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +242 -125
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/Contacts/ContactsClient.js +39 -27
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +64 -1
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Contacts/contactFixtures.js +26 -3
- package/dist/Contacts/contactFixtures.js.map +1 -1
- package/dist/Contacts/types.js.map +1 -1
- package/dist/Events/types.js.map +1 -1
- package/dist/Metrics/index.js +2 -2
- package/dist/Metrics/index.js.map +1 -1
- package/dist/common/Utils.js +10 -8
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +25 -1
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/constants.js +5 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/testUtil.js +23 -1
- package/dist/common/testUtil.js.map +1 -1
- package/dist/common/types.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +57 -3
- package/dist/module/CallHistory/callHistoryFixtures.js +215 -0
- package/dist/module/CallHistory/constants.js +7 -1
- package/dist/module/CallSettings/UcmBackendConnector.js +5 -3
- package/dist/module/CallSettings/constants.js +0 -2
- package/dist/module/CallingClient/CallingClient.js +13 -2
- package/dist/module/CallingClient/calling/call.js +50 -0
- package/dist/module/CallingClient/constants.js +1 -0
- package/dist/module/CallingClient/registration/register.js +12 -6
- package/dist/module/Contacts/ContactsClient.js +28 -17
- package/dist/module/Contacts/contactFixtures.js +25 -2
- package/dist/module/Metrics/index.js +6 -2
- package/dist/module/common/Utils.js +7 -5
- package/dist/module/common/constants.js +4 -0
- package/dist/module/common/testUtil.js +24 -0
- package/dist/types/CallHistory/CallHistory.d.ts +1 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallHistory/callHistoryFixtures.d.ts +98 -1
- package/dist/types/CallHistory/callHistoryFixtures.d.ts.map +1 -1
- package/dist/types/CallHistory/constants.d.ts +7 -1
- package/dist/types/CallHistory/constants.d.ts.map +1 -1
- package/dist/types/CallHistory/types.d.ts +9 -1
- package/dist/types/CallHistory/types.d.ts.map +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/CallSettings/constants.d.ts +0 -2
- package/dist/types/CallSettings/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +1 -0
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +1 -0
- package/dist/types/CallingClient/constants.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/Contacts/ContactsClient.d.ts +1 -1
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/Contacts/contactFixtures.d.ts +28 -0
- package/dist/types/Contacts/contactFixtures.d.ts.map +1 -1
- package/dist/types/Contacts/types.d.ts +3 -3
- package/dist/types/Contacts/types.d.ts.map +1 -1
- package/dist/types/Events/types.d.ts +15 -0
- package/dist/types/Events/types.d.ts.map +1 -1
- package/dist/types/Metrics/index.d.ts.map +1 -1
- package/dist/types/Voicemail/UcmBackendConnector.d.ts +1 -1
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts +1 -1
- package/dist/types/common/Utils.d.ts +2 -2
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/constants.d.ts +4 -0
- package/dist/types/common/constants.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +20 -0
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +12 -12
- package/dist/types/common/types.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -60,6 +60,14 @@ describe('Registration Tests', function () {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
|
+
var ccMockResponse = _objectSpread(_objectSpread({}, mockResponse), {}, {
|
|
64
|
+
body: _objectSpread(_objectSpread({}, mockResponse.body), {}, {
|
|
65
|
+
serviceData: {
|
|
66
|
+
domain: '',
|
|
67
|
+
indicator: 'contactcenter'
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
});
|
|
63
71
|
var failurePayload = {
|
|
64
72
|
statusCode: 500,
|
|
65
73
|
body: _registerFixtures.mockPostResponse
|
|
@@ -77,15 +85,18 @@ describe('Registration Tests', function () {
|
|
|
77
85
|
var failbackRetry429Spy;
|
|
78
86
|
var restoreSpy;
|
|
79
87
|
var postRegistrationSpy;
|
|
80
|
-
|
|
88
|
+
var setupRegistration = function setupRegistration(mockServiceData) {
|
|
81
89
|
var mutex = new _asyncMutex.Mutex();
|
|
82
|
-
reg = (0, _register.createRegistration)(webex,
|
|
90
|
+
reg = (0, _register.createRegistration)(webex, mockServiceData, mutex, lineEmitter, _types2.LOGGER.INFO);
|
|
83
91
|
reg.setMobiusServers(mobiusUris.primary, mobiusUris.backup);
|
|
84
92
|
jest.clearAllMocks();
|
|
85
93
|
restartSpy = jest.spyOn(reg, 'restartRegistration');
|
|
86
94
|
failbackRetry429Spy = jest.spyOn(reg, _constants.FAILBACK_429_RETRY_UTIL);
|
|
87
95
|
restoreSpy = jest.spyOn(reg, 'restorePreviousRegistration');
|
|
88
96
|
postRegistrationSpy = jest.spyOn(reg, 'postRegistration');
|
|
97
|
+
};
|
|
98
|
+
beforeEach(function () {
|
|
99
|
+
setupRegistration(MockServiceData);
|
|
89
100
|
});
|
|
90
101
|
afterEach(function () {
|
|
91
102
|
webex.request = jest.fn();
|
|
@@ -225,23 +236,58 @@ describe('Registration Tests', function () {
|
|
|
225
236
|
}
|
|
226
237
|
}, _callee4);
|
|
227
238
|
})));
|
|
228
|
-
it('verify unreachable primary
|
|
239
|
+
it('cc: verify unreachable primary with reachable backup server', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
229
240
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
230
241
|
while (1) switch (_context5.prev = _context5.next) {
|
|
242
|
+
case 0:
|
|
243
|
+
setupRegistration(_objectSpread(_objectSpread({}, MockServiceData), {}, {
|
|
244
|
+
indicator: _types.ServiceIndicator.CONTACT_CENTER
|
|
245
|
+
}));
|
|
246
|
+
jest.useFakeTimers();
|
|
247
|
+
webex.request.mockRejectedValueOnce(failurePayload).mockRejectedValueOnce(failurePayload).mockResolvedValueOnce(successPayload);
|
|
248
|
+
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.IDLE);
|
|
249
|
+
_context5.next = 6;
|
|
250
|
+
return reg.triggerRegistration();
|
|
251
|
+
case 6:
|
|
252
|
+
jest.advanceTimersByTime(_constants.REG_TRY_BACKUP_TIMER_VAL_FOR_CC_IN_SEC * _constants.SEC_TO_MSEC_MFACTOR);
|
|
253
|
+
_context5.next = 9;
|
|
254
|
+
return flushPromises();
|
|
255
|
+
case 9:
|
|
256
|
+
expect(webex.request).toBeCalledTimes(3);
|
|
257
|
+
expect(webex.request).toBeCalledWith(_objectSpread(_objectSpread({}, ccMockResponse), {}, {
|
|
258
|
+
method: 'POST',
|
|
259
|
+
uri: "".concat(mobiusUris.primary[0], "device")
|
|
260
|
+
}));
|
|
261
|
+
expect(webex.request).toBeCalledWith(_objectSpread(_objectSpread({}, ccMockResponse), {}, {
|
|
262
|
+
method: 'POST',
|
|
263
|
+
uri: "".concat(mobiusUris.backup[0], "device")
|
|
264
|
+
}));
|
|
265
|
+
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.ACTIVE);
|
|
266
|
+
/* Active Url must match with the backup url as per the test */
|
|
267
|
+
expect(reg.getActiveMobiusUrl()).toEqual(mobiusUris.backup[0]);
|
|
268
|
+
case 14:
|
|
269
|
+
case "end":
|
|
270
|
+
return _context5.stop();
|
|
271
|
+
}
|
|
272
|
+
}, _callee5);
|
|
273
|
+
})));
|
|
274
|
+
it('verify unreachable primary and backup servers', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
275
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
276
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
231
277
|
case 0:
|
|
232
278
|
jest.useFakeTimers();
|
|
233
279
|
// try the primary twice and register successfully with backup servers
|
|
234
280
|
webex.request.mockRejectedValue(failurePayload);
|
|
235
281
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.IDLE);
|
|
236
|
-
|
|
282
|
+
_context6.next = 5;
|
|
237
283
|
return reg.triggerRegistration();
|
|
238
284
|
case 5:
|
|
239
285
|
jest.advanceTimersByTime(_constants.REG_TRY_BACKUP_TIMER_VAL_IN_SEC * _constants.SEC_TO_MSEC_MFACTOR);
|
|
240
|
-
|
|
286
|
+
_context6.next = 8;
|
|
241
287
|
return flushPromises();
|
|
242
288
|
case 8:
|
|
243
289
|
jest.advanceTimersByTime(_constants.REG_TRY_BACKUP_TIMER_VAL_IN_SEC * _constants.SEC_TO_MSEC_MFACTOR);
|
|
244
|
-
|
|
290
|
+
_context6.next = 11;
|
|
245
291
|
return flushPromises();
|
|
246
292
|
case 11:
|
|
247
293
|
/*
|
|
@@ -266,25 +312,25 @@ describe('Registration Tests', function () {
|
|
|
266
312
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.INACTIVE);
|
|
267
313
|
case 17:
|
|
268
314
|
case "end":
|
|
269
|
-
return
|
|
315
|
+
return _context6.stop();
|
|
270
316
|
}
|
|
271
|
-
},
|
|
317
|
+
}, _callee6);
|
|
272
318
|
})));
|
|
273
319
|
});
|
|
274
320
|
describe('Registration failback tests', function () {
|
|
275
|
-
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
276
|
-
return _regenerator.default.wrap(function
|
|
277
|
-
while (1) switch (
|
|
321
|
+
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
322
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
323
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
278
324
|
case 0:
|
|
279
325
|
/* keep keepalive as active so that it wont interfere with the failback tests */
|
|
280
326
|
jest.spyOn(reg, 'postKeepAlive').mockResolvedValue(successPayload);
|
|
281
327
|
jest.useFakeTimers();
|
|
282
328
|
postRegistrationSpy.mockRejectedValueOnce(failurePayload).mockRejectedValueOnce(failurePayload).mockResolvedValueOnce(successPayload);
|
|
283
|
-
|
|
329
|
+
_context7.next = 5;
|
|
284
330
|
return reg.triggerRegistration();
|
|
285
331
|
case 5:
|
|
286
332
|
jest.advanceTimersByTime(_constants.REG_TRY_BACKUP_TIMER_VAL_IN_SEC * _constants.SEC_TO_MSEC_MFACTOR);
|
|
287
|
-
|
|
333
|
+
_context7.next = 8;
|
|
288
334
|
return flushPromises();
|
|
289
335
|
case 8:
|
|
290
336
|
reg.rehomingIntervalMin = _constants.DEFAULT_REHOMING_INTERVAL_MIN;
|
|
@@ -298,17 +344,17 @@ describe('Registration Tests', function () {
|
|
|
298
344
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.ACTIVE);
|
|
299
345
|
case 13:
|
|
300
346
|
case "end":
|
|
301
|
-
return
|
|
347
|
+
return _context7.stop();
|
|
302
348
|
}
|
|
303
|
-
},
|
|
349
|
+
}, _callee7);
|
|
304
350
|
})));
|
|
305
351
|
afterEach(function () {
|
|
306
352
|
jest.clearAllTimers();
|
|
307
353
|
jest.clearAllMocks();
|
|
308
354
|
});
|
|
309
|
-
it('verify 429 error with failback to primary after initial registration with backup: Restore failure', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
310
|
-
return _regenerator.default.wrap(function
|
|
311
|
-
while (1) switch (
|
|
355
|
+
it('verify 429 error with failback to primary after initial registration with backup: Restore failure', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
356
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
357
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
312
358
|
case 0:
|
|
313
359
|
// delete should be successful
|
|
314
360
|
global.fetch = jest.fn(function () {
|
|
@@ -322,7 +368,7 @@ describe('Registration Tests', function () {
|
|
|
322
368
|
|
|
323
369
|
/* Wait for failback to be triggered. */
|
|
324
370
|
jest.advanceTimersByTime(reg.rehomingIntervalMax * _constants.MINUTES_TO_SEC_MFACTOR * _constants.SEC_TO_MSEC_MFACTOR);
|
|
325
|
-
|
|
371
|
+
_context8.next = 5;
|
|
326
372
|
return flushPromises();
|
|
327
373
|
case 5:
|
|
328
374
|
expect(logSpy).toBeCalledWith("Attempting failback to primary.", {
|
|
@@ -339,19 +385,19 @@ describe('Registration Tests', function () {
|
|
|
339
385
|
expect(reg.rehomingIntervalMax).toBe(_constants.DEFAULT_REHOMING_INTERVAL_MAX);
|
|
340
386
|
case 14:
|
|
341
387
|
case "end":
|
|
342
|
-
return
|
|
388
|
+
return _context8.stop();
|
|
343
389
|
}
|
|
344
|
-
},
|
|
390
|
+
}, _callee8);
|
|
345
391
|
})));
|
|
346
|
-
it('verify unsuccessful failback to primary after initial registration with backup: Restore failure', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
347
|
-
return _regenerator.default.wrap(function
|
|
348
|
-
while (1) switch (
|
|
392
|
+
it('verify unsuccessful failback to primary after initial registration with backup: Restore failure', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
393
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
394
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
349
395
|
case 0:
|
|
350
396
|
postRegistrationSpy.mockRejectedValue(failurePayload);
|
|
351
397
|
|
|
352
398
|
/* Wait for failback to be triggered. */
|
|
353
399
|
jest.advanceTimersByTime(reg.rehomingIntervalMax * _constants.MINUTES_TO_SEC_MFACTOR * _constants.SEC_TO_MSEC_MFACTOR);
|
|
354
|
-
|
|
400
|
+
_context9.next = 4;
|
|
355
401
|
return flushPromises();
|
|
356
402
|
case 4:
|
|
357
403
|
expect(logSpy).toBeCalledWith("Attempting failback to primary.", {
|
|
@@ -365,14 +411,14 @@ describe('Registration Tests', function () {
|
|
|
365
411
|
expect(reg.rehomingIntervalMax).toBe(_constants.DEFAULT_REHOMING_INTERVAL_MAX);
|
|
366
412
|
case 10:
|
|
367
413
|
case "end":
|
|
368
|
-
return
|
|
414
|
+
return _context9.stop();
|
|
369
415
|
}
|
|
370
|
-
},
|
|
416
|
+
}, _callee9);
|
|
371
417
|
})));
|
|
372
|
-
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
|
|
418
|
+
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 _callee10() {
|
|
373
419
|
var finalErrorPayload;
|
|
374
|
-
return _regenerator.default.wrap(function
|
|
375
|
-
while (1) switch (
|
|
420
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
421
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
376
422
|
case 0:
|
|
377
423
|
finalErrorPayload = {
|
|
378
424
|
statusCode: 401,
|
|
@@ -382,7 +428,7 @@ describe('Registration Tests', function () {
|
|
|
382
428
|
postRegistrationSpy.mockRejectedValue(finalErrorPayload).mockRejectedValueOnce(failurePayload);
|
|
383
429
|
/* Wait for failback to be triggered. */
|
|
384
430
|
jest.advanceTimersByTime(reg.rehomingIntervalMax * _constants.MINUTES_TO_SEC_MFACTOR * _constants.SEC_TO_MSEC_MFACTOR);
|
|
385
|
-
|
|
431
|
+
_context10.next = 6;
|
|
386
432
|
return flushPromises();
|
|
387
433
|
case 6:
|
|
388
434
|
expect(logSpy).toBeCalledWith("Attempting failback to primary.", {
|
|
@@ -397,19 +443,19 @@ describe('Registration Tests', function () {
|
|
|
397
443
|
expect(reg.rehomingIntervalMax).toBe(_constants.DEFAULT_REHOMING_INTERVAL_MAX);
|
|
398
444
|
case 13:
|
|
399
445
|
case "end":
|
|
400
|
-
return
|
|
446
|
+
return _context10.stop();
|
|
401
447
|
}
|
|
402
|
-
},
|
|
448
|
+
}, _callee10);
|
|
403
449
|
})));
|
|
404
|
-
it('verify unsuccessful failback to primary after initial registration with backup: Restore success', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
405
|
-
return _regenerator.default.wrap(function
|
|
406
|
-
while (1) switch (
|
|
450
|
+
it('verify unsuccessful failback to primary after initial registration with backup: Restore success', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
451
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
452
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
407
453
|
case 0:
|
|
408
454
|
postRegistrationSpy.mockRejectedValueOnce(failurePayload).mockResolvedValue(successPayload);
|
|
409
455
|
|
|
410
456
|
/* Wait for failback to be triggered. */
|
|
411
457
|
jest.advanceTimersByTime(reg.rehomingIntervalMax * _constants.MINUTES_TO_SEC_MFACTOR * _constants.SEC_TO_MSEC_MFACTOR);
|
|
412
|
-
|
|
458
|
+
_context11.next = 4;
|
|
413
459
|
return flushPromises();
|
|
414
460
|
case 4:
|
|
415
461
|
expect(logSpy).toBeCalledWith("Attempting failback to primary.", {
|
|
@@ -425,19 +471,19 @@ describe('Registration Tests', function () {
|
|
|
425
471
|
expect(reg.rehomingIntervalMax).toBe(_constants.DEFAULT_REHOMING_INTERVAL_MAX);
|
|
426
472
|
case 11:
|
|
427
473
|
case "end":
|
|
428
|
-
return
|
|
474
|
+
return _context11.stop();
|
|
429
475
|
}
|
|
430
|
-
},
|
|
476
|
+
}, _callee11);
|
|
431
477
|
})));
|
|
432
|
-
it('verify successful failback to primary after initial registration with backup', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
433
|
-
return _regenerator.default.wrap(function
|
|
434
|
-
while (1) switch (
|
|
478
|
+
it('verify successful failback to primary after initial registration with backup', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
479
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
480
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
435
481
|
case 0:
|
|
436
482
|
postRegistrationSpy.mockResolvedValue(successPayload);
|
|
437
483
|
|
|
438
484
|
/* Wait for failback to be triggered. */
|
|
439
485
|
jest.advanceTimersByTime(reg.rehomingIntervalMax * _constants.MINUTES_TO_SEC_MFACTOR * _constants.SEC_TO_MSEC_MFACTOR);
|
|
440
|
-
|
|
486
|
+
_context12.next = 4;
|
|
441
487
|
return flushPromises();
|
|
442
488
|
case 4:
|
|
443
489
|
expect(logSpy).toBeCalledWith("Attempting failback to primary.", {
|
|
@@ -454,13 +500,13 @@ describe('Registration Tests', function () {
|
|
|
454
500
|
expect(reg.rehomingIntervalMax).toBe(_registerFixtures.mockPostResponse.rehomingIntervalMax);
|
|
455
501
|
case 11:
|
|
456
502
|
case "end":
|
|
457
|
-
return
|
|
503
|
+
return _context12.stop();
|
|
458
504
|
}
|
|
459
|
-
},
|
|
505
|
+
}, _callee12);
|
|
460
506
|
})));
|
|
461
|
-
it('verify unsuccessful failback attempt due to active call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
462
|
-
return _regenerator.default.wrap(function
|
|
463
|
-
while (1) switch (
|
|
507
|
+
it('verify unsuccessful failback attempt due to active call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
508
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
509
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
464
510
|
case 0:
|
|
465
511
|
/** create a new call */
|
|
466
512
|
reg.callManager.createCall();
|
|
@@ -469,7 +515,7 @@ describe('Registration Tests', function () {
|
|
|
469
515
|
|
|
470
516
|
/* Wait for failback to be triggered. */
|
|
471
517
|
jest.advanceTimersByTime(reg.rehomingIntervalMax * _constants.MINUTES_TO_SEC_MFACTOR * _constants.SEC_TO_MSEC_MFACTOR);
|
|
472
|
-
|
|
518
|
+
_context13.next = 6;
|
|
473
519
|
return flushPromises();
|
|
474
520
|
case 6:
|
|
475
521
|
expect(logSpy).toBeCalledWith("Active calls present, deferring failback to next cycle.", {
|
|
@@ -490,9 +536,9 @@ describe('Registration Tests', function () {
|
|
|
490
536
|
expect(reg.rehomingIntervalMax).toBe(_constants.DEFAULT_REHOMING_INTERVAL_MAX);
|
|
491
537
|
case 14:
|
|
492
538
|
case "end":
|
|
493
|
-
return
|
|
539
|
+
return _context13.stop();
|
|
494
540
|
}
|
|
495
|
-
},
|
|
541
|
+
}, _callee13);
|
|
496
542
|
})));
|
|
497
543
|
});
|
|
498
544
|
|
|
@@ -505,22 +551,27 @@ describe('Registration Tests', function () {
|
|
|
505
551
|
var mockKeepAliveBody = {
|
|
506
552
|
device: _registerFixtures.mockPostResponse.device
|
|
507
553
|
};
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
554
|
+
var beforeEachSetupForKeepalive = /*#__PURE__*/function () {
|
|
555
|
+
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
556
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
557
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
558
|
+
case 0:
|
|
559
|
+
postRegistrationSpy.mockResolvedValueOnce(successPayload);
|
|
560
|
+
jest.useFakeTimers();
|
|
561
|
+
_context14.next = 4;
|
|
562
|
+
return reg.triggerRegistration();
|
|
563
|
+
case 4:
|
|
564
|
+
expect(reg.getStatus()).toBe(_types.RegistrationStatus.ACTIVE);
|
|
565
|
+
case 5:
|
|
566
|
+
case "end":
|
|
567
|
+
return _context14.stop();
|
|
568
|
+
}
|
|
569
|
+
}, _callee14);
|
|
570
|
+
}));
|
|
571
|
+
return function beforeEachSetupForKeepalive() {
|
|
572
|
+
return _ref14.apply(this, arguments);
|
|
573
|
+
};
|
|
574
|
+
}();
|
|
524
575
|
afterEach(function () {
|
|
525
576
|
jest.clearAllTimers();
|
|
526
577
|
jest.clearAllMocks();
|
|
@@ -534,11 +585,14 @@ describe('Registration Tests', function () {
|
|
|
534
585
|
call.end();
|
|
535
586
|
});
|
|
536
587
|
});
|
|
537
|
-
it('verify successful keep-alive cases', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
588
|
+
it('verify successful keep-alive cases', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
538
589
|
var keepAlivePayload, funcSpy;
|
|
539
|
-
return _regenerator.default.wrap(function
|
|
540
|
-
while (1) switch (
|
|
590
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
591
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
541
592
|
case 0:
|
|
593
|
+
_context15.next = 2;
|
|
594
|
+
return beforeEachSetupForKeepalive();
|
|
595
|
+
case 2:
|
|
542
596
|
keepAlivePayload = {
|
|
543
597
|
statusCode: 200,
|
|
544
598
|
body: mockKeepAliveBody
|
|
@@ -546,22 +600,25 @@ describe('Registration Tests', function () {
|
|
|
546
600
|
webex.request.mockReturnValue(keepAlivePayload);
|
|
547
601
|
funcSpy = jest.spyOn(reg, 'postKeepAlive');
|
|
548
602
|
jest.advanceTimersByTime(2 * _registerFixtures.mockPostResponse.keepaliveInterval * _constants.SEC_TO_MSEC_MFACTOR);
|
|
549
|
-
|
|
603
|
+
_context15.next = 8;
|
|
550
604
|
return flushPromises();
|
|
551
|
-
case
|
|
605
|
+
case 8:
|
|
552
606
|
expect(funcSpy).toBeCalledTimes(2); // should be called 2 times: first try and after the interval.
|
|
553
607
|
expect(logSpy).lastCalledWith('Sent Keepalive, status: 200', logObj);
|
|
554
|
-
case
|
|
608
|
+
case 10:
|
|
555
609
|
case "end":
|
|
556
|
-
return
|
|
610
|
+
return _context15.stop();
|
|
557
611
|
}
|
|
558
|
-
},
|
|
612
|
+
}, _callee15);
|
|
559
613
|
})));
|
|
560
|
-
it('verify failure keep-alive cases: Retry Success', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
614
|
+
it('verify failure keep-alive cases: Retry Success', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
561
615
|
var failurePayload, successPayload, timer;
|
|
562
|
-
return _regenerator.default.wrap(function
|
|
563
|
-
while (1) switch (
|
|
616
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
617
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
564
618
|
case 0:
|
|
619
|
+
_context16.next = 2;
|
|
620
|
+
return beforeEachSetupForKeepalive();
|
|
621
|
+
case 2:
|
|
565
622
|
failurePayload = {
|
|
566
623
|
statusCode: 503,
|
|
567
624
|
body: mockKeepAliveBody
|
|
@@ -574,9 +631,9 @@ describe('Registration Tests', function () {
|
|
|
574
631
|
lineEmitter.mockClear();
|
|
575
632
|
webex.request.mockRejectedValueOnce(failurePayload).mockResolvedValue(successPayload);
|
|
576
633
|
jest.advanceTimersByTime(2 * _registerFixtures.mockPostResponse.keepaliveInterval * _constants.SEC_TO_MSEC_MFACTOR);
|
|
577
|
-
|
|
634
|
+
_context16.next = 10;
|
|
578
635
|
return flushPromises();
|
|
579
|
-
case
|
|
636
|
+
case 10:
|
|
580
637
|
expect(handleErrorSpy).toBeCalledOnceWith(failurePayload, expect.anything(), {
|
|
581
638
|
method: 'startKeepaliveTimer',
|
|
582
639
|
file: _constants.REGISTRATION_FILE
|
|
@@ -586,17 +643,20 @@ describe('Registration Tests', function () {
|
|
|
586
643
|
expect(lineEmitter).nthCalledWith(1, _types4.LINE_EVENTS.RECONNECTING);
|
|
587
644
|
expect(lineEmitter).nthCalledWith(2, _types4.LINE_EVENTS.RECONNECTED);
|
|
588
645
|
expect(lineEmitter).toBeCalledTimes(2);
|
|
589
|
-
case
|
|
646
|
+
case 16:
|
|
590
647
|
case "end":
|
|
591
|
-
return
|
|
648
|
+
return _context16.stop();
|
|
592
649
|
}
|
|
593
|
-
},
|
|
650
|
+
}, _callee16);
|
|
594
651
|
})));
|
|
595
|
-
it('verify failure keep-alive cases: Restore failure', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
652
|
+
it('verify failure keep-alive cases: Restore failure', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
596
653
|
var restoreSpy, restartRegSpy, reconnectSpy, failurePayload, clearIntervalSpy, timer;
|
|
597
|
-
return _regenerator.default.wrap(function
|
|
598
|
-
while (1) switch (
|
|
654
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
655
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
599
656
|
case 0:
|
|
657
|
+
_context17.next = 2;
|
|
658
|
+
return beforeEachSetupForKeepalive();
|
|
659
|
+
case 2:
|
|
600
660
|
restoreSpy = jest.spyOn(reg, 'restorePreviousRegistration');
|
|
601
661
|
restartRegSpy = jest.spyOn(reg, 'restartRegistration');
|
|
602
662
|
reconnectSpy = jest.spyOn(reg, 'reconnectOnFailure');
|
|
@@ -610,9 +670,9 @@ describe('Registration Tests', function () {
|
|
|
610
670
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.ACTIVE);
|
|
611
671
|
timer = reg.keepaliveTimer;
|
|
612
672
|
jest.advanceTimersByTime(5 * _registerFixtures.mockPostResponse.keepaliveInterval * _constants.SEC_TO_MSEC_MFACTOR);
|
|
613
|
-
|
|
673
|
+
_context17.next = 14;
|
|
614
674
|
return flushPromises();
|
|
615
|
-
case
|
|
675
|
+
case 14:
|
|
616
676
|
expect(clearIntervalSpy).toBeCalledOnceWith(timer);
|
|
617
677
|
|
|
618
678
|
// sendKeepAlive tries to retry 5 times before accepting failure
|
|
@@ -635,17 +695,20 @@ describe('Registration Tests', function () {
|
|
|
635
695
|
expect(lineEmitter).nthCalledWith(8, _types4.LINE_EVENTS.CONNECTING);
|
|
636
696
|
expect(lineEmitter).nthCalledWith(9, _types4.LINE_EVENTS.UNREGISTERED);
|
|
637
697
|
expect(lineEmitter).toBeCalledTimes(9);
|
|
638
|
-
case
|
|
698
|
+
case 31:
|
|
639
699
|
case "end":
|
|
640
|
-
return
|
|
700
|
+
return _context17.stop();
|
|
641
701
|
}
|
|
642
|
-
},
|
|
702
|
+
}, _callee17);
|
|
643
703
|
})));
|
|
644
|
-
it('verify failure keep-alive cases: Restore Success', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
704
|
+
it('verify failure keep-alive cases: Restore Success', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
645
705
|
var restoreSpy, restartRegSpy, reconnectSpy, failurePayload, successPayload, clearIntervalSpy, url, timer;
|
|
646
|
-
return _regenerator.default.wrap(function
|
|
647
|
-
while (1) switch (
|
|
706
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
707
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
648
708
|
case 0:
|
|
709
|
+
_context18.next = 2;
|
|
710
|
+
return beforeEachSetupForKeepalive();
|
|
711
|
+
case 2:
|
|
649
712
|
restoreSpy = jest.spyOn(reg, 'restorePreviousRegistration');
|
|
650
713
|
restartRegSpy = jest.spyOn(reg, 'restartRegistration');
|
|
651
714
|
reconnectSpy = jest.spyOn(reg, 'reconnectOnFailure');
|
|
@@ -669,9 +732,9 @@ describe('Registration Tests', function () {
|
|
|
669
732
|
reg.setActiveMobiusUrl(url);
|
|
670
733
|
timer = reg.keepaliveTimer;
|
|
671
734
|
jest.advanceTimersByTime(5 * _registerFixtures.mockPostResponse.keepaliveInterval * _constants.SEC_TO_MSEC_MFACTOR);
|
|
672
|
-
|
|
735
|
+
_context18.next = 16;
|
|
673
736
|
return flushPromises();
|
|
674
|
-
case
|
|
737
|
+
case 16:
|
|
675
738
|
expect(clearIntervalSpy).toBeCalledOnceWith(timer);
|
|
676
739
|
expect(handleErrorSpy).toBeCalledTimes(5);
|
|
677
740
|
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.ACTIVE);
|
|
@@ -682,17 +745,20 @@ describe('Registration Tests', function () {
|
|
|
682
745
|
expect(reg.reconnectPending).toStrictEqual(false);
|
|
683
746
|
expect(reg.keepaliveTimer).toBeTruthy();
|
|
684
747
|
expect(reg.keepaliveTimer).not.toBe(timer);
|
|
685
|
-
case
|
|
748
|
+
case 26:
|
|
686
749
|
case "end":
|
|
687
|
-
return
|
|
750
|
+
return _context18.stop();
|
|
688
751
|
}
|
|
689
|
-
},
|
|
752
|
+
}, _callee18);
|
|
690
753
|
})));
|
|
691
|
-
it('verify failure followed by recovery of keepalive', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
754
|
+
it('verify failure followed by recovery of keepalive', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
692
755
|
var failurePayload, successPayload, clearIntervalSpy, timer;
|
|
693
|
-
return _regenerator.default.wrap(function
|
|
694
|
-
while (1) switch (
|
|
756
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
757
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
695
758
|
case 0:
|
|
759
|
+
_context19.next = 2;
|
|
760
|
+
return beforeEachSetupForKeepalive();
|
|
761
|
+
case 2:
|
|
696
762
|
failurePayload = {
|
|
697
763
|
statusCode: 503,
|
|
698
764
|
body: mockKeepAliveBody
|
|
@@ -706,25 +772,73 @@ describe('Registration Tests', function () {
|
|
|
706
772
|
expect(reg.getStatus()).toBe(_types.RegistrationStatus.ACTIVE);
|
|
707
773
|
timer = reg.keepaliveTimer; // sendKeepAlive tries to retry 3 times and receiving success on third time
|
|
708
774
|
jest.advanceTimersByTime(3 * _registerFixtures.mockPostResponse.keepaliveInterval * _constants.SEC_TO_MSEC_MFACTOR);
|
|
709
|
-
|
|
775
|
+
_context19.next = 11;
|
|
710
776
|
return flushPromises();
|
|
711
|
-
case
|
|
777
|
+
case 11:
|
|
712
778
|
expect(webex.request).toBeCalledTimes(3);
|
|
713
779
|
expect(reg.getStatus()).toBe(_types.RegistrationStatus.ACTIVE);
|
|
714
780
|
expect(handleErrorSpy).toBeCalledTimes(2);
|
|
715
781
|
expect(clearIntervalSpy).not.toBeCalled();
|
|
716
782
|
expect(reg.keepaliveTimer).toBe(timer);
|
|
717
|
-
case
|
|
783
|
+
case 16:
|
|
718
784
|
case "end":
|
|
719
|
-
return
|
|
785
|
+
return _context19.stop();
|
|
720
786
|
}
|
|
721
|
-
},
|
|
787
|
+
}, _callee19);
|
|
788
|
+
})));
|
|
789
|
+
it('cc: verify failover to backup server after 4 keep alive failure with primary server', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
790
|
+
var failurePayload, successPayload, clearIntervalSpy, timer;
|
|
791
|
+
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
792
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
793
|
+
case 0:
|
|
794
|
+
// Register with contact center service
|
|
795
|
+
setupRegistration(_objectSpread(_objectSpread({}, MockServiceData), {}, {
|
|
796
|
+
indicator: _types.ServiceIndicator.CONTACT_CENTER
|
|
797
|
+
}));
|
|
798
|
+
_context20.next = 3;
|
|
799
|
+
return beforeEachSetupForKeepalive();
|
|
800
|
+
case 3:
|
|
801
|
+
failurePayload = {
|
|
802
|
+
statusCode: 503,
|
|
803
|
+
body: mockKeepAliveBody
|
|
804
|
+
};
|
|
805
|
+
successPayload = {
|
|
806
|
+
statusCode: 200,
|
|
807
|
+
body: mockKeepAliveBody
|
|
808
|
+
};
|
|
809
|
+
clearIntervalSpy = jest.spyOn(global, 'clearInterval');
|
|
810
|
+
jest.spyOn(reg, 'postKeepAlive').mockRejectedValueOnce(failurePayload).mockRejectedValueOnce(failurePayload).mockRejectedValueOnce(failurePayload).mockRejectedValueOnce(failurePayload).mockResolvedValue(successPayload);
|
|
811
|
+
expect(reg.getStatus()).toBe(_types.RegistrationStatus.ACTIVE);
|
|
812
|
+
timer = reg.keepaliveTimer;
|
|
813
|
+
jest.advanceTimersByTime(5 * _registerFixtures.mockPostResponse.keepaliveInterval * _constants.SEC_TO_MSEC_MFACTOR);
|
|
814
|
+
_context20.next = 12;
|
|
815
|
+
return flushPromises();
|
|
816
|
+
case 12:
|
|
817
|
+
expect(clearIntervalSpy).toBeCalledOnceWith(timer);
|
|
818
|
+
expect(reg.getStatus()).toBe(_types.RegistrationStatus.INACTIVE);
|
|
819
|
+
expect(reg.keepaliveTimer).not.toBe(timer);
|
|
820
|
+
webex.request.mockRejectedValueOnce(failurePayload).mockResolvedValue(successPayload);
|
|
821
|
+
jest.advanceTimersByTime(_constants.REG_TRY_BACKUP_TIMER_VAL_FOR_CC_IN_SEC * _constants.SEC_TO_MSEC_MFACTOR);
|
|
822
|
+
_context20.next = 19;
|
|
823
|
+
return flushPromises();
|
|
824
|
+
case 19:
|
|
825
|
+
/* Active Url must match with the backup url as per the test */
|
|
826
|
+
expect(reg.getActiveMobiusUrl()).toEqual(mobiusUris.backup[0]);
|
|
827
|
+
expect(reg.getStatus()).toBe(_types.RegistrationStatus.ACTIVE);
|
|
828
|
+
case 21:
|
|
829
|
+
case "end":
|
|
830
|
+
return _context20.stop();
|
|
831
|
+
}
|
|
832
|
+
}, _callee20);
|
|
722
833
|
})));
|
|
723
|
-
it('verify final error for keep-alive', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
834
|
+
it('verify final error for keep-alive', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
724
835
|
var restoreSpy, restartRegSpy, reconnectSpy, failurePayload, clearIntervalSpy;
|
|
725
|
-
return _regenerator.default.wrap(function
|
|
726
|
-
while (1) switch (
|
|
836
|
+
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
837
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
727
838
|
case 0:
|
|
839
|
+
_context21.next = 2;
|
|
840
|
+
return beforeEachSetupForKeepalive();
|
|
841
|
+
case 2:
|
|
728
842
|
restoreSpy = jest.spyOn(reg, 'restorePreviousRegistration');
|
|
729
843
|
restartRegSpy = jest.spyOn(reg, 'restartRegistration');
|
|
730
844
|
reconnectSpy = jest.spyOn(reg, 'reconnectOnFailure');
|
|
@@ -738,9 +852,9 @@ describe('Registration Tests', function () {
|
|
|
738
852
|
|
|
739
853
|
/* send one keepalive */
|
|
740
854
|
jest.advanceTimersByTime(_registerFixtures.mockPostResponse.keepaliveInterval * _constants.SEC_TO_MSEC_MFACTOR);
|
|
741
|
-
|
|
855
|
+
_context21.next = 12;
|
|
742
856
|
return flushPromises();
|
|
743
|
-
case
|
|
857
|
+
case 12:
|
|
744
858
|
expect(clearIntervalSpy).toBeCalledTimes(1);
|
|
745
859
|
expect(reg.getStatus()).toBe(_types.RegistrationStatus.INACTIVE);
|
|
746
860
|
expect(reconnectSpy).not.toBeCalled();
|
|
@@ -758,17 +872,20 @@ describe('Registration Tests', function () {
|
|
|
758
872
|
file: _constants.REGISTRATION_FILE,
|
|
759
873
|
method: _constants.KEEPALIVE_UTIL
|
|
760
874
|
});
|
|
761
|
-
case
|
|
875
|
+
case 21:
|
|
762
876
|
case "end":
|
|
763
|
-
return
|
|
877
|
+
return _context21.stop();
|
|
764
878
|
}
|
|
765
|
-
},
|
|
879
|
+
}, _callee21);
|
|
766
880
|
})));
|
|
767
|
-
it('verify failure keep-alive case with active call present: Restore Success after call ends', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
881
|
+
it('verify failure keep-alive case with active call present: Restore Success after call ends', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
768
882
|
var restoreSpy, restartRegSpy, reconnectSpy, failurePayload, successPayload, clearIntervalSpy, url, timer, call;
|
|
769
|
-
return _regenerator.default.wrap(function
|
|
770
|
-
while (1) switch (
|
|
883
|
+
return _regenerator.default.wrap(function _callee22$(_context22) {
|
|
884
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
771
885
|
case 0:
|
|
886
|
+
_context22.next = 2;
|
|
887
|
+
return beforeEachSetupForKeepalive();
|
|
888
|
+
case 2:
|
|
772
889
|
restoreSpy = jest.spyOn(reg, 'restorePreviousRegistration');
|
|
773
890
|
restartRegSpy = jest.spyOn(reg, 'restartRegistration');
|
|
774
891
|
reconnectSpy = jest.spyOn(reg, 'reconnectOnFailure');
|
|
@@ -795,9 +912,9 @@ describe('Registration Tests', function () {
|
|
|
795
912
|
|
|
796
913
|
/* send one keepalive */
|
|
797
914
|
jest.advanceTimersByTime(5 * _registerFixtures.mockPostResponse.keepaliveInterval * _constants.SEC_TO_MSEC_MFACTOR);
|
|
798
|
-
|
|
915
|
+
_context22.next = 18;
|
|
799
916
|
return flushPromises();
|
|
800
|
-
case
|
|
917
|
+
case 18:
|
|
801
918
|
expect(clearIntervalSpy).toBeCalledOnceWith(timer);
|
|
802
919
|
expect(handleErrorSpy).toBeCalledTimes(5);
|
|
803
920
|
expect(reg.keepaliveTimer).toStrictEqual(undefined);
|
|
@@ -816,9 +933,9 @@ describe('Registration Tests', function () {
|
|
|
816
933
|
|
|
817
934
|
/* simulate call disconnect and Calling client will trigger reconnect upon receiving disconnect event from CallManager */
|
|
818
935
|
reg.callManager.callCollection = {};
|
|
819
|
-
|
|
936
|
+
_context22.next = 33;
|
|
820
937
|
return reg.reconnectOnFailure(_constants.CALLS_CLEARED_HANDLER_UTIL);
|
|
821
|
-
case
|
|
938
|
+
case 33:
|
|
822
939
|
expect((0, _keys.default)(reg.callManager.getActiveCalls()).length).toBe(0);
|
|
823
940
|
expect(reg.getStatus()).toBe(_types.RegistrationStatus.ACTIVE);
|
|
824
941
|
expect(reconnectSpy).toBeCalledOnceWith(_constants.CALLS_CLEARED_HANDLER_UTIL);
|
|
@@ -828,11 +945,11 @@ describe('Registration Tests', function () {
|
|
|
828
945
|
expect(reg.getActiveMobiusUrl()).toStrictEqual(url);
|
|
829
946
|
expect(reg.keepaliveTimer).toBeTruthy();
|
|
830
947
|
expect(reg.keepaliveTimer).not.toBe(timer);
|
|
831
|
-
case
|
|
948
|
+
case 42:
|
|
832
949
|
case "end":
|
|
833
|
-
return
|
|
950
|
+
return _context22.stop();
|
|
834
951
|
}
|
|
835
|
-
},
|
|
952
|
+
}, _callee22);
|
|
836
953
|
})));
|
|
837
954
|
});
|
|
838
955
|
});
|