@webex/calling 3.10.0-next.2 → 3.10.0-next.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CallHistory/CallHistory.js +128 -128
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +278 -181
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallSettings/CallSettings.js +17 -18
- package/dist/CallSettings/CallSettings.js.map +1 -1
- package/dist/CallSettings/CallSettings.test.js +14 -14
- package/dist/CallSettings/CallSettings.test.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.js +71 -24
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +136 -47
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +137 -138
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +145 -149
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +297 -345
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +267 -405
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.js +7 -8
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +24 -24
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +655 -611
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +762 -551
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +15 -18
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +113 -113
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/constants.js +5 -1
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +57 -74
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +22 -22
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +657 -526
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +657 -309
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +24 -24
- package/dist/CallingClient/registration/webWorker.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.test.js +20 -20
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +28 -28
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -1
- package/dist/Contacts/ContactsClient.js +258 -258
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +60 -60
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Errors/catalog/CallError.js +7 -10
- package/dist/Errors/catalog/CallError.js.map +1 -1
- package/dist/Errors/catalog/CallingDeviceError.js +6 -9
- package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
- package/dist/Errors/catalog/ExtendedError.js +6 -8
- package/dist/Errors/catalog/ExtendedError.js.map +1 -1
- package/dist/Errors/catalog/LineError.js +6 -9
- package/dist/Errors/catalog/LineError.js.map +1 -1
- package/dist/Events/impl/index.js +11 -13
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/Metrics/index.js +1 -2
- package/dist/Metrics/index.js.map +1 -1
- package/dist/SDKConnector/index.js +1 -2
- package/dist/SDKConnector/index.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +129 -128
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +98 -98
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +86 -86
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +72 -72
- package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +58 -61
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/Voicemail.test.js +20 -20
- package/dist/Voicemail/Voicemail.test.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +116 -117
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +140 -140
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
- package/dist/common/Utils.js +195 -165
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +432 -183
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/constants.js +3 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/testUtil.js +5 -4
- package/dist/common/testUtil.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +7 -3
- package/dist/module/CallSettings/UcmBackendConnector.js +20 -6
- package/dist/module/CallSettings/WxCallBackendConnector.js +3 -1
- package/dist/module/CallingClient/CallingClient.js +83 -121
- package/dist/module/CallingClient/calling/call.js +60 -39
- package/dist/module/CallingClient/constants.js +3 -0
- package/dist/module/CallingClient/registration/register.js +82 -2
- package/dist/module/Contacts/ContactsClient.js +9 -5
- package/dist/module/Voicemail/BroadworksBackendConnector.js +3 -1
- package/dist/module/Voicemail/UcmBackendConnector.js +2 -1
- package/dist/module/common/Utils.js +27 -3
- package/dist/module/common/constants.js +2 -0
- package/dist/module/common/testUtil.js +1 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts +1 -0
- package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +4 -0
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +3 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +4 -0
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +6 -0
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/Contacts/ContactsClient.d.ts +1 -0
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +16 -0
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/constants.d.ts +2 -0
- package/dist/types/common/constants.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +1 -0
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -26,7 +26,7 @@ var _callManager = require("./callManager");
|
|
|
26
26
|
var _Logger = _interopRequireDefault(require("../../Logger"));
|
|
27
27
|
var _Errors = require("../../Errors");
|
|
28
28
|
var _constants2 = require("../../common/constants");
|
|
29
|
-
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
|
|
29
|
+
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 _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
30
30
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
31
31
|
/* eslint-disable dot-notation */
|
|
32
32
|
/* eslint-disable @typescript-eslint/no-shadow */
|
|
@@ -136,7 +136,7 @@ describe('Call Tests', function () {
|
|
|
136
136
|
});
|
|
137
137
|
it('should log a warning when sending a digit fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
138
138
|
var tone, errorMessage, mockMediaConnection, callManager, call, realMediaConnection, warnSpy, infoSpy;
|
|
139
|
-
return _regenerator.default.wrap(function
|
|
139
|
+
return _regenerator.default.wrap(function (_context) {
|
|
140
140
|
while (1) switch (_context.prev = _context.next) {
|
|
141
141
|
case 0:
|
|
142
142
|
tone = '1';
|
|
@@ -171,14 +171,14 @@ describe('Call Tests', function () {
|
|
|
171
171
|
// Restore the real mediaConnection object
|
|
172
172
|
call.mediaConnection = realMediaConnection;
|
|
173
173
|
call.end();
|
|
174
|
-
_context.next =
|
|
174
|
+
_context.next = 1;
|
|
175
175
|
return (0, _Utils.waitForMsecs)(50);
|
|
176
|
-
case
|
|
176
|
+
case 1:
|
|
177
177
|
// Need to add a small delay for Promise and callback to finish.
|
|
178
178
|
|
|
179
179
|
/* After call ends, call manager should have 0 record */
|
|
180
180
|
expect((0, _keys.default)(callManager.getActiveCalls()).length).toBe(0);
|
|
181
|
-
case
|
|
181
|
+
case 2:
|
|
182
182
|
case "end":
|
|
183
183
|
return _context.stop();
|
|
184
184
|
}
|
|
@@ -186,7 +186,7 @@ describe('Call Tests', function () {
|
|
|
186
186
|
})));
|
|
187
187
|
it('delete call object when ending the call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
188
188
|
var callManager, mockStream, localAudioStream, call, infoSpy;
|
|
189
|
-
return _regenerator.default.wrap(function
|
|
189
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
190
190
|
while (1) switch (_context2.prev = _context2.next) {
|
|
191
191
|
case 0:
|
|
192
192
|
webex.request.mockReturnValue({
|
|
@@ -225,9 +225,9 @@ describe('Call Tests', function () {
|
|
|
225
225
|
file: 'call',
|
|
226
226
|
method: 'end'
|
|
227
227
|
});
|
|
228
|
-
_context2.next =
|
|
228
|
+
_context2.next = 1;
|
|
229
229
|
return (0, _Utils.waitForMsecs)(50);
|
|
230
|
-
case
|
|
230
|
+
case 1:
|
|
231
231
|
// Need to add a small delay for Promise and callback to finish.
|
|
232
232
|
expect(parseMediaQualityStatisticsMock).toHaveBeenCalledTimes(1);
|
|
233
233
|
expect(webex.request.mock.calls[0][0].body.metrics).toStrictEqual(disconnectStats);
|
|
@@ -236,7 +236,7 @@ describe('Call Tests', function () {
|
|
|
236
236
|
|
|
237
237
|
/* After call ends, call manager should have 0 record */
|
|
238
238
|
expect((0, _keys.default)(callManager.getActiveCalls()).length).toBe(0);
|
|
239
|
-
case
|
|
239
|
+
case 2:
|
|
240
240
|
case "end":
|
|
241
241
|
return _context2.stop();
|
|
242
242
|
}
|
|
@@ -244,7 +244,7 @@ describe('Call Tests', function () {
|
|
|
244
244
|
})));
|
|
245
245
|
it('Check whether media requests succeed or not', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
246
246
|
var mediaResponse, call, response;
|
|
247
|
-
return _regenerator.default.wrap(function
|
|
247
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
248
248
|
while (1) switch (_context3.prev = _context3.next) {
|
|
249
249
|
case 0:
|
|
250
250
|
webex.request.mockReturnValue({
|
|
@@ -268,12 +268,12 @@ describe('Call Tests', function () {
|
|
|
268
268
|
}
|
|
269
269
|
};
|
|
270
270
|
call = callManager.createCall(_types3.CallDirection.INBOUND, deviceId, mockLineId, dest);
|
|
271
|
-
_context3.next =
|
|
271
|
+
_context3.next = 1;
|
|
272
272
|
return call['postMedia']({});
|
|
273
|
-
case
|
|
273
|
+
case 1:
|
|
274
274
|
response = _context3.sent;
|
|
275
275
|
expect(response.body).toStrictEqual(mediaResponse.body);
|
|
276
|
-
case
|
|
276
|
+
case 2:
|
|
277
277
|
case "end":
|
|
278
278
|
return _context3.stop();
|
|
279
279
|
}
|
|
@@ -281,18 +281,18 @@ describe('Call Tests', function () {
|
|
|
281
281
|
})));
|
|
282
282
|
it('check whether callerId midcall event is serviced or not', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
283
283
|
var call;
|
|
284
|
-
return _regenerator.default.wrap(function
|
|
284
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
285
285
|
while (1) switch (_context4.prev = _context4.next) {
|
|
286
286
|
case 0:
|
|
287
287
|
call = callManager.createCall(_types3.CallDirection.OUTBOUND, deviceId, mockLineId, dest);
|
|
288
288
|
call.handleMidCallEvent(dummyMidCallEvent);
|
|
289
|
-
_context4.next =
|
|
289
|
+
_context4.next = 1;
|
|
290
290
|
return (0, _Utils.waitForMsecs)(50);
|
|
291
|
-
case
|
|
291
|
+
case 1:
|
|
292
292
|
expect(call.getCallerInfo().name).toStrictEqual('Bob Marley');
|
|
293
293
|
expect(call.getCallerInfo().num).toStrictEqual('5010');
|
|
294
294
|
expect(call.getCallerInfo().avatarSrc).toBeFalsy();
|
|
295
|
-
case
|
|
295
|
+
case 2:
|
|
296
296
|
case "end":
|
|
297
297
|
return _context4.stop();
|
|
298
298
|
}
|
|
@@ -300,55 +300,55 @@ describe('Call Tests', function () {
|
|
|
300
300
|
})));
|
|
301
301
|
it('check whether call midcall event is serviced or not', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
302
302
|
var call, logSpy, corelationId;
|
|
303
|
-
return _regenerator.default.wrap(function
|
|
303
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
304
304
|
while (1) switch (_context5.prev = _context5.next) {
|
|
305
305
|
case 0:
|
|
306
306
|
call = callManager.createCall(_types3.CallDirection.OUTBOUND, deviceId, mockLineId, dest);
|
|
307
307
|
dummyMidCallEvent.eventType = 'callState';
|
|
308
308
|
logSpy = jest.spyOn(_Logger.default, 'log');
|
|
309
309
|
call.handleMidCallEvent(dummyMidCallEvent);
|
|
310
|
-
_context5.next =
|
|
310
|
+
_context5.next = 1;
|
|
311
311
|
return (0, _Utils.waitForMsecs)(50);
|
|
312
|
-
case
|
|
312
|
+
case 1:
|
|
313
313
|
corelationId = call.getCorrelationId();
|
|
314
314
|
expect(logSpy).toHaveBeenLastCalledWith("Received Midcall call event for correlationId : ".concat(corelationId), {
|
|
315
315
|
file: 'call',
|
|
316
316
|
method: 'handleMidCallEvent'
|
|
317
317
|
});
|
|
318
|
-
case
|
|
318
|
+
case 2:
|
|
319
319
|
case "end":
|
|
320
320
|
return _context5.stop();
|
|
321
321
|
}
|
|
322
322
|
}, _callee5);
|
|
323
323
|
})));
|
|
324
324
|
it('check call stats for active call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
325
|
-
var call, callRtpStats;
|
|
326
|
-
return _regenerator.default.wrap(function
|
|
325
|
+
var call, callRtpStats, _t;
|
|
326
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
327
327
|
while (1) switch (_context6.prev = _context6.next) {
|
|
328
328
|
case 0:
|
|
329
329
|
call = callManager.createCall(_types3.CallDirection.OUTBOUND, deviceId, mockLineId, dest);
|
|
330
330
|
_context6.prev = 1;
|
|
331
|
-
_context6.next =
|
|
331
|
+
_context6.next = 2;
|
|
332
332
|
return call.getCallRtpStats();
|
|
333
|
-
case
|
|
333
|
+
case 2:
|
|
334
334
|
callRtpStats = _context6.sent;
|
|
335
|
-
_context6.next =
|
|
335
|
+
_context6.next = 4;
|
|
336
336
|
break;
|
|
337
|
-
case
|
|
338
|
-
_context6.prev =
|
|
339
|
-
|
|
340
|
-
console.error(
|
|
341
|
-
case
|
|
337
|
+
case 3:
|
|
338
|
+
_context6.prev = 3;
|
|
339
|
+
_t = _context6["catch"](1);
|
|
340
|
+
console.error(_t);
|
|
341
|
+
case 4:
|
|
342
342
|
expect(callRtpStats).toStrictEqual(disconnectStats);
|
|
343
|
-
case
|
|
343
|
+
case 5:
|
|
344
344
|
case "end":
|
|
345
345
|
return _context6.stop();
|
|
346
346
|
}
|
|
347
|
-
}, _callee6, null, [[1,
|
|
347
|
+
}, _callee6, null, [[1, 3]]);
|
|
348
348
|
})));
|
|
349
349
|
it('dial functionality tests for coverage', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
350
350
|
var mockStream, localAudioStream, warnSpy, call, bnrMetricSpy, logSpy;
|
|
351
|
-
return _regenerator.default.wrap(function
|
|
351
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
352
352
|
while (1) switch (_context7.prev = _context7.next) {
|
|
353
353
|
case 0:
|
|
354
354
|
mockStream = {
|
|
@@ -380,7 +380,7 @@ describe('Call Tests', function () {
|
|
|
380
380
|
file: 'call',
|
|
381
381
|
method: 'dial'
|
|
382
382
|
});
|
|
383
|
-
case
|
|
383
|
+
case 1:
|
|
384
384
|
case "end":
|
|
385
385
|
return _context7.stop();
|
|
386
386
|
}
|
|
@@ -388,7 +388,7 @@ describe('Call Tests', function () {
|
|
|
388
388
|
})));
|
|
389
389
|
it('answer functionality tests for coverage', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
390
390
|
var mockStream, localAudioStream, warnSpy, call, bnrMetricSpy, infoSpy;
|
|
391
|
-
return _regenerator.default.wrap(function
|
|
391
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
392
392
|
while (1) switch (_context8.prev = _context8.next) {
|
|
393
393
|
case 0:
|
|
394
394
|
mockStream = {
|
|
@@ -421,7 +421,7 @@ describe('Call Tests', function () {
|
|
|
421
421
|
call.answer(localAudioStream);
|
|
422
422
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_CONNECT');
|
|
423
423
|
expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_ENABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
|
|
424
|
-
case
|
|
424
|
+
case 1:
|
|
425
425
|
case "end":
|
|
426
426
|
return _context8.stop();
|
|
427
427
|
}
|
|
@@ -429,7 +429,7 @@ describe('Call Tests', function () {
|
|
|
429
429
|
})));
|
|
430
430
|
it('testing enabling/disabling the BNR on an active call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
431
431
|
var mockStream, localAudioStream, onStreamSpy, onEffectSpy, offStreamSpy, offEffectSpy, call, updateLocalTracksSpy, bnrMetricSpy;
|
|
432
|
-
return _regenerator.default.wrap(function
|
|
432
|
+
return _regenerator.default.wrap(function (_context9) {
|
|
433
433
|
while (1) switch (_context9.prev = _context9.next) {
|
|
434
434
|
case 0:
|
|
435
435
|
mockStream = {
|
|
@@ -486,16 +486,16 @@ describe('Call Tests', function () {
|
|
|
486
486
|
});
|
|
487
487
|
expect(bnrMetricSpy).toBeCalledOnceWith(_types4.METRIC_EVENT.BNR_DISABLED, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId());
|
|
488
488
|
call.end();
|
|
489
|
-
_context9.next =
|
|
489
|
+
_context9.next = 1;
|
|
490
490
|
return (0, _Utils.waitForMsecs)(50);
|
|
491
|
-
case
|
|
491
|
+
case 1:
|
|
492
492
|
/* Checks for switching off the listeners on call disconnect */
|
|
493
493
|
expect(offStreamSpy).toBeCalledTimes(2);
|
|
494
494
|
expect(offStreamSpy).toBeCalledWith(InternalMediaCoreModule.LocalStreamEventNames.OutputTrackChange, expect.any(Function));
|
|
495
495
|
expect(offStreamSpy).toBeCalledWith(InternalMediaCoreModule.LocalStreamEventNames.EffectAdded, expect.any(Function));
|
|
496
496
|
expect(offEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Enabled, expect.any(Function));
|
|
497
497
|
expect(offEffectSpy).toBeCalledWith(_webMediaEffects.EffectEvent.Disabled, expect.any(Function));
|
|
498
|
-
case
|
|
498
|
+
case 2:
|
|
499
499
|
case "end":
|
|
500
500
|
return _context9.stop();
|
|
501
501
|
}
|
|
@@ -503,7 +503,7 @@ describe('Call Tests', function () {
|
|
|
503
503
|
})));
|
|
504
504
|
it('answer fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
|
|
505
505
|
var mockStream, localAudioStream, warnSpy, call;
|
|
506
|
-
return _regenerator.default.wrap(function
|
|
506
|
+
return _regenerator.default.wrap(function (_context0) {
|
|
507
507
|
while (1) switch (_context0.prev = _context0.next) {
|
|
508
508
|
case 0:
|
|
509
509
|
mockStream = {
|
|
@@ -528,9 +528,9 @@ describe('Call Tests', function () {
|
|
|
528
528
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
529
529
|
call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
|
|
530
530
|
call.answer(localAudioStream);
|
|
531
|
-
_context0.next =
|
|
531
|
+
_context0.next = 1;
|
|
532
532
|
return (0, _Utils.waitForMsecs)(50);
|
|
533
|
-
case
|
|
533
|
+
case 1:
|
|
534
534
|
expect(warnSpy).toBeCalledTimes(2);
|
|
535
535
|
expect(warnSpy).toBeCalledWith("Did not find a local track while answering the call ".concat(call.getCorrelationId()), {
|
|
536
536
|
file: 'call',
|
|
@@ -541,7 +541,7 @@ describe('Call Tests', function () {
|
|
|
541
541
|
expect(call.getDisconnectReason().code).toBe(_types5.DisconnectCode.MEDIA_INACTIVITY);
|
|
542
542
|
expect(call.getDisconnectReason().cause).toBe(_types5.DisconnectCause.MEDIA_INACTIVITY);
|
|
543
543
|
expect(webex.request.mock.calls[0][0].body.metrics).toStrictEqual(disconnectStats);
|
|
544
|
-
case
|
|
544
|
+
case 2:
|
|
545
545
|
case "end":
|
|
546
546
|
return _context0.stop();
|
|
547
547
|
}
|
|
@@ -549,7 +549,7 @@ describe('Call Tests', function () {
|
|
|
549
549
|
})));
|
|
550
550
|
it('dial fails if localAudioTrack is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
551
551
|
var mockStream, localAudioStream, warnSpy, call;
|
|
552
|
-
return _regenerator.default.wrap(function
|
|
552
|
+
return _regenerator.default.wrap(function (_context1) {
|
|
553
553
|
while (1) switch (_context1.prev = _context1.next) {
|
|
554
554
|
case 0:
|
|
555
555
|
mockStream = {
|
|
@@ -562,9 +562,9 @@ describe('Call Tests', function () {
|
|
|
562
562
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
563
563
|
call = (0, _call.createCall)(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, deleteCallFromCollection, defaultServiceIndicator, dest);
|
|
564
564
|
call.dial(localAudioStream);
|
|
565
|
-
_context1.next =
|
|
565
|
+
_context1.next = 1;
|
|
566
566
|
return (0, _Utils.waitForMsecs)(50);
|
|
567
|
-
case
|
|
567
|
+
case 1:
|
|
568
568
|
expect(warnSpy).toBeCalledTimes(1);
|
|
569
569
|
expect(warnSpy).toBeCalledWith("Did not find a local track while dialing the call ".concat(call.getCorrelationId()), {
|
|
570
570
|
file: 'call',
|
|
@@ -573,7 +573,7 @@ describe('Call Tests', function () {
|
|
|
573
573
|
expect(call['callStateMachine'].state.value).toBe('S_IDLE');
|
|
574
574
|
expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_IDLE');
|
|
575
575
|
expect(webex.request).not.toBeCalledOnceWith();
|
|
576
|
-
case
|
|
576
|
+
case 2:
|
|
577
577
|
case "end":
|
|
578
578
|
return _context1.stop();
|
|
579
579
|
}
|
|
@@ -653,7 +653,7 @@ describe('Call Tests', function () {
|
|
|
653
653
|
});
|
|
654
654
|
it('test system mute and user mute different scnearios', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
655
655
|
var logSpy, callManager, mockStream, localAudioStream, call;
|
|
656
|
-
return _regenerator.default.wrap(function
|
|
656
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
657
657
|
while (1) switch (_context10.prev = _context10.next) {
|
|
658
658
|
case 0:
|
|
659
659
|
logSpy = jest.spyOn(_Logger.default, 'info');
|
|
@@ -728,7 +728,7 @@ describe('Call Tests', function () {
|
|
|
728
728
|
call.mute(localAudioStream, _types5.MUTE_TYPE.USER);
|
|
729
729
|
expect(call.isMuted()).toEqual(false);
|
|
730
730
|
expect(mockStream.setUserMuted).toBeCalledOnceWith(false);
|
|
731
|
-
case
|
|
731
|
+
case 1:
|
|
732
732
|
case "end":
|
|
733
733
|
return _context10.stop();
|
|
734
734
|
}
|
|
@@ -742,7 +742,7 @@ describe('Call Tests', function () {
|
|
|
742
742
|
var call;
|
|
743
743
|
it('outgoing call without guest calling must have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
744
744
|
var requestSpy, requestArgs;
|
|
745
|
-
return _regenerator.default.wrap(function
|
|
745
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
746
746
|
while (1) switch (_context11.prev = _context11.next) {
|
|
747
747
|
case 0:
|
|
748
748
|
call = new _call.Call(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, function () {
|
|
@@ -754,7 +754,7 @@ describe('Call Tests', function () {
|
|
|
754
754
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
755
755
|
requestArgs = requestSpy.mock.calls[0][0];
|
|
756
756
|
expect('callee' in requestArgs.body).toBe(true);
|
|
757
|
-
case
|
|
757
|
+
case 1:
|
|
758
758
|
case "end":
|
|
759
759
|
return _context11.stop();
|
|
760
760
|
}
|
|
@@ -762,7 +762,7 @@ describe('Call Tests', function () {
|
|
|
762
762
|
})));
|
|
763
763
|
it('outgoing call for guest calling must not have callee', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
764
764
|
var requestSpy, requestArgs;
|
|
765
|
-
return _regenerator.default.wrap(function
|
|
765
|
+
return _regenerator.default.wrap(function (_context12) {
|
|
766
766
|
while (1) switch (_context12.prev = _context12.next) {
|
|
767
767
|
case 0:
|
|
768
768
|
call = new _call.Call(activeUrl, webex, _types3.CallDirection.OUTBOUND, deviceId, mockLineId, function () {
|
|
@@ -774,7 +774,7 @@ describe('Call Tests', function () {
|
|
|
774
774
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
775
775
|
requestArgs = requestSpy.mock.calls[0][0];
|
|
776
776
|
expect('callee' in requestArgs.body).toBe(false);
|
|
777
|
-
case
|
|
777
|
+
case 1:
|
|
778
778
|
case "end":
|
|
779
779
|
return _context12.stop();
|
|
780
780
|
}
|
|
@@ -813,7 +813,7 @@ describe('State Machine handler tests', function () {
|
|
|
813
813
|
|
|
814
814
|
it('successful session refresh', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
815
815
|
var statusPayload, dummyEvent, funcSpy, logSpy;
|
|
816
|
-
return _regenerator.default.wrap(function
|
|
816
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
817
817
|
while (1) switch (_context13.prev = _context13.next) {
|
|
818
818
|
case 0:
|
|
819
819
|
statusPayload = {
|
|
@@ -834,29 +834,63 @@ describe('State Machine handler tests', function () {
|
|
|
834
834
|
/* This is to flush all the promises from the Promise queue so that
|
|
835
835
|
* Jest.fakeTimers can advance time and also clear the promise Queue
|
|
836
836
|
*/
|
|
837
|
-
_context13.next =
|
|
837
|
+
_context13.next = 1;
|
|
838
838
|
return (0, _testUtil.flushPromises)(3);
|
|
839
|
-
case
|
|
839
|
+
case 1:
|
|
840
840
|
expect(setInterval).toHaveBeenCalledTimes(1);
|
|
841
|
+
expect(setInterval).toHaveBeenCalledWith(expect.any(Function), _constants.DEFAULT_SESSION_TIMER);
|
|
841
842
|
expect(funcSpy).toBeCalledTimes(1);
|
|
842
843
|
expect(logSpy).toBeCalledWith('Session refresh successful', {
|
|
843
844
|
file: 'call',
|
|
844
|
-
method: '
|
|
845
|
+
method: 'scheduleCallKeepaliveInterval'
|
|
845
846
|
});
|
|
846
847
|
expect(logSpy).toHaveBeenCalledWith("".concat(_constants2.METHOD_START_MESSAGE, " with: ").concat(call.getCorrelationId()), {
|
|
847
848
|
file: 'call',
|
|
848
849
|
method: 'handleCallEstablished'
|
|
849
850
|
});
|
|
850
|
-
case
|
|
851
|
+
case 2:
|
|
851
852
|
case "end":
|
|
852
853
|
return _context13.stop();
|
|
853
854
|
}
|
|
854
855
|
}, _callee13);
|
|
855
856
|
})));
|
|
856
|
-
it('session refresh
|
|
857
|
-
var statusPayload, funcSpy;
|
|
858
|
-
return _regenerator.default.wrap(function
|
|
857
|
+
it('session refresh 401 emits token error and ends the call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
858
|
+
var statusPayload, emitSpy, funcSpy;
|
|
859
|
+
return _regenerator.default.wrap(function (_context14) {
|
|
859
860
|
while (1) switch (_context14.prev = _context14.next) {
|
|
861
|
+
case 0:
|
|
862
|
+
expect.assertions(4);
|
|
863
|
+
statusPayload = {
|
|
864
|
+
statusCode: 401
|
|
865
|
+
};
|
|
866
|
+
webex.request.mockReturnValue(statusPayload);
|
|
867
|
+
jest.spyOn(global, 'clearInterval');
|
|
868
|
+
emitSpy = jest.spyOn(call, 'emit');
|
|
869
|
+
call.on(_types2.CALL_EVENT_KEYS.CALL_ERROR, function (errObj) {
|
|
870
|
+
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TOKEN_ERROR);
|
|
871
|
+
});
|
|
872
|
+
funcSpy = jest.spyOn(call, 'postStatus').mockRejectedValue(statusPayload);
|
|
873
|
+
call['handleCallEstablished']({});
|
|
874
|
+
jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
|
|
875
|
+
_context14.next = 1;
|
|
876
|
+
return _promise.default.resolve();
|
|
877
|
+
case 1:
|
|
878
|
+
_context14.next = 2;
|
|
879
|
+
return _promise.default.resolve();
|
|
880
|
+
case 2:
|
|
881
|
+
expect(clearInterval).toHaveBeenCalledTimes(1);
|
|
882
|
+
expect(funcSpy).toBeCalledTimes(1);
|
|
883
|
+
expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
|
|
884
|
+
case 3:
|
|
885
|
+
case "end":
|
|
886
|
+
return _context14.stop();
|
|
887
|
+
}
|
|
888
|
+
}, _callee14);
|
|
889
|
+
})));
|
|
890
|
+
it('session refresh failure', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
891
|
+
var statusPayload, funcSpy;
|
|
892
|
+
return _regenerator.default.wrap(function (_context15) {
|
|
893
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
860
894
|
case 0:
|
|
861
895
|
expect.assertions(4);
|
|
862
896
|
statusPayload = {
|
|
@@ -869,35 +903,122 @@ describe('State Machine handler tests', function () {
|
|
|
869
903
|
expect(errObj.message).toStrictEqual('An unauthorized action has been received. This action has been blocked. Please contact the administrator if this persists.');
|
|
870
904
|
});
|
|
871
905
|
funcSpy = jest.spyOn(call, 'postStatus').mockRejectedValue(statusPayload);
|
|
872
|
-
if (call['sessionTimer'] === undefined) {
|
|
873
|
-
/* In cases where this test is run independently/alone, there is no sessionTimer initiated
|
|
874
|
-
Thus we will check and initialize the timer when not present by calling handleCallEstablish() */
|
|
875
|
-
call['handleCallEstablished']({});
|
|
876
|
-
}
|
|
877
906
|
call['handleCallEstablished']({});
|
|
878
907
|
jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
|
|
879
908
|
|
|
880
909
|
/* This is to flush all the promises from the Promise queue so that
|
|
881
910
|
* Jest.fakeTimers can advance time and also clear the promise Queue
|
|
882
911
|
*/
|
|
883
|
-
|
|
884
|
-
return
|
|
885
|
-
case
|
|
886
|
-
|
|
887
|
-
return _promise.default.resolve();
|
|
888
|
-
case 13:
|
|
889
|
-
expect(clearInterval).toHaveBeenCalledTimes(2); // check this
|
|
912
|
+
_context15.next = 1;
|
|
913
|
+
return (0, _testUtil.flushPromises)(2);
|
|
914
|
+
case 1:
|
|
915
|
+
expect(clearInterval).toHaveBeenCalledTimes(1);
|
|
890
916
|
expect(funcSpy).toBeCalledTimes(1);
|
|
891
|
-
case
|
|
917
|
+
case 2:
|
|
892
918
|
case "end":
|
|
893
|
-
return
|
|
919
|
+
return _context15.stop();
|
|
894
920
|
}
|
|
895
|
-
},
|
|
921
|
+
}, _callee15);
|
|
922
|
+
})));
|
|
923
|
+
it('session refresh 500 schedules retry via retry-after or default interval', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
924
|
+
var errorPayload, okPayload, scheduleKeepaliveSpy, postStatusSpy;
|
|
925
|
+
return _regenerator.default.wrap(function (_context16) {
|
|
926
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
927
|
+
case 0:
|
|
928
|
+
errorPayload = {
|
|
929
|
+
statusCode: 500,
|
|
930
|
+
headers: {
|
|
931
|
+
'retry-after': 1
|
|
932
|
+
}
|
|
933
|
+
};
|
|
934
|
+
okPayload = {
|
|
935
|
+
statusCode: 200,
|
|
936
|
+
body: {}
|
|
937
|
+
};
|
|
938
|
+
scheduleKeepaliveSpy = jest.spyOn(call, 'scheduleCallKeepaliveInterval');
|
|
939
|
+
postStatusSpy = jest.spyOn(call, 'postStatus').mockRejectedValueOnce(errorPayload).mockResolvedValueOnce(okPayload);
|
|
940
|
+
if (call['sessionTimer'] === undefined) {
|
|
941
|
+
call['handleCallEstablished']({});
|
|
942
|
+
}
|
|
943
|
+
jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
|
|
944
|
+
_context16.next = 1;
|
|
945
|
+
return (0, _testUtil.flushPromises)(2);
|
|
946
|
+
case 1:
|
|
947
|
+
expect(postStatusSpy).toHaveBeenCalledTimes(1);
|
|
948
|
+
|
|
949
|
+
// Now advance by 1 second for the retry-after interval
|
|
950
|
+
jest.advanceTimersByTime(1000);
|
|
951
|
+
_context16.next = 2;
|
|
952
|
+
return (0, _testUtil.flushPromises)(2);
|
|
953
|
+
case 2:
|
|
954
|
+
expect(postStatusSpy).toHaveBeenCalledTimes(2);
|
|
955
|
+
expect(scheduleKeepaliveSpy).toHaveBeenCalledTimes(2);
|
|
956
|
+
case 3:
|
|
957
|
+
case "end":
|
|
958
|
+
return _context16.stop();
|
|
959
|
+
}
|
|
960
|
+
}, _callee16);
|
|
961
|
+
})));
|
|
962
|
+
it('keepalive ends after reaching max retry count', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
963
|
+
var errorPayload, warnSpy, postStatusSpy;
|
|
964
|
+
return _regenerator.default.wrap(function (_context17) {
|
|
965
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
966
|
+
case 0:
|
|
967
|
+
errorPayload = {
|
|
968
|
+
statusCode: 500,
|
|
969
|
+
headers: {
|
|
970
|
+
'retry-after': 1
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
jest.spyOn(global, 'clearInterval');
|
|
974
|
+
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
975
|
+
postStatusSpy = jest.spyOn(call, 'postStatus').mockRejectedValue(errorPayload); // Put the call in the S_CALL_ESTABLISHED state and set it as connected
|
|
976
|
+
call['callStateMachine'].state.value = 'S_CALL_ESTABLISHED';
|
|
977
|
+
call['connected'] = true;
|
|
978
|
+
|
|
979
|
+
// Call handleCallEstablished which will setup interval
|
|
980
|
+
call['handleCallEstablished']({});
|
|
981
|
+
|
|
982
|
+
// Advance timer to trigger the first failure (uses DEFAULT_SESSION_TIMER)
|
|
983
|
+
jest.advanceTimersByTime(_constants.DEFAULT_SESSION_TIMER);
|
|
984
|
+
_context17.next = 1;
|
|
985
|
+
return (0, _testUtil.flushPromises)(2);
|
|
986
|
+
case 1:
|
|
987
|
+
// Now advance by 1 second for each of the 4 retry attempts (retry-after: 1 second each)
|
|
988
|
+
// Need to do this separately to allow state machine to process and create new intervals
|
|
989
|
+
jest.advanceTimersByTime(1000);
|
|
990
|
+
_context17.next = 2;
|
|
991
|
+
return (0, _testUtil.flushPromises)(2);
|
|
992
|
+
case 2:
|
|
993
|
+
jest.advanceTimersByTime(1000);
|
|
994
|
+
_context17.next = 3;
|
|
995
|
+
return (0, _testUtil.flushPromises)(2);
|
|
996
|
+
case 3:
|
|
997
|
+
jest.advanceTimersByTime(1000);
|
|
998
|
+
_context17.next = 4;
|
|
999
|
+
return (0, _testUtil.flushPromises)(2);
|
|
1000
|
+
case 4:
|
|
1001
|
+
jest.advanceTimersByTime(1000);
|
|
1002
|
+
_context17.next = 5;
|
|
1003
|
+
return (0, _testUtil.flushPromises)(2);
|
|
1004
|
+
case 5:
|
|
1005
|
+
// The error handler should detect we're at max retry count and stop
|
|
1006
|
+
expect(warnSpy).toHaveBeenCalledWith("Max keepalive retry attempts reached. Aborting call keepalive for callId: ".concat(call.getCallId()), {
|
|
1007
|
+
file: 'call',
|
|
1008
|
+
method: 'keepaliveRetryCallback'
|
|
1009
|
+
});
|
|
1010
|
+
expect(postStatusSpy).toHaveBeenCalledTimes(5);
|
|
1011
|
+
expect(call['callKeepaliveRetryCount']).toBe(4);
|
|
1012
|
+
case 6:
|
|
1013
|
+
case "end":
|
|
1014
|
+
return _context17.stop();
|
|
1015
|
+
}
|
|
1016
|
+
}, _callee17);
|
|
896
1017
|
})));
|
|
897
|
-
it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1018
|
+
it('state changes during successful incoming call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
898
1019
|
var statusPayload, dummyEvent, postMediaSpy, deleteSpy, dummyOkEvent;
|
|
899
|
-
return _regenerator.default.wrap(function
|
|
900
|
-
while (1) switch (
|
|
1020
|
+
return _regenerator.default.wrap(function (_context18) {
|
|
1021
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
901
1022
|
case 0:
|
|
902
1023
|
statusPayload = {
|
|
903
1024
|
statusCode: 200,
|
|
@@ -951,16 +1072,16 @@ describe('State Machine handler tests', function () {
|
|
|
951
1072
|
});
|
|
952
1073
|
expect(deleteSpy).toBeCalledOnceWith();
|
|
953
1074
|
expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
|
|
954
|
-
case
|
|
1075
|
+
case 1:
|
|
955
1076
|
case "end":
|
|
956
|
-
return
|
|
1077
|
+
return _context18.stop();
|
|
957
1078
|
}
|
|
958
|
-
},
|
|
1079
|
+
}, _callee18);
|
|
959
1080
|
})));
|
|
960
|
-
it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1081
|
+
it('state changes during unsuccessful incoming call due to no offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
961
1082
|
var statusPayload, dummyEvent;
|
|
962
|
-
return _regenerator.default.wrap(function
|
|
963
|
-
while (1) switch (
|
|
1083
|
+
return _regenerator.default.wrap(function (_context19) {
|
|
1084
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
964
1085
|
case 0:
|
|
965
1086
|
call['direction'] = _types3.CallDirection.INBOUND;
|
|
966
1087
|
statusPayload = {
|
|
@@ -978,11 +1099,11 @@ describe('State Machine handler tests', function () {
|
|
|
978
1099
|
webex.request.mockReturnValue(statusPayload);
|
|
979
1100
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
980
1101
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
|
|
981
|
-
|
|
1102
|
+
_context19.next = 1;
|
|
982
1103
|
return call['handleOutgoingCallConnect']({
|
|
983
1104
|
type: 'E_SEND_CALL_CONNECT'
|
|
984
1105
|
});
|
|
985
|
-
case
|
|
1106
|
+
case 1:
|
|
986
1107
|
/* state should not change since there is no offer received. */
|
|
987
1108
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
|
|
988
1109
|
expect(call.isConnected()).toBeFalsy();
|
|
@@ -990,16 +1111,16 @@ describe('State Machine handler tests', function () {
|
|
|
990
1111
|
type: 'E_RECV_CALL_DISCONNECT'
|
|
991
1112
|
});
|
|
992
1113
|
expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
|
|
993
|
-
case
|
|
1114
|
+
case 2:
|
|
994
1115
|
case "end":
|
|
995
|
-
return
|
|
1116
|
+
return _context19.stop();
|
|
996
1117
|
}
|
|
997
|
-
},
|
|
1118
|
+
}, _callee19);
|
|
998
1119
|
})));
|
|
999
|
-
it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1120
|
+
it('state changes during unsuccessful incoming call due error in call connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
1000
1121
|
var warnSpy, errorSpy, stateMachineSpy, statusPayload, roapMessage;
|
|
1001
|
-
return _regenerator.default.wrap(function
|
|
1002
|
-
while (1) switch (
|
|
1122
|
+
return _regenerator.default.wrap(function (_context20) {
|
|
1123
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1003
1124
|
case 0:
|
|
1004
1125
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
1005
1126
|
errorSpy = jest.spyOn(_Logger.default, 'error');
|
|
@@ -1026,25 +1147,25 @@ describe('State Machine handler tests', function () {
|
|
|
1026
1147
|
webex.request.mockRejectedValueOnce({
|
|
1027
1148
|
statusCode: 403
|
|
1028
1149
|
}).mockResolvedValue(statusPayload);
|
|
1029
|
-
|
|
1150
|
+
_context20.next = 1;
|
|
1030
1151
|
return call['handleOutgoingCallConnect']({
|
|
1031
1152
|
type: 'E_SEND_CALL_CONNECT'
|
|
1032
1153
|
});
|
|
1033
|
-
case
|
|
1154
|
+
case 1:
|
|
1034
1155
|
expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
|
|
1035
1156
|
expect(stateMachineSpy).toBeCalledTimes(3);
|
|
1036
1157
|
expect(warnSpy).toBeCalledTimes(3);
|
|
1037
1158
|
expect(errorSpy).toBeCalledTimes(1);
|
|
1038
|
-
case
|
|
1159
|
+
case 2:
|
|
1039
1160
|
case "end":
|
|
1040
|
-
return
|
|
1161
|
+
return _context20.stop();
|
|
1041
1162
|
}
|
|
1042
|
-
},
|
|
1163
|
+
}, _callee20);
|
|
1043
1164
|
})));
|
|
1044
|
-
it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1165
|
+
it('state changes during successful outgoing call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
1045
1166
|
var statusPayload, dummyEvent, postMediaSpy, logSpy, dummyOkEvent;
|
|
1046
|
-
return _regenerator.default.wrap(function
|
|
1047
|
-
while (1) switch (
|
|
1167
|
+
return _regenerator.default.wrap(function (_context21) {
|
|
1168
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1048
1169
|
case 0:
|
|
1049
1170
|
statusPayload = {
|
|
1050
1171
|
statusCode: 200,
|
|
@@ -1118,16 +1239,16 @@ describe('State Machine handler tests', function () {
|
|
|
1118
1239
|
type: 'E_SEND_CALL_DISCONNECT'
|
|
1119
1240
|
});
|
|
1120
1241
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
|
|
1121
|
-
case
|
|
1242
|
+
case 1:
|
|
1122
1243
|
case "end":
|
|
1123
|
-
return
|
|
1244
|
+
return _context21.stop();
|
|
1124
1245
|
}
|
|
1125
|
-
},
|
|
1246
|
+
}, _callee21);
|
|
1126
1247
|
})));
|
|
1127
|
-
it('outgoing call where we receive connect directly after setup. Media established before connect. test call and media state changes', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1248
|
+
it('outgoing call where we receive connect directly after setup. Media established before connect. test call and media state changes', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
1128
1249
|
var statusPayload, dummySetupEvent, dummyConnectEvent, dummyOfferEvent, dummyAnswerEvent, dummyOkEvent, postMediaSpy;
|
|
1129
|
-
return _regenerator.default.wrap(function
|
|
1130
|
-
while (1) switch (
|
|
1250
|
+
return _regenerator.default.wrap(function (_context22) {
|
|
1251
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1131
1252
|
case 0:
|
|
1132
1253
|
statusPayload = {
|
|
1133
1254
|
statusCode: 200,
|
|
@@ -1193,16 +1314,16 @@ describe('State Machine handler tests', function () {
|
|
|
1193
1314
|
type: 'E_SEND_CALL_DISCONNECT'
|
|
1194
1315
|
});
|
|
1195
1316
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_DISCONNECT');
|
|
1196
|
-
case
|
|
1317
|
+
case 1:
|
|
1197
1318
|
case "end":
|
|
1198
|
-
return
|
|
1319
|
+
return _context22.stop();
|
|
1199
1320
|
}
|
|
1200
|
-
},
|
|
1321
|
+
}, _callee22);
|
|
1201
1322
|
})));
|
|
1202
|
-
it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1323
|
+
it('state changes during successful outgoing call with early media', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
1203
1324
|
var statusPayload, dummyEvent;
|
|
1204
|
-
return _regenerator.default.wrap(function
|
|
1205
|
-
while (1) switch (
|
|
1325
|
+
return _regenerator.default.wrap(function (_context23) {
|
|
1326
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1206
1327
|
case 0:
|
|
1207
1328
|
statusPayload = {
|
|
1208
1329
|
statusCode: 200,
|
|
@@ -1239,16 +1360,16 @@ describe('State Machine handler tests', function () {
|
|
|
1239
1360
|
type: 'E_RECV_CALL_DISCONNECT'
|
|
1240
1361
|
});
|
|
1241
1362
|
expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_DISCONNECT');
|
|
1242
|
-
case
|
|
1363
|
+
case 1:
|
|
1243
1364
|
case "end":
|
|
1244
|
-
return
|
|
1365
|
+
return _context23.stop();
|
|
1245
1366
|
}
|
|
1246
|
-
},
|
|
1367
|
+
}, _callee23);
|
|
1247
1368
|
})));
|
|
1248
|
-
it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1369
|
+
it('state changes during unsuccessful outgoing call due to error in call setup', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
1249
1370
|
var statusPayload, dummyEvent, errorSpy;
|
|
1250
|
-
return _regenerator.default.wrap(function
|
|
1251
|
-
while (1) switch (
|
|
1371
|
+
return _regenerator.default.wrap(function (_context24) {
|
|
1372
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1252
1373
|
case 0:
|
|
1253
1374
|
statusPayload = {
|
|
1254
1375
|
statusCode: 403,
|
|
@@ -1265,25 +1386,25 @@ describe('State Machine handler tests', function () {
|
|
|
1265
1386
|
webex.request.mockRejectedValueOnce(statusPayload);
|
|
1266
1387
|
errorSpy = jest.spyOn(_Logger.default, 'error');
|
|
1267
1388
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
1268
|
-
|
|
1389
|
+
_context24.next = 1;
|
|
1269
1390
|
return (0, _testUtil.flushPromises)(3);
|
|
1270
|
-
case
|
|
1391
|
+
case 1:
|
|
1271
1392
|
expect(call['callStateMachine'].state.value).toBe('S_UNKNOWN');
|
|
1272
1393
|
expect(errorSpy).toHaveBeenCalled();
|
|
1273
1394
|
expect(uploadLogsSpy).toHaveBeenCalledWith({
|
|
1274
1395
|
correlationId: call.getCorrelationId(),
|
|
1275
1396
|
callId: call.getCallId()
|
|
1276
1397
|
});
|
|
1277
|
-
case
|
|
1398
|
+
case 2:
|
|
1278
1399
|
case "end":
|
|
1279
|
-
return
|
|
1400
|
+
return _context24.stop();
|
|
1280
1401
|
}
|
|
1281
|
-
},
|
|
1402
|
+
}, _callee24);
|
|
1282
1403
|
})));
|
|
1283
|
-
it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1404
|
+
it('state changes during unsuccessful outgoing call due to error in media ok', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
1284
1405
|
var statusPayload, dummyEvent, warnSpy;
|
|
1285
|
-
return _regenerator.default.wrap(function
|
|
1286
|
-
while (1) switch (
|
|
1406
|
+
return _regenerator.default.wrap(function (_context25) {
|
|
1407
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1287
1408
|
case 0:
|
|
1288
1409
|
statusPayload = {
|
|
1289
1410
|
statusCode: 403,
|
|
@@ -1302,33 +1423,33 @@ describe('State Machine handler tests', function () {
|
|
|
1302
1423
|
webex.request.mockRejectedValue(statusPayload);
|
|
1303
1424
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
1304
1425
|
jest.spyOn(Utils, 'uploadLogs').mockResolvedValue(undefined);
|
|
1305
|
-
|
|
1426
|
+
_context25.next = 1;
|
|
1306
1427
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
1307
|
-
case
|
|
1308
|
-
|
|
1428
|
+
case 1:
|
|
1429
|
+
_context25.next = 2;
|
|
1309
1430
|
return (0, _testUtil.flushPromises)(2);
|
|
1310
|
-
case
|
|
1431
|
+
case 2:
|
|
1311
1432
|
expect(call.isConnected()).toBe(false);
|
|
1312
|
-
expect(call['mediaStateMachine'].state.value).toBe('
|
|
1313
|
-
expect(call['callStateMachine'].state.value).toBe('
|
|
1433
|
+
expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_TEARDOWN');
|
|
1434
|
+
expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
|
|
1314
1435
|
expect(warnSpy).toHaveBeenCalledWith('Failed to process MediaOk request', {
|
|
1315
1436
|
file: 'call',
|
|
1316
1437
|
method: 'handleRoapEstablished'
|
|
1317
1438
|
});
|
|
1318
|
-
expect(
|
|
1319
|
-
|
|
1320
|
-
|
|
1439
|
+
expect(warnSpy).toHaveBeenCalledWith('Call failed due to media issue', {
|
|
1440
|
+
file: 'call',
|
|
1441
|
+
method: 'handleRoapError'
|
|
1321
1442
|
});
|
|
1322
|
-
case
|
|
1443
|
+
case 3:
|
|
1323
1444
|
case "end":
|
|
1324
|
-
return
|
|
1445
|
+
return _context25.stop();
|
|
1325
1446
|
}
|
|
1326
|
-
},
|
|
1447
|
+
}, _callee25);
|
|
1327
1448
|
})));
|
|
1328
|
-
it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1449
|
+
it('state changes during unsuccessful outgoing call since no sdp in offer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
1329
1450
|
var statusPayload, dummyEvent;
|
|
1330
|
-
return _regenerator.default.wrap(function
|
|
1331
|
-
while (1) switch (
|
|
1451
|
+
return _regenerator.default.wrap(function (_context26) {
|
|
1452
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1332
1453
|
case 0:
|
|
1333
1454
|
statusPayload = {
|
|
1334
1455
|
statusCode: 403,
|
|
@@ -1349,16 +1470,16 @@ describe('State Machine handler tests', function () {
|
|
|
1349
1470
|
and an initiateOffer request to be sent to SDK only once */
|
|
1350
1471
|
expect(call['mediaStateMachine'].state.value).toBe('S_SEND_ROAP_OFFER');
|
|
1351
1472
|
expect(_testUtil.mediaConnection.initiateOffer).toBeCalledOnceWith();
|
|
1352
|
-
case
|
|
1473
|
+
case 1:
|
|
1353
1474
|
case "end":
|
|
1354
|
-
return
|
|
1475
|
+
return _context26.stop();
|
|
1355
1476
|
}
|
|
1356
|
-
},
|
|
1477
|
+
}, _callee26);
|
|
1357
1478
|
})));
|
|
1358
|
-
it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1479
|
+
it('Outgoing Roap offer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
|
|
1359
1480
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
1360
|
-
return _regenerator.default.wrap(function
|
|
1361
|
-
while (1) switch (
|
|
1481
|
+
return _regenerator.default.wrap(function (_context27) {
|
|
1482
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1362
1483
|
case 0:
|
|
1363
1484
|
statusPayload = {
|
|
1364
1485
|
statusCode: 503,
|
|
@@ -1380,9 +1501,9 @@ describe('State Machine handler tests', function () {
|
|
|
1380
1501
|
}
|
|
1381
1502
|
};
|
|
1382
1503
|
call['connected'] = true;
|
|
1383
|
-
|
|
1504
|
+
_context27.next = 1;
|
|
1384
1505
|
return call['handleOutgoingRoapOffer']({}, dummyEvent);
|
|
1385
|
-
case
|
|
1506
|
+
case 1:
|
|
1386
1507
|
jest.advanceTimersByTime(1005);
|
|
1387
1508
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
1388
1509
|
expect(funcSpy).toHaveBeenCalledWith(dummyEvent.data);
|
|
@@ -1390,16 +1511,16 @@ describe('State Machine handler tests', function () {
|
|
|
1390
1511
|
/* first failure , and second because of retry-after */
|
|
1391
1512
|
expect(funcSpy).toHaveBeenCalledTimes(2);
|
|
1392
1513
|
expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
|
|
1393
|
-
case
|
|
1514
|
+
case 2:
|
|
1394
1515
|
case "end":
|
|
1395
|
-
return
|
|
1516
|
+
return _context27.stop();
|
|
1396
1517
|
}
|
|
1397
|
-
},
|
|
1518
|
+
}, _callee27);
|
|
1398
1519
|
})));
|
|
1399
|
-
it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1520
|
+
it('Outgoing Roap offer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
|
|
1400
1521
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
1401
|
-
return _regenerator.default.wrap(function
|
|
1402
|
-
while (1) switch (
|
|
1522
|
+
return _regenerator.default.wrap(function (_context28) {
|
|
1523
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1403
1524
|
case 0:
|
|
1404
1525
|
statusPayload = {
|
|
1405
1526
|
statusCode: 503,
|
|
@@ -1421,25 +1542,25 @@ describe('State Machine handler tests', function () {
|
|
|
1421
1542
|
}
|
|
1422
1543
|
};
|
|
1423
1544
|
call['connected'] = false;
|
|
1424
|
-
|
|
1545
|
+
_context28.next = 1;
|
|
1425
1546
|
return call['handleOutgoingRoapOffer']({}, dummyEvent);
|
|
1426
|
-
case
|
|
1547
|
+
case 1:
|
|
1427
1548
|
jest.advanceTimersByTime(1005);
|
|
1428
1549
|
expect(funcSpy).toBeCalledOnceWith(dummyEvent.data);
|
|
1429
1550
|
|
|
1430
1551
|
/* These shouldn't be called as call is not connected yet */
|
|
1431
1552
|
expect(setTimeout).not.toHaveBeenCalled();
|
|
1432
1553
|
expect(stateMachineSpy).not.toBeCalled();
|
|
1433
|
-
case
|
|
1554
|
+
case 2:
|
|
1434
1555
|
case "end":
|
|
1435
|
-
return
|
|
1556
|
+
return _context28.stop();
|
|
1436
1557
|
}
|
|
1437
|
-
},
|
|
1558
|
+
}, _callee28);
|
|
1438
1559
|
})));
|
|
1439
|
-
it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1560
|
+
it('Outgoing Roap Answer retry-after error case during midcall', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
|
|
1440
1561
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
1441
|
-
return _regenerator.default.wrap(function
|
|
1442
|
-
while (1) switch (
|
|
1562
|
+
return _regenerator.default.wrap(function (_context29) {
|
|
1563
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1443
1564
|
case 0:
|
|
1444
1565
|
statusPayload = {
|
|
1445
1566
|
statusCode: 503,
|
|
@@ -1461,9 +1582,9 @@ describe('State Machine handler tests', function () {
|
|
|
1461
1582
|
};
|
|
1462
1583
|
call['connected'] = true;
|
|
1463
1584
|
call['mediaStateMachine'].state.value = 'S_RECV_ROAP_OFFER';
|
|
1464
|
-
|
|
1585
|
+
_context29.next = 1;
|
|
1465
1586
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
1466
|
-
case
|
|
1587
|
+
case 1:
|
|
1467
1588
|
jest.advanceTimersByTime(1005);
|
|
1468
1589
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
1469
1590
|
expect(funcSpy).toHaveBeenCalledWith(dummyEvent.data);
|
|
@@ -1471,16 +1592,16 @@ describe('State Machine handler tests', function () {
|
|
|
1471
1592
|
/* first failure , and second because of retry-after */
|
|
1472
1593
|
expect(funcSpy).toHaveBeenCalledTimes(2);
|
|
1473
1594
|
expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
|
|
1474
|
-
case
|
|
1595
|
+
case 2:
|
|
1475
1596
|
case "end":
|
|
1476
|
-
return
|
|
1597
|
+
return _context29.stop();
|
|
1477
1598
|
}
|
|
1478
|
-
},
|
|
1599
|
+
}, _callee29);
|
|
1479
1600
|
})));
|
|
1480
|
-
it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1601
|
+
it('Outgoing Roap answer retry-after error case during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
|
|
1481
1602
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
1482
|
-
return _regenerator.default.wrap(function
|
|
1483
|
-
while (1) switch (
|
|
1603
|
+
return _regenerator.default.wrap(function (_context30) {
|
|
1604
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
1484
1605
|
case 0:
|
|
1485
1606
|
statusPayload = {
|
|
1486
1607
|
statusCode: 503,
|
|
@@ -1501,9 +1622,9 @@ describe('State Machine handler tests', function () {
|
|
|
1501
1622
|
}
|
|
1502
1623
|
};
|
|
1503
1624
|
call['connected'] = false;
|
|
1504
|
-
|
|
1625
|
+
_context30.next = 1;
|
|
1505
1626
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
1506
|
-
case
|
|
1627
|
+
case 1:
|
|
1507
1628
|
jest.advanceTimersByTime(1005);
|
|
1508
1629
|
expect(funcSpy).toBeCalledOnceWith(dummyEvent.data);
|
|
1509
1630
|
expect(funcSpy).toHaveBeenCalledTimes(1);
|
|
@@ -1511,16 +1632,16 @@ describe('State Machine handler tests', function () {
|
|
|
1511
1632
|
/* These shouldn't be called as call is not connected yet */
|
|
1512
1633
|
expect(setTimeout).not.toHaveBeenCalled();
|
|
1513
1634
|
expect(stateMachineSpy).not.toBeCalled();
|
|
1514
|
-
case
|
|
1635
|
+
case 2:
|
|
1515
1636
|
case "end":
|
|
1516
|
-
return
|
|
1637
|
+
return _context30.stop();
|
|
1517
1638
|
}
|
|
1518
|
-
},
|
|
1639
|
+
}, _callee30);
|
|
1519
1640
|
})));
|
|
1520
|
-
it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1641
|
+
it('ROAP error during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
|
|
1521
1642
|
var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
|
|
1522
|
-
return _regenerator.default.wrap(function
|
|
1523
|
-
while (1) switch (
|
|
1643
|
+
return _regenerator.default.wrap(function (_context31) {
|
|
1644
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1524
1645
|
case 0:
|
|
1525
1646
|
statusPayload = {
|
|
1526
1647
|
statusCode: 200,
|
|
@@ -1543,16 +1664,16 @@ describe('State Machine handler tests', function () {
|
|
|
1543
1664
|
expect(funcSpy).toBeCalledOnceWith(errorEvent.data);
|
|
1544
1665
|
expect(warnSpy).not.toHaveBeenCalled();
|
|
1545
1666
|
expect(stateMachineSpy).not.toHaveBeenCalled();
|
|
1546
|
-
case
|
|
1667
|
+
case 1:
|
|
1547
1668
|
case "end":
|
|
1548
|
-
return
|
|
1669
|
+
return _context31.stop();
|
|
1549
1670
|
}
|
|
1550
|
-
},
|
|
1671
|
+
}, _callee31);
|
|
1551
1672
|
})));
|
|
1552
|
-
it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1673
|
+
it('ROAP ok retry-after during mid call', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
|
|
1553
1674
|
var statusPayload, funcSpy, stateMachineSpy, dummyEvent;
|
|
1554
|
-
return _regenerator.default.wrap(function
|
|
1555
|
-
while (1) switch (
|
|
1675
|
+
return _regenerator.default.wrap(function (_context32) {
|
|
1676
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1556
1677
|
case 0:
|
|
1557
1678
|
statusPayload = {
|
|
1558
1679
|
statusCode: 503,
|
|
@@ -1574,9 +1695,9 @@ describe('State Machine handler tests', function () {
|
|
|
1574
1695
|
};
|
|
1575
1696
|
call['connected'] = true;
|
|
1576
1697
|
call['mediaStateMachine'].state.value = 'S_RECV_ROAP_ANSWER';
|
|
1577
|
-
|
|
1698
|
+
_context32.next = 1;
|
|
1578
1699
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
1579
|
-
case
|
|
1700
|
+
case 1:
|
|
1580
1701
|
jest.advanceTimersByTime(1005);
|
|
1581
1702
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
1582
1703
|
expect(funcSpy).toHaveBeenCalled();
|
|
@@ -1584,16 +1705,16 @@ describe('State Machine handler tests', function () {
|
|
|
1584
1705
|
/* first failure , and second because of retry-after */
|
|
1585
1706
|
expect(funcSpy).toHaveBeenCalledTimes(2);
|
|
1586
1707
|
expect(stateMachineSpy).toBeCalledOnceWith(dummyEvent);
|
|
1587
|
-
case
|
|
1708
|
+
case 2:
|
|
1588
1709
|
case "end":
|
|
1589
|
-
return
|
|
1710
|
+
return _context32.stop();
|
|
1590
1711
|
}
|
|
1591
|
-
},
|
|
1712
|
+
}, _callee32);
|
|
1592
1713
|
})));
|
|
1593
|
-
it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1714
|
+
it('Unable to communicate roap error with mobius', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
|
|
1594
1715
|
var statusPayload, stateMachineSpy, funcSpy, errorEvent;
|
|
1595
|
-
return _regenerator.default.wrap(function
|
|
1596
|
-
while (1) switch (
|
|
1716
|
+
return _regenerator.default.wrap(function (_context33) {
|
|
1717
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1597
1718
|
case 0:
|
|
1598
1719
|
statusPayload = {
|
|
1599
1720
|
statusCode: 403,
|
|
@@ -1614,16 +1735,16 @@ describe('State Machine handler tests', function () {
|
|
|
1614
1735
|
call.sendMediaStateMachineEvt(errorEvent);
|
|
1615
1736
|
expect(funcSpy).toBeCalledOnceWith(errorEvent.data);
|
|
1616
1737
|
expect(stateMachineSpy).not.toHaveBeenCalled();
|
|
1617
|
-
case
|
|
1738
|
+
case 1:
|
|
1618
1739
|
case "end":
|
|
1619
|
-
return
|
|
1740
|
+
return _context33.stop();
|
|
1620
1741
|
}
|
|
1621
|
-
},
|
|
1742
|
+
}, _callee33);
|
|
1622
1743
|
})));
|
|
1623
|
-
it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1744
|
+
it('ROAP error during call establishment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
|
|
1624
1745
|
var statusPayload, warnSpy, stateMachineSpy, funcSpy, errorEvent;
|
|
1625
|
-
return _regenerator.default.wrap(function
|
|
1626
|
-
while (1) switch (
|
|
1746
|
+
return _regenerator.default.wrap(function (_context34) {
|
|
1747
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
1627
1748
|
case 0:
|
|
1628
1749
|
statusPayload = {
|
|
1629
1750
|
statusCode: 200,
|
|
@@ -1641,9 +1762,9 @@ describe('State Machine handler tests', function () {
|
|
|
1641
1762
|
}
|
|
1642
1763
|
};
|
|
1643
1764
|
call['connected'] = false;
|
|
1644
|
-
|
|
1765
|
+
_context34.next = 1;
|
|
1645
1766
|
return call['handleRoapError']({}, errorEvent);
|
|
1646
|
-
case
|
|
1767
|
+
case 1:
|
|
1647
1768
|
expect(funcSpy).toBeCalledOnceWith(errorEvent.data);
|
|
1648
1769
|
expect(warnSpy).toBeCalledOnceWith('Call failed due to media issue', {
|
|
1649
1770
|
file: 'call',
|
|
@@ -1655,16 +1776,82 @@ describe('State Machine handler tests', function () {
|
|
|
1655
1776
|
},
|
|
1656
1777
|
type: 'E_UNKNOWN'
|
|
1657
1778
|
});
|
|
1658
|
-
case
|
|
1779
|
+
case 2:
|
|
1659
1780
|
case "end":
|
|
1660
|
-
return
|
|
1781
|
+
return _context34.stop();
|
|
1661
1782
|
}
|
|
1662
|
-
},
|
|
1783
|
+
}, _callee34);
|
|
1663
1784
|
})));
|
|
1664
|
-
it('
|
|
1785
|
+
it('incoming call: failing ROAP_ANSWER posts error path and tears down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
|
|
1786
|
+
var statusPayload, warnSpy, postMediaSpy, setupEvent, connectEvent, offerEvent, answerEvent;
|
|
1787
|
+
return _regenerator.default.wrap(function (_context35) {
|
|
1788
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1789
|
+
case 0:
|
|
1790
|
+
statusPayload = {
|
|
1791
|
+
statusCode: 403,
|
|
1792
|
+
body: mockStatusBody
|
|
1793
|
+
};
|
|
1794
|
+
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
1795
|
+
postMediaSpy = jest.spyOn(call, 'postMedia').mockRejectedValueOnce(statusPayload); // Simulate inbound call flow
|
|
1796
|
+
call['direction'] = _types3.CallDirection.INBOUND;
|
|
1797
|
+
setupEvent = {
|
|
1798
|
+
type: 'E_RECV_CALL_SETUP',
|
|
1799
|
+
data: {
|
|
1800
|
+
seq: 1,
|
|
1801
|
+
messageType: 'OFFER'
|
|
1802
|
+
}
|
|
1803
|
+
};
|
|
1804
|
+
call.sendCallStateMachineEvt(setupEvent);
|
|
1805
|
+
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_PROGRESS');
|
|
1806
|
+
connectEvent = {
|
|
1807
|
+
type: 'E_SEND_CALL_CONNECT'
|
|
1808
|
+
};
|
|
1809
|
+
call.sendCallStateMachineEvt(connectEvent);
|
|
1810
|
+
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_CONNECT');
|
|
1811
|
+
offerEvent = {
|
|
1812
|
+
type: 'E_RECV_ROAP_OFFER',
|
|
1813
|
+
data: {
|
|
1814
|
+
seq: 1,
|
|
1815
|
+
messageType: 'OFFER'
|
|
1816
|
+
}
|
|
1817
|
+
};
|
|
1818
|
+
call.sendMediaStateMachineEvt(offerEvent);
|
|
1819
|
+
answerEvent = {
|
|
1820
|
+
type: 'E_SEND_ROAP_ANSWER',
|
|
1821
|
+
data: {
|
|
1822
|
+
seq: 1,
|
|
1823
|
+
messageType: 'ANSWER'
|
|
1824
|
+
}
|
|
1825
|
+
};
|
|
1826
|
+
_context35.next = 1;
|
|
1827
|
+
return call.sendMediaStateMachineEvt(answerEvent);
|
|
1828
|
+
case 1:
|
|
1829
|
+
_context35.next = 2;
|
|
1830
|
+
return (0, _testUtil.flushPromises)(2);
|
|
1831
|
+
case 2:
|
|
1832
|
+
expect(postMediaSpy).toBeCalledOnceWith(answerEvent.data);
|
|
1833
|
+
expect(warnSpy).toHaveBeenCalledWith('Failed to send MediaAnswer request', {
|
|
1834
|
+
file: 'call',
|
|
1835
|
+
method: 'handleOutgoingRoapAnswer'
|
|
1836
|
+
});
|
|
1837
|
+
expect(warnSpy).toHaveBeenCalledWith('Call failed due to media issue', {
|
|
1838
|
+
file: 'call',
|
|
1839
|
+
method: 'handleRoapError'
|
|
1840
|
+
});
|
|
1841
|
+
|
|
1842
|
+
// Final state should be torn down and cleared for unconnected call
|
|
1843
|
+
expect(call['mediaStateMachine'].state.value).toBe('S_ROAP_TEARDOWN');
|
|
1844
|
+
expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
|
|
1845
|
+
case 3:
|
|
1846
|
+
case "end":
|
|
1847
|
+
return _context35.stop();
|
|
1848
|
+
}
|
|
1849
|
+
}, _callee35);
|
|
1850
|
+
})));
|
|
1851
|
+
it('state changes during successful incoming call with out of order events', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
|
|
1665
1852
|
var statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
|
|
1666
|
-
return _regenerator.default.wrap(function
|
|
1667
|
-
while (1) switch (
|
|
1853
|
+
return _regenerator.default.wrap(function (_context36) {
|
|
1854
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1668
1855
|
case 0:
|
|
1669
1856
|
statusPayload = {
|
|
1670
1857
|
statusCode: 200,
|
|
@@ -1697,9 +1884,9 @@ describe('State Machine handler tests', function () {
|
|
|
1697
1884
|
seq: 1,
|
|
1698
1885
|
messageType: 'ANSWER'
|
|
1699
1886
|
};
|
|
1700
|
-
|
|
1887
|
+
_context36.next = 1;
|
|
1701
1888
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1702
|
-
case
|
|
1889
|
+
case 1:
|
|
1703
1890
|
expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
|
|
1704
1891
|
|
|
1705
1892
|
/* we receive roap Offer Request followed by roap Ok from mobius and handle
|
|
@@ -1719,9 +1906,9 @@ describe('State Machine handler tests', function () {
|
|
|
1719
1906
|
seq: 2,
|
|
1720
1907
|
messageType: 'OFFER_REQUEST'
|
|
1721
1908
|
};
|
|
1722
|
-
|
|
1909
|
+
_context36.next = 2;
|
|
1723
1910
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1724
|
-
case
|
|
1911
|
+
case 2:
|
|
1725
1912
|
expect(call['receivedRoapOKSeq']).toBe(0);
|
|
1726
1913
|
expect(_testUtil.mediaConnection.roapMessageReceived).not.toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1727
1914
|
call.sendMediaStateMachineEvt(dummyOkEvent);
|
|
@@ -1769,18 +1956,18 @@ describe('State Machine handler tests', function () {
|
|
|
1769
1956
|
};
|
|
1770
1957
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
1771
1958
|
dummyEvent.type = 'E_RECV_ROAP_OFFER';
|
|
1772
|
-
|
|
1959
|
+
_context36.next = 3;
|
|
1773
1960
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1774
|
-
case
|
|
1961
|
+
case 3:
|
|
1775
1962
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1776
1963
|
dummyEvent.type = 'E_SEND_ROAP_ANSWER';
|
|
1777
1964
|
dummyEvent.data = {
|
|
1778
1965
|
seq: 3,
|
|
1779
1966
|
messageType: 'ANSWER'
|
|
1780
1967
|
};
|
|
1781
|
-
|
|
1968
|
+
_context36.next = 4;
|
|
1782
1969
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1783
|
-
case
|
|
1970
|
+
case 4:
|
|
1784
1971
|
expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1785
1972
|
dummyEvent.type = 'E_RECV_ROAP_OFFER';
|
|
1786
1973
|
dummyEvent.data = {
|
|
@@ -1797,9 +1984,9 @@ describe('State Machine handler tests', function () {
|
|
|
1797
1984
|
messageType: 'OK'
|
|
1798
1985
|
}
|
|
1799
1986
|
};
|
|
1800
|
-
|
|
1987
|
+
_context36.next = 5;
|
|
1801
1988
|
return call.sendMediaStateMachineEvt(dummyOkEvent);
|
|
1802
|
-
case
|
|
1989
|
+
case 5:
|
|
1803
1990
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenNthCalledWith(6, dummyOkEvent.data.message);
|
|
1804
1991
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1805
1992
|
dummyEvent.type = 'E_SEND_ROAP_ANSWER';
|
|
@@ -1810,16 +1997,16 @@ describe('State Machine handler tests', function () {
|
|
|
1810
1997
|
expect(call['mediaStateMachine'].state.value).toBe('S_RECV_ROAP_OFFER');
|
|
1811
1998
|
call.sendMediaStateMachineEvt(dummyEvent);
|
|
1812
1999
|
expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1813
|
-
case
|
|
2000
|
+
case 6:
|
|
1814
2001
|
case "end":
|
|
1815
|
-
return
|
|
2002
|
+
return _context36.stop();
|
|
1816
2003
|
}
|
|
1817
|
-
},
|
|
2004
|
+
}, _callee36);
|
|
1818
2005
|
})));
|
|
1819
|
-
it('successfully handles out of order events when ROAP OK is received while executing outgoingRoapAnswer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2006
|
+
it('successfully handles out of order events when ROAP OK is received while executing outgoingRoapAnswer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
|
|
1820
2007
|
var mockStatusBody, statusPayload, dummyEvent, postMediaSpy, dummyOkEvent, dummyOfferEvent;
|
|
1821
|
-
return _regenerator.default.wrap(function
|
|
1822
|
-
while (1) switch (
|
|
2008
|
+
return _regenerator.default.wrap(function (_context37) {
|
|
2009
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
1823
2010
|
case 0:
|
|
1824
2011
|
mockStatusBody = {
|
|
1825
2012
|
device: {
|
|
@@ -1859,9 +2046,9 @@ describe('State Machine handler tests', function () {
|
|
|
1859
2046
|
seq: 1,
|
|
1860
2047
|
messageType: 'ANSWER'
|
|
1861
2048
|
};
|
|
1862
|
-
|
|
2049
|
+
_context37.next = 1;
|
|
1863
2050
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1864
|
-
case
|
|
2051
|
+
case 1:
|
|
1865
2052
|
expect(postMediaSpy).toBeCalledOnceWith(dummyEvent.data);
|
|
1866
2053
|
|
|
1867
2054
|
/* we receive roap Offer Request followed by roap Ok from mobius and handle
|
|
@@ -1881,9 +2068,9 @@ describe('State Machine handler tests', function () {
|
|
|
1881
2068
|
seq: 2,
|
|
1882
2069
|
messageType: 'OFFER_REQUEST'
|
|
1883
2070
|
};
|
|
1884
|
-
|
|
2071
|
+
_context37.next = 2;
|
|
1885
2072
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1886
|
-
case
|
|
2073
|
+
case 2:
|
|
1887
2074
|
expect(call['receivedRoapOKSeq']).toBe(0);
|
|
1888
2075
|
expect(_testUtil.mediaConnection.roapMessageReceived).not.toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1889
2076
|
call.sendMediaStateMachineEvt(dummyOkEvent);
|
|
@@ -1931,18 +2118,18 @@ describe('State Machine handler tests', function () {
|
|
|
1931
2118
|
};
|
|
1932
2119
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
1933
2120
|
dummyEvent.type = 'E_RECV_ROAP_OFFER';
|
|
1934
|
-
|
|
2121
|
+
_context37.next = 3;
|
|
1935
2122
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1936
|
-
case
|
|
2123
|
+
case 3:
|
|
1937
2124
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1938
2125
|
dummyEvent.type = 'E_SEND_ROAP_ANSWER';
|
|
1939
2126
|
dummyEvent.data = {
|
|
1940
2127
|
seq: 3,
|
|
1941
2128
|
messageType: 'ANSWER'
|
|
1942
2129
|
};
|
|
1943
|
-
|
|
2130
|
+
_context37.next = 4;
|
|
1944
2131
|
return call.sendMediaStateMachineEvt(dummyEvent);
|
|
1945
|
-
case
|
|
2132
|
+
case 4:
|
|
1946
2133
|
expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1947
2134
|
dummyEvent.type = 'E_RECV_ROAP_OFFER';
|
|
1948
2135
|
dummyEvent.data = {
|
|
@@ -1957,9 +2144,9 @@ describe('State Machine handler tests', function () {
|
|
|
1957
2144
|
}
|
|
1958
2145
|
};
|
|
1959
2146
|
call.sendMediaStateMachineEvt(dummyEvent);
|
|
1960
|
-
|
|
2147
|
+
_context37.next = 5;
|
|
1961
2148
|
return call.sendMediaStateMachineEvt(dummyOkEvent);
|
|
1962
|
-
case
|
|
2149
|
+
case 5:
|
|
1963
2150
|
expect(call['receivedRoapOKSeq']).toBe(3);
|
|
1964
2151
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenNthCalledWith(6, dummyOkEvent.data.message);
|
|
1965
2152
|
expect(_testUtil.mediaConnection.roapMessageReceived).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
@@ -1971,16 +2158,16 @@ describe('State Machine handler tests', function () {
|
|
|
1971
2158
|
expect(call['mediaStateMachine'].state.value).toBe('S_RECV_ROAP_OFFER');
|
|
1972
2159
|
call.sendMediaStateMachineEvt(dummyEvent);
|
|
1973
2160
|
expect(postMediaSpy).toHaveBeenLastCalledWith(dummyEvent.data);
|
|
1974
|
-
case
|
|
2161
|
+
case 6:
|
|
1975
2162
|
case "end":
|
|
1976
|
-
return
|
|
2163
|
+
return _context37.stop();
|
|
1977
2164
|
}
|
|
1978
|
-
},
|
|
2165
|
+
}, _callee37);
|
|
1979
2166
|
})));
|
|
1980
|
-
it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2167
|
+
it('handle hold event successfully when media received after progress but before connect', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
|
|
1981
2168
|
var statusPayload, dummyEvent, postMediaSpy, infoSpy, dummyOkEvent;
|
|
1982
|
-
return _regenerator.default.wrap(function
|
|
1983
|
-
while (1) switch (
|
|
2169
|
+
return _regenerator.default.wrap(function (_context38) {
|
|
2170
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
1984
2171
|
case 0:
|
|
1985
2172
|
statusPayload = {
|
|
1986
2173
|
statusCode: 200,
|
|
@@ -2045,11 +2232,35 @@ describe('State Machine handler tests', function () {
|
|
|
2045
2232
|
file: 'call',
|
|
2046
2233
|
method: 'handleCallHold'
|
|
2047
2234
|
});
|
|
2048
|
-
case
|
|
2235
|
+
case 1:
|
|
2049
2236
|
case "end":
|
|
2050
|
-
return
|
|
2237
|
+
return _context38.stop();
|
|
2051
2238
|
}
|
|
2052
|
-
},
|
|
2239
|
+
}, _callee38);
|
|
2240
|
+
})));
|
|
2241
|
+
it('emits DISCONNECT before mobius delete request is invoked', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39() {
|
|
2242
|
+
var emitSpy, deleteSpy;
|
|
2243
|
+
return _regenerator.default.wrap(function (_context39) {
|
|
2244
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
2245
|
+
case 0:
|
|
2246
|
+
emitSpy = jest.spyOn(call, 'emit');
|
|
2247
|
+
deleteSpy = jest.spyOn(call, 'delete').mockResolvedValue({
|
|
2248
|
+
statusCode: 200
|
|
2249
|
+
});
|
|
2250
|
+
call.sendCallStateMachineEvt({
|
|
2251
|
+
type: 'E_RECV_CALL_DISCONNECT'
|
|
2252
|
+
});
|
|
2253
|
+
_context39.next = 1;
|
|
2254
|
+
return (0, _testUtil.flushPromises)(1);
|
|
2255
|
+
case 1:
|
|
2256
|
+
expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
|
|
2257
|
+
expect(deleteSpy).toHaveBeenCalled();
|
|
2258
|
+
expect(emitSpy.mock.invocationCallOrder[0]).toBeLessThan(deleteSpy.mock.invocationCallOrder[0]);
|
|
2259
|
+
case 2:
|
|
2260
|
+
case "end":
|
|
2261
|
+
return _context39.stop();
|
|
2262
|
+
}
|
|
2263
|
+
}, _callee39);
|
|
2053
2264
|
})));
|
|
2054
2265
|
describe('Call event timers tests', function () {
|
|
2055
2266
|
var callManager;
|
|
@@ -2060,10 +2271,10 @@ describe('State Machine handler tests', function () {
|
|
|
2060
2271
|
afterEach(function () {
|
|
2061
2272
|
jest.clearAllTimers();
|
|
2062
2273
|
});
|
|
2063
|
-
it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2274
|
+
it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
|
|
2064
2275
|
var statusPayload, dummyEvent, logSpy, emitSpy, deleteSpy, dummyOkEvent;
|
|
2065
|
-
return _regenerator.default.wrap(function
|
|
2066
|
-
while (1) switch (
|
|
2276
|
+
return _regenerator.default.wrap(function (_context40) {
|
|
2277
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
2067
2278
|
case 0:
|
|
2068
2279
|
statusPayload = {
|
|
2069
2280
|
statusCode: 200,
|
|
@@ -2080,9 +2291,9 @@ describe('State Machine handler tests', function () {
|
|
|
2080
2291
|
webex.request.mockReturnValue(statusPayload);
|
|
2081
2292
|
|
|
2082
2293
|
// handleOutgoingCallSetup is asynchronous
|
|
2083
|
-
|
|
2294
|
+
_context40.next = 1;
|
|
2084
2295
|
return call.sendCallStateMachineEvt(dummyEvent);
|
|
2085
|
-
case
|
|
2296
|
+
case 1:
|
|
2086
2297
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
|
|
2087
2298
|
dummyEvent.type = 'E_RECV_CALL_PROGRESS';
|
|
2088
2299
|
call.sendCallStateMachineEvt(dummyEvent);
|
|
@@ -2121,16 +2332,16 @@ describe('State Machine handler tests', function () {
|
|
|
2121
2332
|
expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
|
|
2122
2333
|
expect(deleteSpy).toHaveBeenCalledTimes(1);
|
|
2123
2334
|
expect(callManager.callCollection).toStrictEqual({});
|
|
2124
|
-
case
|
|
2335
|
+
case 2:
|
|
2125
2336
|
case "end":
|
|
2126
|
-
return
|
|
2337
|
+
return _context40.stop();
|
|
2127
2338
|
}
|
|
2128
|
-
},
|
|
2339
|
+
}, _callee40);
|
|
2129
2340
|
})));
|
|
2130
|
-
it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2341
|
+
it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
|
|
2131
2342
|
var statusPayload, dummyEvent, call, emitSpy, deleteSpy, logSpy;
|
|
2132
|
-
return _regenerator.default.wrap(function
|
|
2133
|
-
while (1) switch (
|
|
2343
|
+
return _regenerator.default.wrap(function (_context41) {
|
|
2344
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
2134
2345
|
case 0:
|
|
2135
2346
|
statusPayload = {
|
|
2136
2347
|
statusCode: 200,
|
|
@@ -2149,9 +2360,9 @@ describe('State Machine handler tests', function () {
|
|
|
2149
2360
|
expect((0, _keys.default)(callManager.callCollection)[0]).toBe(call.getCorrelationId());
|
|
2150
2361
|
|
|
2151
2362
|
// handleOutgoingCallSetup is asynchronous
|
|
2152
|
-
|
|
2363
|
+
_context41.next = 1;
|
|
2153
2364
|
return call.sendCallStateMachineEvt(dummyEvent);
|
|
2154
|
-
case
|
|
2365
|
+
case 1:
|
|
2155
2366
|
expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
|
|
2156
2367
|
logSpy.mockClear();
|
|
2157
2368
|
jest.advanceTimersByTime(10000);
|
|
@@ -2159,11 +2370,11 @@ describe('State Machine handler tests', function () {
|
|
|
2159
2370
|
expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
|
|
2160
2371
|
expect(deleteSpy).toHaveBeenCalledTimes(1);
|
|
2161
2372
|
expect(callManager.callCollection).toStrictEqual({});
|
|
2162
|
-
case
|
|
2373
|
+
case 2:
|
|
2163
2374
|
case "end":
|
|
2164
|
-
return
|
|
2375
|
+
return _context41.stop();
|
|
2165
2376
|
}
|
|
2166
|
-
},
|
|
2377
|
+
}, _callee41);
|
|
2167
2378
|
})));
|
|
2168
2379
|
});
|
|
2169
2380
|
});
|
|
@@ -2223,10 +2434,10 @@ describe('Supplementary Services tests', function () {
|
|
|
2223
2434
|
beforeEach(function () {
|
|
2224
2435
|
call.removeAllListeners();
|
|
2225
2436
|
});
|
|
2226
|
-
it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2437
|
+
it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43() {
|
|
2227
2438
|
var responsePayload, warnSpy, roapEvent;
|
|
2228
|
-
return _regenerator.default.wrap(function
|
|
2229
|
-
while (1) switch (
|
|
2439
|
+
return _regenerator.default.wrap(function (_context43) {
|
|
2440
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
2230
2441
|
case 0:
|
|
2231
2442
|
expect.assertions(7);
|
|
2232
2443
|
responsePayload = {
|
|
@@ -2239,27 +2450,27 @@ describe('Supplementary Services tests', function () {
|
|
|
2239
2450
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2240
2451
|
call['held'] = false;
|
|
2241
2452
|
call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
|
|
2242
|
-
var
|
|
2243
|
-
return _regenerator.default.wrap(function
|
|
2244
|
-
while (1) switch (
|
|
2453
|
+
var _ref43 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42(correlationId) {
|
|
2454
|
+
return _regenerator.default.wrap(function (_context42) {
|
|
2455
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
2245
2456
|
case 0:
|
|
2246
2457
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
2247
2458
|
case 1:
|
|
2248
2459
|
case "end":
|
|
2249
|
-
return
|
|
2460
|
+
return _context42.stop();
|
|
2250
2461
|
}
|
|
2251
|
-
},
|
|
2462
|
+
}, _callee42);
|
|
2252
2463
|
}));
|
|
2253
2464
|
return function (_x) {
|
|
2254
|
-
return
|
|
2465
|
+
return _ref43.apply(this, arguments);
|
|
2255
2466
|
};
|
|
2256
2467
|
}());
|
|
2257
|
-
|
|
2468
|
+
_context43.next = 1;
|
|
2258
2469
|
return call.doHoldResume();
|
|
2259
|
-
case
|
|
2260
|
-
|
|
2470
|
+
case 1:
|
|
2471
|
+
_context43.next = 2;
|
|
2261
2472
|
return (0, _testUtil.flushPromises)(2);
|
|
2262
|
-
case
|
|
2473
|
+
case 2:
|
|
2263
2474
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
2264
2475
|
call.handleMidCallEvent(mockHeldEvent);
|
|
2265
2476
|
|
|
@@ -2273,13 +2484,13 @@ describe('Supplementary Services tests', function () {
|
|
|
2273
2484
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2274
2485
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2275
2486
|
roapEvent.data.type = 'ANSWER';
|
|
2276
|
-
|
|
2487
|
+
_context43.next = 3;
|
|
2277
2488
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2278
|
-
case
|
|
2489
|
+
case 3:
|
|
2279
2490
|
roapEvent.data.type = 'OK';
|
|
2280
|
-
|
|
2491
|
+
_context43.next = 4;
|
|
2281
2492
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2282
|
-
case
|
|
2493
|
+
case 4:
|
|
2283
2494
|
expect(clearTimeout).toHaveBeenCalledTimes(1);
|
|
2284
2495
|
/* isHeld flag should be set and an Hold event should be emitted */
|
|
2285
2496
|
expect(call.isHeld()).toStrictEqual(true);
|
|
@@ -2290,16 +2501,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2290
2501
|
file: 'call',
|
|
2291
2502
|
method: 'handleCallHold'
|
|
2292
2503
|
});
|
|
2293
|
-
case
|
|
2504
|
+
case 5:
|
|
2294
2505
|
case "end":
|
|
2295
|
-
return
|
|
2506
|
+
return _context43.stop();
|
|
2296
2507
|
}
|
|
2297
|
-
},
|
|
2508
|
+
}, _callee43);
|
|
2298
2509
|
})));
|
|
2299
|
-
it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2510
|
+
it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45() {
|
|
2300
2511
|
var responsePayload, warnSpy, roapEvent;
|
|
2301
|
-
return _regenerator.default.wrap(function
|
|
2302
|
-
while (1) switch (
|
|
2512
|
+
return _regenerator.default.wrap(function (_context45) {
|
|
2513
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
2303
2514
|
case 0:
|
|
2304
2515
|
expect.assertions(8);
|
|
2305
2516
|
responsePayload = {
|
|
@@ -2312,28 +2523,28 @@ describe('Supplementary Services tests', function () {
|
|
|
2312
2523
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2313
2524
|
call['held'] = false;
|
|
2314
2525
|
call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
|
|
2315
|
-
var
|
|
2316
|
-
return _regenerator.default.wrap(function
|
|
2317
|
-
while (1) switch (
|
|
2526
|
+
var _ref45 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee44(correlationId) {
|
|
2527
|
+
return _regenerator.default.wrap(function (_context44) {
|
|
2528
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
2318
2529
|
case 0:
|
|
2319
2530
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
2320
2531
|
case 1:
|
|
2321
2532
|
case "end":
|
|
2322
|
-
return
|
|
2533
|
+
return _context44.stop();
|
|
2323
2534
|
}
|
|
2324
|
-
},
|
|
2535
|
+
}, _callee44);
|
|
2325
2536
|
}));
|
|
2326
2537
|
return function (_x2) {
|
|
2327
|
-
return
|
|
2538
|
+
return _ref45.apply(this, arguments);
|
|
2328
2539
|
};
|
|
2329
2540
|
}());
|
|
2330
2541
|
call.doHoldResume();
|
|
2331
|
-
|
|
2542
|
+
_context45.next = 1;
|
|
2332
2543
|
return _promise.default.resolve();
|
|
2333
|
-
case
|
|
2334
|
-
|
|
2544
|
+
case 1:
|
|
2545
|
+
_context45.next = 2;
|
|
2335
2546
|
return _promise.default.resolve();
|
|
2336
|
-
case
|
|
2547
|
+
case 2:
|
|
2337
2548
|
expect(setTimeout).not.toHaveBeenCalled();
|
|
2338
2549
|
call.handleMidCallEvent(mockHeldEvent);
|
|
2339
2550
|
|
|
@@ -2347,13 +2558,13 @@ describe('Supplementary Services tests', function () {
|
|
|
2347
2558
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2348
2559
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2349
2560
|
roapEvent.data.type = 'ANSWER';
|
|
2350
|
-
|
|
2561
|
+
_context45.next = 3;
|
|
2351
2562
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2352
|
-
case
|
|
2563
|
+
case 3:
|
|
2353
2564
|
roapEvent.data.type = 'OK';
|
|
2354
|
-
|
|
2565
|
+
_context45.next = 4;
|
|
2355
2566
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2356
|
-
case
|
|
2567
|
+
case 4:
|
|
2357
2568
|
expect(clearTimeout).not.toHaveBeenCalled();
|
|
2358
2569
|
/* isHeld flag should be set and an Hold event should be emitted */
|
|
2359
2570
|
expect(call.isHeld()).toStrictEqual(true);
|
|
@@ -2364,16 +2575,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2364
2575
|
file: 'call',
|
|
2365
2576
|
method: 'handleCallHold'
|
|
2366
2577
|
});
|
|
2367
|
-
case
|
|
2578
|
+
case 5:
|
|
2368
2579
|
case "end":
|
|
2369
|
-
return
|
|
2580
|
+
return _context45.stop();
|
|
2370
2581
|
}
|
|
2371
|
-
},
|
|
2582
|
+
}, _callee45);
|
|
2372
2583
|
})));
|
|
2373
|
-
it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2584
|
+
it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47() {
|
|
2374
2585
|
var responsePayload;
|
|
2375
|
-
return _regenerator.default.wrap(function
|
|
2376
|
-
while (1) switch (
|
|
2586
|
+
return _regenerator.default.wrap(function (_context47) {
|
|
2587
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
2377
2588
|
case 0:
|
|
2378
2589
|
expect.assertions(4);
|
|
2379
2590
|
responsePayload = {
|
|
@@ -2383,43 +2594,43 @@ describe('Supplementary Services tests', function () {
|
|
|
2383
2594
|
jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
|
|
2384
2595
|
call['held'] = false;
|
|
2385
2596
|
call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
|
|
2386
|
-
var
|
|
2387
|
-
return _regenerator.default.wrap(function
|
|
2388
|
-
while (1) switch (
|
|
2597
|
+
var _ref47 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46(errObj) {
|
|
2598
|
+
return _regenerator.default.wrap(function (_context46) {
|
|
2599
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
2389
2600
|
case 0:
|
|
2390
2601
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
|
|
2391
2602
|
expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
|
|
2392
|
-
case
|
|
2603
|
+
case 1:
|
|
2393
2604
|
case "end":
|
|
2394
|
-
return
|
|
2605
|
+
return _context46.stop();
|
|
2395
2606
|
}
|
|
2396
|
-
},
|
|
2607
|
+
}, _callee46);
|
|
2397
2608
|
}));
|
|
2398
2609
|
return function (_x3) {
|
|
2399
|
-
return
|
|
2610
|
+
return _ref47.apply(this, arguments);
|
|
2400
2611
|
};
|
|
2401
2612
|
}());
|
|
2402
|
-
|
|
2613
|
+
_context47.next = 1;
|
|
2403
2614
|
return call.doHoldResume();
|
|
2404
|
-
case
|
|
2405
|
-
|
|
2615
|
+
case 1:
|
|
2616
|
+
_context47.next = 2;
|
|
2406
2617
|
return (0, _testUtil.flushPromises)(2);
|
|
2407
|
-
case
|
|
2618
|
+
case 2:
|
|
2408
2619
|
expect(call.isHeld()).toStrictEqual(false);
|
|
2409
2620
|
|
|
2410
2621
|
/* At this point , the Call State should transition to S_CALL_ESTABLISHED
|
|
2411
2622
|
*/
|
|
2412
2623
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2413
|
-
case
|
|
2624
|
+
case 3:
|
|
2414
2625
|
case "end":
|
|
2415
|
-
return
|
|
2626
|
+
return _context47.stop();
|
|
2416
2627
|
}
|
|
2417
|
-
},
|
|
2628
|
+
}, _callee47);
|
|
2418
2629
|
})));
|
|
2419
|
-
it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2630
|
+
it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49() {
|
|
2420
2631
|
var responsePayload, rejectPayload, roapEvent;
|
|
2421
|
-
return _regenerator.default.wrap(function
|
|
2422
|
-
while (1) switch (
|
|
2632
|
+
return _regenerator.default.wrap(function (_context49) {
|
|
2633
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
2423
2634
|
case 0:
|
|
2424
2635
|
expect.assertions(5);
|
|
2425
2636
|
responsePayload = {
|
|
@@ -2433,26 +2644,26 @@ describe('Supplementary Services tests', function () {
|
|
|
2433
2644
|
jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
|
|
2434
2645
|
call['held'] = false;
|
|
2435
2646
|
call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
|
|
2436
|
-
var
|
|
2437
|
-
return _regenerator.default.wrap(function
|
|
2438
|
-
while (1) switch (
|
|
2647
|
+
var _ref49 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee48(errObj) {
|
|
2648
|
+
return _regenerator.default.wrap(function (_context48) {
|
|
2649
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
2439
2650
|
case 0:
|
|
2440
2651
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
|
|
2441
2652
|
expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
|
|
2442
|
-
case
|
|
2653
|
+
case 1:
|
|
2443
2654
|
case "end":
|
|
2444
|
-
return
|
|
2655
|
+
return _context48.stop();
|
|
2445
2656
|
}
|
|
2446
|
-
},
|
|
2657
|
+
}, _callee48);
|
|
2447
2658
|
}));
|
|
2448
2659
|
return function (_x4) {
|
|
2449
|
-
return
|
|
2660
|
+
return _ref49.apply(this, arguments);
|
|
2450
2661
|
};
|
|
2451
2662
|
}());
|
|
2452
2663
|
call.doHoldResume();
|
|
2453
|
-
|
|
2664
|
+
_context49.next = 1;
|
|
2454
2665
|
return (0, _testUtil.flushPromises)(2);
|
|
2455
|
-
case
|
|
2666
|
+
case 1:
|
|
2456
2667
|
/* the Call State should transition to S_CALL_ESTABLISHED
|
|
2457
2668
|
*/
|
|
2458
2669
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_HOLD');
|
|
@@ -2460,22 +2671,22 @@ describe('Supplementary Services tests', function () {
|
|
|
2460
2671
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2461
2672
|
/* We are intentionally failing the ROAP ANSWER */
|
|
2462
2673
|
roapEvent.data.type = 'ANSWER';
|
|
2463
|
-
|
|
2674
|
+
_context49.next = 2;
|
|
2464
2675
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2465
|
-
case
|
|
2676
|
+
case 2:
|
|
2466
2677
|
expect(call.isHeld()).toStrictEqual(false);
|
|
2467
2678
|
/* We should return back to call established state */
|
|
2468
2679
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2469
|
-
case
|
|
2680
|
+
case 3:
|
|
2470
2681
|
case "end":
|
|
2471
|
-
return
|
|
2682
|
+
return _context49.stop();
|
|
2472
2683
|
}
|
|
2473
|
-
},
|
|
2684
|
+
}, _callee49);
|
|
2474
2685
|
})));
|
|
2475
|
-
it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2686
|
+
it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee50() {
|
|
2476
2687
|
var responsePayload, warnSpy, roapEvent;
|
|
2477
|
-
return _regenerator.default.wrap(function
|
|
2478
|
-
while (1) switch (
|
|
2688
|
+
return _regenerator.default.wrap(function (_context50) {
|
|
2689
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
2479
2690
|
case 0:
|
|
2480
2691
|
responsePayload = {
|
|
2481
2692
|
statusCode: 200,
|
|
@@ -2486,12 +2697,12 @@ describe('Supplementary Services tests', function () {
|
|
|
2486
2697
|
jest.spyOn(global, 'clearTimeout');
|
|
2487
2698
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2488
2699
|
call['held'] = false;
|
|
2489
|
-
|
|
2700
|
+
_context50.next = 1;
|
|
2490
2701
|
return call.doHoldResume();
|
|
2491
|
-
case
|
|
2492
|
-
|
|
2702
|
+
case 1:
|
|
2703
|
+
_context50.next = 2;
|
|
2493
2704
|
return (0, _testUtil.flushPromises)(2);
|
|
2494
|
-
case
|
|
2705
|
+
case 2:
|
|
2495
2706
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
2496
2707
|
|
|
2497
2708
|
/* At this point, the Call State should be S_CALL_HOLD
|
|
@@ -2504,21 +2715,21 @@ describe('Supplementary Services tests', function () {
|
|
|
2504
2715
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2505
2716
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2506
2717
|
roapEvent.data.type = 'ANSWER';
|
|
2507
|
-
|
|
2718
|
+
_context50.next = 3;
|
|
2508
2719
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2509
|
-
case
|
|
2720
|
+
case 3:
|
|
2510
2721
|
jest.spyOn(webex, 'request').mockRejectedValue({
|
|
2511
2722
|
statusCode: 403
|
|
2512
2723
|
});
|
|
2513
2724
|
roapEvent.data.type = 'OK';
|
|
2514
|
-
|
|
2725
|
+
_context50.next = 4;
|
|
2515
2726
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2516
|
-
case
|
|
2727
|
+
case 4:
|
|
2517
2728
|
/* this is for coverage */
|
|
2518
2729
|
call['callStateMachine'].state.value = 'S_CALL_HOLD';
|
|
2519
|
-
|
|
2730
|
+
_context50.next = 5;
|
|
2520
2731
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2521
|
-
case
|
|
2732
|
+
case 5:
|
|
2522
2733
|
expect(call.isHeld()).toStrictEqual(false);
|
|
2523
2734
|
/* We should return back to call established state */
|
|
2524
2735
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
@@ -2526,16 +2737,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2526
2737
|
file: 'call',
|
|
2527
2738
|
method: 'handleRoapEstablished'
|
|
2528
2739
|
});
|
|
2529
|
-
case
|
|
2740
|
+
case 6:
|
|
2530
2741
|
case "end":
|
|
2531
|
-
return
|
|
2742
|
+
return _context50.stop();
|
|
2532
2743
|
}
|
|
2533
|
-
},
|
|
2744
|
+
}, _callee50);
|
|
2534
2745
|
})));
|
|
2535
|
-
it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2746
|
+
it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee51() {
|
|
2536
2747
|
var responsePayload, warnSpy, roapEvent;
|
|
2537
|
-
return _regenerator.default.wrap(function
|
|
2538
|
-
while (1) switch (
|
|
2748
|
+
return _regenerator.default.wrap(function (_context51) {
|
|
2749
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
2539
2750
|
case 0:
|
|
2540
2751
|
responsePayload = {
|
|
2541
2752
|
statusCode: 200,
|
|
@@ -2546,12 +2757,12 @@ describe('Supplementary Services tests', function () {
|
|
|
2546
2757
|
jest.spyOn(global, 'clearTimeout');
|
|
2547
2758
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2548
2759
|
call['held'] = true;
|
|
2549
|
-
|
|
2760
|
+
_context51.next = 1;
|
|
2550
2761
|
return call.doHoldResume();
|
|
2551
|
-
case
|
|
2552
|
-
|
|
2762
|
+
case 1:
|
|
2763
|
+
_context51.next = 2;
|
|
2553
2764
|
return (0, _testUtil.flushPromises)(2);
|
|
2554
|
-
case
|
|
2765
|
+
case 2:
|
|
2555
2766
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
2556
2767
|
|
|
2557
2768
|
/* At this point, the Call State should be S_CALL_RESUME
|
|
@@ -2564,16 +2775,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2564
2775
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2565
2776
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2566
2777
|
roapEvent.data.type = 'ANSWER';
|
|
2567
|
-
|
|
2778
|
+
_context51.next = 3;
|
|
2568
2779
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2569
|
-
case
|
|
2780
|
+
case 3:
|
|
2570
2781
|
jest.spyOn(webex, 'request').mockRejectedValue({
|
|
2571
2782
|
statusCode: 403
|
|
2572
2783
|
});
|
|
2573
2784
|
roapEvent.data.type = 'OK';
|
|
2574
|
-
|
|
2785
|
+
_context51.next = 4;
|
|
2575
2786
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2576
|
-
case
|
|
2787
|
+
case 4:
|
|
2577
2788
|
expect(call.isHeld()).toStrictEqual(true);
|
|
2578
2789
|
/* We should return back to call established state */
|
|
2579
2790
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
@@ -2581,16 +2792,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2581
2792
|
file: 'call',
|
|
2582
2793
|
method: 'handleRoapEstablished'
|
|
2583
2794
|
});
|
|
2584
|
-
case
|
|
2795
|
+
case 5:
|
|
2585
2796
|
case "end":
|
|
2586
|
-
return
|
|
2797
|
+
return _context51.stop();
|
|
2587
2798
|
}
|
|
2588
|
-
},
|
|
2799
|
+
}, _callee51);
|
|
2589
2800
|
})));
|
|
2590
|
-
it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2801
|
+
it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53() {
|
|
2591
2802
|
var responsePayload, roapEvent;
|
|
2592
|
-
return _regenerator.default.wrap(function
|
|
2593
|
-
while (1) switch (
|
|
2803
|
+
return _regenerator.default.wrap(function (_context53) {
|
|
2804
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
2594
2805
|
case 0:
|
|
2595
2806
|
expect.assertions(5);
|
|
2596
2807
|
responsePayload = {
|
|
@@ -2600,27 +2811,27 @@ describe('Supplementary Services tests', function () {
|
|
|
2600
2811
|
jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
|
|
2601
2812
|
call['held'] = false;
|
|
2602
2813
|
call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
|
|
2603
|
-
var
|
|
2604
|
-
return _regenerator.default.wrap(function
|
|
2605
|
-
while (1) switch (
|
|
2814
|
+
var _ref53 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee52(errObj) {
|
|
2815
|
+
return _regenerator.default.wrap(function (_context52) {
|
|
2816
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
2606
2817
|
case 0:
|
|
2607
2818
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
|
|
2608
2819
|
expect(errObj.message).toStrictEqual('An error occurred while placing the call on hold. Wait a moment and try again.');
|
|
2609
|
-
case
|
|
2820
|
+
case 1:
|
|
2610
2821
|
case "end":
|
|
2611
|
-
return
|
|
2822
|
+
return _context52.stop();
|
|
2612
2823
|
}
|
|
2613
|
-
},
|
|
2824
|
+
}, _callee52);
|
|
2614
2825
|
}));
|
|
2615
2826
|
return function (_x5) {
|
|
2616
|
-
return
|
|
2827
|
+
return _ref53.apply(this, arguments);
|
|
2617
2828
|
};
|
|
2618
2829
|
}());
|
|
2619
2830
|
jest.runAllTimers();
|
|
2620
2831
|
call.doHoldResume();
|
|
2621
|
-
|
|
2832
|
+
_context53.next = 1;
|
|
2622
2833
|
return (0, _testUtil.flushPromises)(2);
|
|
2623
|
-
case
|
|
2834
|
+
case 1:
|
|
2624
2835
|
/* At this point, the Call State should be S_CALL_HOLD
|
|
2625
2836
|
*/
|
|
2626
2837
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_HOLD');
|
|
@@ -2631,13 +2842,13 @@ describe('Supplementary Services tests', function () {
|
|
|
2631
2842
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2632
2843
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2633
2844
|
roapEvent.data.type = 'ANSWER';
|
|
2634
|
-
|
|
2845
|
+
_context53.next = 2;
|
|
2635
2846
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2636
|
-
case
|
|
2847
|
+
case 2:
|
|
2637
2848
|
roapEvent.data.type = 'OK';
|
|
2638
|
-
|
|
2849
|
+
_context53.next = 3;
|
|
2639
2850
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2640
|
-
case
|
|
2851
|
+
case 3:
|
|
2641
2852
|
/* Advancing timer by 12 seconds so that it gets timed out */
|
|
2642
2853
|
jest.advanceTimersByTime(12000);
|
|
2643
2854
|
|
|
@@ -2645,16 +2856,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2645
2856
|
expect(call.isHeld()).toStrictEqual(false);
|
|
2646
2857
|
/* We should return back to call established state */
|
|
2647
2858
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2648
|
-
case
|
|
2859
|
+
case 4:
|
|
2649
2860
|
case "end":
|
|
2650
|
-
return
|
|
2861
|
+
return _context53.stop();
|
|
2651
2862
|
}
|
|
2652
|
-
},
|
|
2863
|
+
}, _callee53);
|
|
2653
2864
|
})));
|
|
2654
|
-
it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2865
|
+
it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee55() {
|
|
2655
2866
|
var responsePayload, warnSpy, roapEvent;
|
|
2656
|
-
return _regenerator.default.wrap(function
|
|
2657
|
-
while (1) switch (
|
|
2867
|
+
return _regenerator.default.wrap(function (_context55) {
|
|
2868
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
2658
2869
|
case 0:
|
|
2659
2870
|
expect.assertions(7);
|
|
2660
2871
|
responsePayload = {
|
|
@@ -2667,27 +2878,27 @@ describe('Supplementary Services tests', function () {
|
|
|
2667
2878
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2668
2879
|
call['held'] = true;
|
|
2669
2880
|
call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
|
|
2670
|
-
var
|
|
2671
|
-
return _regenerator.default.wrap(function
|
|
2672
|
-
while (1) switch (
|
|
2881
|
+
var _ref55 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee54(correlationId) {
|
|
2882
|
+
return _regenerator.default.wrap(function (_context54) {
|
|
2883
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
2673
2884
|
case 0:
|
|
2674
2885
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
2675
2886
|
case 1:
|
|
2676
2887
|
case "end":
|
|
2677
|
-
return
|
|
2888
|
+
return _context54.stop();
|
|
2678
2889
|
}
|
|
2679
|
-
},
|
|
2890
|
+
}, _callee54);
|
|
2680
2891
|
}));
|
|
2681
2892
|
return function (_x6) {
|
|
2682
|
-
return
|
|
2893
|
+
return _ref55.apply(this, arguments);
|
|
2683
2894
|
};
|
|
2684
2895
|
}());
|
|
2685
|
-
|
|
2896
|
+
_context55.next = 1;
|
|
2686
2897
|
return call.doHoldResume();
|
|
2687
|
-
case
|
|
2688
|
-
|
|
2898
|
+
case 1:
|
|
2899
|
+
_context55.next = 2;
|
|
2689
2900
|
return (0, _testUtil.flushPromises)(2);
|
|
2690
|
-
case
|
|
2901
|
+
case 2:
|
|
2691
2902
|
expect(setTimeout).toHaveBeenCalledTimes(1);
|
|
2692
2903
|
call.handleMidCallEvent(mockResumeEvent);
|
|
2693
2904
|
|
|
@@ -2701,13 +2912,13 @@ describe('Supplementary Services tests', function () {
|
|
|
2701
2912
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2702
2913
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2703
2914
|
roapEvent.data.type = 'ANSWER';
|
|
2704
|
-
|
|
2915
|
+
_context55.next = 3;
|
|
2705
2916
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2706
|
-
case
|
|
2917
|
+
case 3:
|
|
2707
2918
|
roapEvent.data.type = 'OK';
|
|
2708
|
-
|
|
2919
|
+
_context55.next = 4;
|
|
2709
2920
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2710
|
-
case
|
|
2921
|
+
case 4:
|
|
2711
2922
|
expect(clearTimeout).toHaveBeenCalledTimes(1);
|
|
2712
2923
|
/* isHeld flag should not be set and an Resume event should be emitted */
|
|
2713
2924
|
expect(call.isHeld()).toStrictEqual(false);
|
|
@@ -2718,16 +2929,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2718
2929
|
file: 'call',
|
|
2719
2930
|
method: 'handleCallResume'
|
|
2720
2931
|
});
|
|
2721
|
-
case
|
|
2932
|
+
case 5:
|
|
2722
2933
|
case "end":
|
|
2723
|
-
return
|
|
2934
|
+
return _context55.stop();
|
|
2724
2935
|
}
|
|
2725
|
-
},
|
|
2936
|
+
}, _callee55);
|
|
2726
2937
|
})));
|
|
2727
|
-
it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2938
|
+
it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee57() {
|
|
2728
2939
|
var responsePayload, warnSpy, roapEvent;
|
|
2729
|
-
return _regenerator.default.wrap(function
|
|
2730
|
-
while (1) switch (
|
|
2940
|
+
return _regenerator.default.wrap(function (_context57) {
|
|
2941
|
+
while (1) switch (_context57.prev = _context57.next) {
|
|
2731
2942
|
case 0:
|
|
2732
2943
|
expect.assertions(7);
|
|
2733
2944
|
responsePayload = {
|
|
@@ -2740,28 +2951,28 @@ describe('Supplementary Services tests', function () {
|
|
|
2740
2951
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
2741
2952
|
call['held'] = true;
|
|
2742
2953
|
call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
|
|
2743
|
-
var
|
|
2744
|
-
return _regenerator.default.wrap(function
|
|
2745
|
-
while (1) switch (
|
|
2954
|
+
var _ref57 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee56(correlationId) {
|
|
2955
|
+
return _regenerator.default.wrap(function (_context56) {
|
|
2956
|
+
while (1) switch (_context56.prev = _context56.next) {
|
|
2746
2957
|
case 0:
|
|
2747
2958
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
2748
2959
|
case 1:
|
|
2749
2960
|
case "end":
|
|
2750
|
-
return
|
|
2961
|
+
return _context56.stop();
|
|
2751
2962
|
}
|
|
2752
|
-
},
|
|
2963
|
+
}, _callee56);
|
|
2753
2964
|
}));
|
|
2754
2965
|
return function (_x7) {
|
|
2755
|
-
return
|
|
2966
|
+
return _ref57.apply(this, arguments);
|
|
2756
2967
|
};
|
|
2757
2968
|
}());
|
|
2758
2969
|
call.doHoldResume();
|
|
2759
|
-
|
|
2970
|
+
_context57.next = 1;
|
|
2760
2971
|
return _promise.default.resolve();
|
|
2761
|
-
case
|
|
2762
|
-
|
|
2972
|
+
case 1:
|
|
2973
|
+
_context57.next = 2;
|
|
2763
2974
|
return _promise.default.resolve();
|
|
2764
|
-
case
|
|
2975
|
+
case 2:
|
|
2765
2976
|
expect(setTimeout).not.toHaveBeenCalled();
|
|
2766
2977
|
call.handleMidCallEvent(mockResumeEvent);
|
|
2767
2978
|
|
|
@@ -2775,13 +2986,13 @@ describe('Supplementary Services tests', function () {
|
|
|
2775
2986
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2776
2987
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2777
2988
|
roapEvent.data.type = 'ANSWER';
|
|
2778
|
-
|
|
2989
|
+
_context57.next = 3;
|
|
2779
2990
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2780
|
-
case
|
|
2991
|
+
case 3:
|
|
2781
2992
|
roapEvent.data.type = 'OK';
|
|
2782
|
-
|
|
2993
|
+
_context57.next = 4;
|
|
2783
2994
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2784
|
-
case
|
|
2995
|
+
case 4:
|
|
2785
2996
|
expect(clearTimeout).not.toHaveBeenCalled();
|
|
2786
2997
|
/* isHeld flag should not be set and an Resume event should be emitted */
|
|
2787
2998
|
expect(call.isHeld()).toStrictEqual(false);
|
|
@@ -2792,16 +3003,16 @@ describe('Supplementary Services tests', function () {
|
|
|
2792
3003
|
file: 'call',
|
|
2793
3004
|
method: 'handleCallResume'
|
|
2794
3005
|
});
|
|
2795
|
-
case
|
|
3006
|
+
case 5:
|
|
2796
3007
|
case "end":
|
|
2797
|
-
return
|
|
3008
|
+
return _context57.stop();
|
|
2798
3009
|
}
|
|
2799
|
-
},
|
|
3010
|
+
}, _callee57);
|
|
2800
3011
|
})));
|
|
2801
|
-
it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3012
|
+
it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee59() {
|
|
2802
3013
|
var responsePayload;
|
|
2803
|
-
return _regenerator.default.wrap(function
|
|
2804
|
-
while (1) switch (
|
|
3014
|
+
return _regenerator.default.wrap(function (_context59) {
|
|
3015
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
2805
3016
|
case 0:
|
|
2806
3017
|
expect.assertions(4);
|
|
2807
3018
|
responsePayload = {
|
|
@@ -2811,44 +3022,44 @@ describe('Supplementary Services tests', function () {
|
|
|
2811
3022
|
jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
|
|
2812
3023
|
call['held'] = true;
|
|
2813
3024
|
call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
|
|
2814
|
-
var
|
|
2815
|
-
return _regenerator.default.wrap(function
|
|
2816
|
-
while (1) switch (
|
|
3025
|
+
var _ref59 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee58(errObj) {
|
|
3026
|
+
return _regenerator.default.wrap(function (_context58) {
|
|
3027
|
+
while (1) switch (_context58.prev = _context58.next) {
|
|
2817
3028
|
case 0:
|
|
2818
3029
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
|
|
2819
3030
|
expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
|
|
2820
|
-
case
|
|
3031
|
+
case 1:
|
|
2821
3032
|
case "end":
|
|
2822
|
-
return
|
|
3033
|
+
return _context58.stop();
|
|
2823
3034
|
}
|
|
2824
|
-
},
|
|
3035
|
+
}, _callee58);
|
|
2825
3036
|
}));
|
|
2826
3037
|
return function (_x8) {
|
|
2827
|
-
return
|
|
3038
|
+
return _ref59.apply(this, arguments);
|
|
2828
3039
|
};
|
|
2829
3040
|
}());
|
|
2830
|
-
|
|
3041
|
+
_context59.next = 1;
|
|
2831
3042
|
return call.doHoldResume();
|
|
2832
|
-
case
|
|
2833
|
-
|
|
3043
|
+
case 1:
|
|
3044
|
+
_context59.next = 2;
|
|
2834
3045
|
return (0, _testUtil.flushPromises)(2);
|
|
2835
|
-
case
|
|
3046
|
+
case 2:
|
|
2836
3047
|
expect(call.isHeld()).toStrictEqual(true);
|
|
2837
3048
|
|
|
2838
3049
|
/* At this point , the Call State should transition to S_CALL_ESTABLISHED
|
|
2839
3050
|
*/
|
|
2840
3051
|
|
|
2841
3052
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2842
|
-
case
|
|
3053
|
+
case 3:
|
|
2843
3054
|
case "end":
|
|
2844
|
-
return
|
|
3055
|
+
return _context59.stop();
|
|
2845
3056
|
}
|
|
2846
|
-
},
|
|
3057
|
+
}, _callee59);
|
|
2847
3058
|
})));
|
|
2848
|
-
it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3059
|
+
it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee61() {
|
|
2849
3060
|
var responsePayload, rejectPayload, roapEvent;
|
|
2850
|
-
return _regenerator.default.wrap(function
|
|
2851
|
-
while (1) switch (
|
|
3061
|
+
return _regenerator.default.wrap(function (_context61) {
|
|
3062
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
2852
3063
|
case 0:
|
|
2853
3064
|
expect.assertions(5);
|
|
2854
3065
|
responsePayload = {
|
|
@@ -2862,26 +3073,26 @@ describe('Supplementary Services tests', function () {
|
|
|
2862
3073
|
jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
|
|
2863
3074
|
call['held'] = true;
|
|
2864
3075
|
call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
|
|
2865
|
-
var
|
|
2866
|
-
return _regenerator.default.wrap(function
|
|
2867
|
-
while (1) switch (
|
|
3076
|
+
var _ref61 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee60(errObj) {
|
|
3077
|
+
return _regenerator.default.wrap(function (_context60) {
|
|
3078
|
+
while (1) switch (_context60.prev = _context60.next) {
|
|
2868
3079
|
case 0:
|
|
2869
3080
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
|
|
2870
3081
|
expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
|
|
2871
|
-
case
|
|
3082
|
+
case 1:
|
|
2872
3083
|
case "end":
|
|
2873
|
-
return
|
|
3084
|
+
return _context60.stop();
|
|
2874
3085
|
}
|
|
2875
|
-
},
|
|
3086
|
+
}, _callee60);
|
|
2876
3087
|
}));
|
|
2877
3088
|
return function (_x9) {
|
|
2878
|
-
return
|
|
3089
|
+
return _ref61.apply(this, arguments);
|
|
2879
3090
|
};
|
|
2880
3091
|
}());
|
|
2881
3092
|
call.doHoldResume();
|
|
2882
|
-
|
|
3093
|
+
_context61.next = 1;
|
|
2883
3094
|
return (0, _testUtil.flushPromises)(2);
|
|
2884
|
-
case
|
|
3095
|
+
case 1:
|
|
2885
3096
|
/* At this point , the Call State should transition to S_CALL_ESTABLISHED
|
|
2886
3097
|
*/
|
|
2887
3098
|
|
|
@@ -2890,22 +3101,22 @@ describe('Supplementary Services tests', function () {
|
|
|
2890
3101
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2891
3102
|
/* We are intentionally failing the ROAP ANSWER */
|
|
2892
3103
|
roapEvent.data.type = 'ANSWER';
|
|
2893
|
-
|
|
3104
|
+
_context61.next = 2;
|
|
2894
3105
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2895
|
-
case
|
|
3106
|
+
case 2:
|
|
2896
3107
|
expect(call.isHeld()).toStrictEqual(true);
|
|
2897
3108
|
/* We should return back to call established state */
|
|
2898
3109
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2899
|
-
case
|
|
3110
|
+
case 3:
|
|
2900
3111
|
case "end":
|
|
2901
|
-
return
|
|
3112
|
+
return _context61.stop();
|
|
2902
3113
|
}
|
|
2903
|
-
},
|
|
3114
|
+
}, _callee61);
|
|
2904
3115
|
})));
|
|
2905
|
-
it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3116
|
+
it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee63() {
|
|
2906
3117
|
var responsePayload, roapEvent;
|
|
2907
|
-
return _regenerator.default.wrap(function
|
|
2908
|
-
while (1) switch (
|
|
3118
|
+
return _regenerator.default.wrap(function (_context63) {
|
|
3119
|
+
while (1) switch (_context63.prev = _context63.next) {
|
|
2909
3120
|
case 0:
|
|
2910
3121
|
expect.assertions(5);
|
|
2911
3122
|
responsePayload = {
|
|
@@ -2915,26 +3126,26 @@ describe('Supplementary Services tests', function () {
|
|
|
2915
3126
|
jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
|
|
2916
3127
|
call['held'] = true;
|
|
2917
3128
|
call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
|
|
2918
|
-
var
|
|
2919
|
-
return _regenerator.default.wrap(function
|
|
2920
|
-
while (1) switch (
|
|
3129
|
+
var _ref63 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee62(errObj) {
|
|
3130
|
+
return _regenerator.default.wrap(function (_context62) {
|
|
3131
|
+
while (1) switch (_context62.prev = _context62.next) {
|
|
2921
3132
|
case 0:
|
|
2922
3133
|
expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
|
|
2923
3134
|
expect(errObj.message).toStrictEqual('An error occurred while resuming the call. Wait a moment and try again.');
|
|
2924
|
-
case
|
|
3135
|
+
case 1:
|
|
2925
3136
|
case "end":
|
|
2926
|
-
return
|
|
3137
|
+
return _context62.stop();
|
|
2927
3138
|
}
|
|
2928
|
-
},
|
|
3139
|
+
}, _callee62);
|
|
2929
3140
|
}));
|
|
2930
3141
|
return function (_x0) {
|
|
2931
|
-
return
|
|
3142
|
+
return _ref63.apply(this, arguments);
|
|
2932
3143
|
};
|
|
2933
3144
|
}());
|
|
2934
3145
|
call.doHoldResume();
|
|
2935
|
-
|
|
3146
|
+
_context63.next = 1;
|
|
2936
3147
|
return (0, _testUtil.flushPromises)(2);
|
|
2937
|
-
case
|
|
3148
|
+
case 1:
|
|
2938
3149
|
/* At this point ,the Call State should be S_CALL_RESUME
|
|
2939
3150
|
*/
|
|
2940
3151
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_RESUME');
|
|
@@ -2945,23 +3156,23 @@ describe('Supplementary Services tests', function () {
|
|
|
2945
3156
|
call['handleIncomingRoapOffer']({}, dummyEvent);
|
|
2946
3157
|
roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
|
|
2947
3158
|
roapEvent.data.type = 'ANSWER';
|
|
2948
|
-
|
|
3159
|
+
_context63.next = 2;
|
|
2949
3160
|
return call['handleOutgoingRoapAnswer']({}, dummyEvent);
|
|
2950
|
-
case
|
|
3161
|
+
case 2:
|
|
2951
3162
|
roapEvent.data.type = 'OK';
|
|
2952
|
-
|
|
3163
|
+
_context63.next = 3;
|
|
2953
3164
|
return call['handleRoapEstablished']({}, dummyEvent);
|
|
2954
|
-
case
|
|
3165
|
+
case 3:
|
|
2955
3166
|
/* Advancing timer by 12 seconds so that it gets timed out */
|
|
2956
3167
|
jest.advanceTimersByTime(12000);
|
|
2957
3168
|
expect(call.isHeld()).toStrictEqual(true);
|
|
2958
3169
|
/* We should return back to call established state */
|
|
2959
3170
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
2960
|
-
case
|
|
3171
|
+
case 4:
|
|
2961
3172
|
case "end":
|
|
2962
|
-
return
|
|
3173
|
+
return _context63.stop();
|
|
2963
3174
|
}
|
|
2964
|
-
},
|
|
3175
|
+
}, _callee63);
|
|
2965
3176
|
})));
|
|
2966
3177
|
});
|
|
2967
3178
|
describe('Call transfer tests', function () {
|
|
@@ -2994,10 +3205,10 @@ describe('Supplementary Services tests', function () {
|
|
|
2994
3205
|
secondCall.removeAllListeners(_types2.CALL_EVENT_KEYS.CALL_ERROR);
|
|
2995
3206
|
secondCall['held'] = false;
|
|
2996
3207
|
});
|
|
2997
|
-
it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3208
|
+
it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee66() {
|
|
2998
3209
|
var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
|
|
2999
|
-
return _regenerator.default.wrap(function
|
|
3000
|
-
while (1) switch (
|
|
3210
|
+
return _regenerator.default.wrap(function (_context66) {
|
|
3211
|
+
while (1) switch (_context66.prev = _context66.next) {
|
|
3001
3212
|
case 0:
|
|
3002
3213
|
expect.assertions(12); // Updated to match actual assertion count
|
|
3003
3214
|
responsePayload = {
|
|
@@ -3009,43 +3220,43 @@ describe('Supplementary Services tests', function () {
|
|
|
3009
3220
|
infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
3010
3221
|
metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
|
|
3011
3222
|
call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
|
|
3012
|
-
var
|
|
3013
|
-
return _regenerator.default.wrap(function
|
|
3014
|
-
while (1) switch (
|
|
3223
|
+
var _ref65 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee64(correlationId) {
|
|
3224
|
+
return _regenerator.default.wrap(function (_context64) {
|
|
3225
|
+
while (1) switch (_context64.prev = _context64.next) {
|
|
3015
3226
|
case 0:
|
|
3016
3227
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
3017
3228
|
case 1:
|
|
3018
3229
|
case "end":
|
|
3019
|
-
return
|
|
3230
|
+
return _context64.stop();
|
|
3020
3231
|
}
|
|
3021
|
-
},
|
|
3232
|
+
}, _callee64);
|
|
3022
3233
|
}));
|
|
3023
3234
|
return function (_x1) {
|
|
3024
|
-
return
|
|
3235
|
+
return _ref65.apply(this, arguments);
|
|
3025
3236
|
};
|
|
3026
3237
|
}());
|
|
3027
3238
|
secondCall.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
|
|
3028
|
-
var
|
|
3029
|
-
return _regenerator.default.wrap(function
|
|
3030
|
-
while (1) switch (
|
|
3239
|
+
var _ref66 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee65(correlationId) {
|
|
3240
|
+
return _regenerator.default.wrap(function (_context65) {
|
|
3241
|
+
while (1) switch (_context65.prev = _context65.next) {
|
|
3031
3242
|
case 0:
|
|
3032
3243
|
expect(correlationId).toStrictEqual(secondCall.getCorrelationId());
|
|
3033
3244
|
case 1:
|
|
3034
3245
|
case "end":
|
|
3035
|
-
return
|
|
3246
|
+
return _context65.stop();
|
|
3036
3247
|
}
|
|
3037
|
-
},
|
|
3248
|
+
}, _callee65);
|
|
3038
3249
|
}));
|
|
3039
3250
|
return function (_x10) {
|
|
3040
|
-
return
|
|
3251
|
+
return _ref66.apply(this, arguments);
|
|
3041
3252
|
};
|
|
3042
3253
|
}());
|
|
3043
|
-
|
|
3254
|
+
_context66.next = 1;
|
|
3044
3255
|
return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
|
|
3045
|
-
case
|
|
3046
|
-
|
|
3256
|
+
case 1:
|
|
3257
|
+
_context66.next = 2;
|
|
3047
3258
|
return (0, _testUtil.flushPromises)(2);
|
|
3048
|
-
case
|
|
3259
|
+
case 2:
|
|
3049
3260
|
expect(requestSpy).toBeCalled();
|
|
3050
3261
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL, _types4.TRANSFER_ACTION.CONSULT, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined);
|
|
3051
3262
|
call.sendCallStateMachineEvt({
|
|
@@ -3064,16 +3275,16 @@ describe('Supplementary Services tests', function () {
|
|
|
3064
3275
|
expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3065
3276
|
expect(infoSpy).toHaveBeenCalledWith("Initiating Consult transfer between : ".concat(call.getCallId(), " and ").concat(secondCall.getCallId()), transferLoggingContext);
|
|
3066
3277
|
expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3067
|
-
case
|
|
3278
|
+
case 3:
|
|
3068
3279
|
case "end":
|
|
3069
|
-
return
|
|
3280
|
+
return _context66.stop();
|
|
3070
3281
|
}
|
|
3071
|
-
},
|
|
3282
|
+
}, _callee66);
|
|
3072
3283
|
})));
|
|
3073
|
-
it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3284
|
+
it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee68() {
|
|
3074
3285
|
var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
|
|
3075
|
-
return _regenerator.default.wrap(function
|
|
3076
|
-
while (1) switch (
|
|
3286
|
+
return _regenerator.default.wrap(function (_context68) {
|
|
3287
|
+
while (1) switch (_context68.prev = _context68.next) {
|
|
3077
3288
|
case 0:
|
|
3078
3289
|
expect.assertions(10); // Updated to match actual assertion count
|
|
3079
3290
|
responsePayload = {
|
|
@@ -3085,27 +3296,27 @@ describe('Supplementary Services tests', function () {
|
|
|
3085
3296
|
infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
3086
3297
|
metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
|
|
3087
3298
|
call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
|
|
3088
|
-
var
|
|
3089
|
-
return _regenerator.default.wrap(function
|
|
3090
|
-
while (1) switch (
|
|
3299
|
+
var _ref68 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee67(correlationId) {
|
|
3300
|
+
return _regenerator.default.wrap(function (_context67) {
|
|
3301
|
+
while (1) switch (_context67.prev = _context67.next) {
|
|
3091
3302
|
case 0:
|
|
3092
3303
|
expect(correlationId).toStrictEqual(call.getCorrelationId());
|
|
3093
3304
|
case 1:
|
|
3094
3305
|
case "end":
|
|
3095
|
-
return
|
|
3306
|
+
return _context67.stop();
|
|
3096
3307
|
}
|
|
3097
|
-
},
|
|
3308
|
+
}, _callee67);
|
|
3098
3309
|
}));
|
|
3099
3310
|
return function (_x11) {
|
|
3100
|
-
return
|
|
3311
|
+
return _ref68.apply(this, arguments);
|
|
3101
3312
|
};
|
|
3102
3313
|
}());
|
|
3103
|
-
|
|
3314
|
+
_context68.next = 1;
|
|
3104
3315
|
return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
|
|
3105
|
-
case
|
|
3106
|
-
|
|
3316
|
+
case 1:
|
|
3317
|
+
_context68.next = 2;
|
|
3107
3318
|
return (0, _testUtil.flushPromises)(2);
|
|
3108
|
-
case
|
|
3319
|
+
case 2:
|
|
3109
3320
|
expect(requestSpy).toBeCalled();
|
|
3110
3321
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL, _types4.TRANSFER_ACTION.BLIND, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), undefined);
|
|
3111
3322
|
call.sendCallStateMachineEvt({
|
|
@@ -3120,16 +3331,16 @@ describe('Supplementary Services tests', function () {
|
|
|
3120
3331
|
expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3121
3332
|
expect(infoSpy).toHaveBeenCalledWith("Initiating Blind transfer with : ".concat(transfereeNumber), transferLoggingContext);
|
|
3122
3333
|
expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3123
|
-
case
|
|
3334
|
+
case 3:
|
|
3124
3335
|
case "end":
|
|
3125
|
-
return
|
|
3336
|
+
return _context68.stop();
|
|
3126
3337
|
}
|
|
3127
|
-
},
|
|
3338
|
+
}, _callee68);
|
|
3128
3339
|
})));
|
|
3129
|
-
it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3340
|
+
it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee69() {
|
|
3130
3341
|
var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
|
|
3131
|
-
return _regenerator.default.wrap(function
|
|
3132
|
-
while (1) switch (
|
|
3342
|
+
return _regenerator.default.wrap(function (_context69) {
|
|
3343
|
+
while (1) switch (_context69.prev = _context69.next) {
|
|
3133
3344
|
case 0:
|
|
3134
3345
|
responsePayload = {
|
|
3135
3346
|
statusCode: 403,
|
|
@@ -3140,12 +3351,12 @@ describe('Supplementary Services tests', function () {
|
|
|
3140
3351
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
3141
3352
|
metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
|
|
3142
3353
|
call['broadworksCorrelationInfo'] = 'dummy-broadworks-correlation-info';
|
|
3143
|
-
|
|
3354
|
+
_context69.next = 1;
|
|
3144
3355
|
return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
|
|
3145
|
-
case
|
|
3146
|
-
|
|
3356
|
+
case 1:
|
|
3357
|
+
_context69.next = 2;
|
|
3147
3358
|
return (0, _testUtil.flushPromises)(1);
|
|
3148
|
-
case
|
|
3359
|
+
case 2:
|
|
3149
3360
|
expect(requestSpy).toBeCalled();
|
|
3150
3361
|
/* We should be in CALL_ESTABLISHED state */
|
|
3151
3362
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
@@ -3162,16 +3373,16 @@ describe('Supplementary Services tests', function () {
|
|
|
3162
3373
|
expect(emitSpy).toBeCalledOnceWith(_types2.CALL_EVENT_KEYS.TRANSFER_ERROR, expect.any(_Errors.CallError));
|
|
3163
3374
|
expect(warnSpy).toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3164
3375
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.BLIND, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
|
|
3165
|
-
case
|
|
3376
|
+
case 3:
|
|
3166
3377
|
case "end":
|
|
3167
|
-
return
|
|
3378
|
+
return _context69.stop();
|
|
3168
3379
|
}
|
|
3169
|
-
},
|
|
3380
|
+
}, _callee69);
|
|
3170
3381
|
})));
|
|
3171
|
-
it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3382
|
+
it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee70() {
|
|
3172
3383
|
var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
|
|
3173
|
-
return _regenerator.default.wrap(function
|
|
3174
|
-
while (1) switch (
|
|
3384
|
+
return _regenerator.default.wrap(function (_context70) {
|
|
3385
|
+
while (1) switch (_context70.prev = _context70.next) {
|
|
3175
3386
|
case 0:
|
|
3176
3387
|
responsePayload = {
|
|
3177
3388
|
statusCode: 403,
|
|
@@ -3181,12 +3392,12 @@ describe('Supplementary Services tests', function () {
|
|
|
3181
3392
|
requestSpy = jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
|
|
3182
3393
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
3183
3394
|
metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
|
|
3184
|
-
|
|
3395
|
+
_context70.next = 1;
|
|
3185
3396
|
return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
|
|
3186
|
-
case
|
|
3187
|
-
|
|
3397
|
+
case 1:
|
|
3398
|
+
_context70.next = 2;
|
|
3188
3399
|
return (0, _testUtil.flushPromises)(2);
|
|
3189
|
-
case
|
|
3400
|
+
case 2:
|
|
3190
3401
|
expect(requestSpy).toBeCalled();
|
|
3191
3402
|
/* We should be in CALL_ESTABLISHED state */
|
|
3192
3403
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
@@ -3203,22 +3414,22 @@ describe('Supplementary Services tests', function () {
|
|
|
3203
3414
|
expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.TRANSFER_ERROR, expect.any(_Errors.CallError));
|
|
3204
3415
|
expect(warnSpy).toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3205
3416
|
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.CONSULT, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
|
|
3206
|
-
case
|
|
3417
|
+
case 3:
|
|
3207
3418
|
case "end":
|
|
3208
|
-
return
|
|
3419
|
+
return _context70.stop();
|
|
3209
3420
|
}
|
|
3210
|
-
},
|
|
3421
|
+
}, _callee70);
|
|
3211
3422
|
})));
|
|
3212
|
-
it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3423
|
+
it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee71() {
|
|
3213
3424
|
var requestSpy, warnSpy;
|
|
3214
|
-
return _regenerator.default.wrap(function
|
|
3215
|
-
while (1) switch (
|
|
3425
|
+
return _regenerator.default.wrap(function (_context71) {
|
|
3426
|
+
while (1) switch (_context71.prev = _context71.next) {
|
|
3216
3427
|
case 0:
|
|
3217
3428
|
requestSpy = jest.spyOn(webex, 'request');
|
|
3218
3429
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
3219
|
-
|
|
3430
|
+
_context71.next = 1;
|
|
3220
3431
|
return call.completeTransfer(_types5.TransferType.BLIND, undefined, undefined);
|
|
3221
|
-
case
|
|
3432
|
+
case 1:
|
|
3222
3433
|
/* We should be in CALL_ESTABLISHED state */
|
|
3223
3434
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
3224
3435
|
expect(secondCall['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
@@ -3226,22 +3437,22 @@ describe('Supplementary Services tests', function () {
|
|
|
3226
3437
|
expect(uploadLogsSpy).not.toBeCalled();
|
|
3227
3438
|
expect(requestSpy).not.toBeCalled();
|
|
3228
3439
|
expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3229
|
-
case
|
|
3440
|
+
case 2:
|
|
3230
3441
|
case "end":
|
|
3231
|
-
return
|
|
3442
|
+
return _context71.stop();
|
|
3232
3443
|
}
|
|
3233
|
-
},
|
|
3444
|
+
}, _callee71);
|
|
3234
3445
|
})));
|
|
3235
|
-
it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
3446
|
+
it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee72() {
|
|
3236
3447
|
var requestSpy, warnSpy;
|
|
3237
|
-
return _regenerator.default.wrap(function
|
|
3238
|
-
while (1) switch (
|
|
3448
|
+
return _regenerator.default.wrap(function (_context72) {
|
|
3449
|
+
while (1) switch (_context72.prev = _context72.next) {
|
|
3239
3450
|
case 0:
|
|
3240
3451
|
requestSpy = jest.spyOn(webex, 'request');
|
|
3241
3452
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
3242
|
-
|
|
3453
|
+
_context72.next = 1;
|
|
3243
3454
|
return call.completeTransfer(_types5.TransferType.CONSULT, undefined, undefined);
|
|
3244
|
-
case
|
|
3455
|
+
case 1:
|
|
3245
3456
|
/* We should be in CALL_ESTABLISHED state */
|
|
3246
3457
|
expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
3247
3458
|
expect(secondCall['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
|
|
@@ -3249,11 +3460,11 @@ describe('Supplementary Services tests', function () {
|
|
|
3249
3460
|
expect(uploadLogsSpy).not.toBeCalled();
|
|
3250
3461
|
expect(requestSpy).not.toBeCalled();
|
|
3251
3462
|
expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
|
|
3252
|
-
case
|
|
3463
|
+
case 2:
|
|
3253
3464
|
case "end":
|
|
3254
|
-
return
|
|
3465
|
+
return _context72.stop();
|
|
3255
3466
|
}
|
|
3256
|
-
},
|
|
3467
|
+
}, _callee72);
|
|
3257
3468
|
})));
|
|
3258
3469
|
});
|
|
3259
3470
|
});
|