@webex/calling 3.12.0-llmrefactor.1 → 3.12.0-llmrefactor.2
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/CallingClient/constants.js +4 -2
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +4 -0
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +47 -10
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +466 -390
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +349 -80
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js +26 -0
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/Errors/types.js +2 -0
- package/dist/Errors/types.js.map +1 -1
- package/dist/Events/types.js.map +1 -1
- package/dist/common/Utils.js +85 -50
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +270 -195
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/module/CallingClient/constants.js +2 -0
- package/dist/module/CallingClient/line/index.js +2 -0
- package/dist/module/CallingClient/registration/register.js +36 -10
- package/dist/module/CallingClient/registration/types.js +5 -1
- package/dist/module/Errors/types.js +2 -0
- package/dist/module/common/Utils.js +26 -8
- package/dist/types/CallingClient/constants.d.ts +2 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +2 -1
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +23 -0
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/Errors/types.d.ts +2 -0
- package/dist/types/Errors/types.d.ts.map +1 -1
- package/dist/types/Events/types.d.ts +1 -1
- package/dist/types/Events/types.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +2 -5
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/package.json +9 -9
|
@@ -39,6 +39,7 @@ var mockSubmitRegistrationMetric = jest.fn();
|
|
|
39
39
|
var mockEmitterCb = jest.fn();
|
|
40
40
|
var mockRestoreCb = jest.fn();
|
|
41
41
|
var mock429RetryCb = jest.fn();
|
|
42
|
+
var mockSessionSupersededCb = jest.fn();
|
|
42
43
|
var webex = (0, _testUtil.getTestUtilsWebex)();
|
|
43
44
|
_SDKConnector.default.setWebex(webex);
|
|
44
45
|
webex.internal.metrics.submitClientMetrics = mockSubmitRegistrationMetric;
|
|
@@ -453,6 +454,19 @@ describe('Registration Tests', function () {
|
|
|
453
454
|
restoreCbExpected: false,
|
|
454
455
|
retry429CbExpected: false,
|
|
455
456
|
logMsg: '400 Bad Request'
|
|
457
|
+
}, {
|
|
458
|
+
name: 'verify 409 error response',
|
|
459
|
+
statusCode: _types2.ERROR_CODE.CONFLICT,
|
|
460
|
+
deviceErrorCode: 0,
|
|
461
|
+
message: _constants.SESSION_SUPERSEDED_MESSAGE,
|
|
462
|
+
errorType: _types2.ERROR_TYPE.SESSION_SUPERSEDED,
|
|
463
|
+
emitterCbExpected: false,
|
|
464
|
+
finalError: true,
|
|
465
|
+
restoreCbExpected: false,
|
|
466
|
+
retry429CbExpected: false,
|
|
467
|
+
sessionSupersededCbExpected: true,
|
|
468
|
+
handledByCallback: true,
|
|
469
|
+
logMsg: '409 Conflict: session superseded by another device for this user'
|
|
456
470
|
}, {
|
|
457
471
|
name: 'verify unknown error response',
|
|
458
472
|
statusCode: 206,
|
|
@@ -478,55 +492,116 @@ describe('Registration Tests', function () {
|
|
|
478
492
|
};
|
|
479
493
|
|
|
480
494
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
481
|
-
it.each(errorCodes)('%s', function (
|
|
482
|
-
var
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
495
|
+
it.each(errorCodes)('%s', /*#__PURE__*/function () {
|
|
496
|
+
var _ref8 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8(codeObj) {
|
|
497
|
+
var webexPayload, mockErrorEvent, callClientError, result;
|
|
498
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
499
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
500
|
+
case 0:
|
|
501
|
+
webexPayload = {
|
|
502
|
+
statusCode: codeObj.statusCode,
|
|
503
|
+
headers: _objectSpread({
|
|
504
|
+
trackingid: 'webex-js-sdk_b5812e58-7246-4a9b-bf64-831bdf13b0cd_31'
|
|
505
|
+
}, codeObj.retryAfter && {
|
|
506
|
+
'retry-after': codeObj.retryAfter.toString()
|
|
507
|
+
}),
|
|
508
|
+
body: {
|
|
509
|
+
device: {
|
|
510
|
+
deviceId: '8a67806f-fc4d-446b-a131-31e71ea5b010'
|
|
511
|
+
},
|
|
512
|
+
userId: '8a67806f-fc4d-446b-a131-31e71ea5b0e9',
|
|
513
|
+
errorCode: codeObj.deviceErrorCode,
|
|
514
|
+
devices: [{
|
|
515
|
+
deviceId: '8a67806f-fc4d-446b-a131-31e71ea5b010',
|
|
516
|
+
uri: 'https://mobius.webex.com/api/v1/calling/web/',
|
|
517
|
+
status: 'active',
|
|
518
|
+
lastSeen: '2022-04-07T18:00:40Z',
|
|
519
|
+
addresses: ['sip:sipAddress@webex.com']
|
|
520
|
+
}]
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
if (codeObj.customBodyPresent) {
|
|
524
|
+
webexPayload.body = codeObj.body;
|
|
525
|
+
}
|
|
526
|
+
mockErrorEvent = {
|
|
527
|
+
type: codeObj.errorType,
|
|
528
|
+
message: codeObj.message,
|
|
529
|
+
context: logObj
|
|
530
|
+
};
|
|
531
|
+
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
532
|
+
_context8.next = 1;
|
|
533
|
+
return (0, _Utils.handleRegistrationErrors)(webexPayload, mockEmitterCb, logObj, {
|
|
534
|
+
retry429Cb: mock429RetryCb,
|
|
535
|
+
restoreRegCb: mockRestoreCb,
|
|
536
|
+
sessionSupersededCb: mockSessionSupersededCb
|
|
537
|
+
});
|
|
538
|
+
case 1:
|
|
539
|
+
result = _context8.sent;
|
|
540
|
+
expect(result.finalError).toBe(codeObj.finalError);
|
|
541
|
+
expect(result.handledByCallback).toBe(!!codeObj.handledByCallback);
|
|
542
|
+
if (codeObj.emitterCbExpected) {
|
|
543
|
+
expect(mockEmitterCb).toBeCalledOnceWith(callClientError, codeObj.finalError);
|
|
544
|
+
} else {
|
|
545
|
+
expect(mockEmitterCb).not.toHaveBeenCalled();
|
|
546
|
+
}
|
|
547
|
+
if (codeObj.restoreCbExpected) {
|
|
548
|
+
expect(mockRestoreCb).toBeCalledOnceWith(webexPayload.body, logObj.method);
|
|
549
|
+
} else {
|
|
550
|
+
expect(mockRestoreCb).not.toHaveBeenCalled();
|
|
551
|
+
}
|
|
552
|
+
if (codeObj.retry429CbExpected) {
|
|
553
|
+
expect(mock429RetryCb).toBeCalledOnceWith(codeObj.retryAfter, logObj.method);
|
|
554
|
+
} else {
|
|
555
|
+
expect(mock429RetryCb).not.toHaveBeenCalled();
|
|
556
|
+
}
|
|
557
|
+
if (codeObj.sessionSupersededCbExpected) {
|
|
558
|
+
expect(mockSessionSupersededCb).toBeCalledOnceWith(callClientError);
|
|
559
|
+
} else {
|
|
560
|
+
expect(mockSessionSupersededCb).not.toHaveBeenCalled();
|
|
561
|
+
}
|
|
562
|
+
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(codeObj.statusCode), logObj);
|
|
563
|
+
expect(logSpy).toHaveBeenCalledWith(codeObj.logMsg, logObj);
|
|
564
|
+
case 2:
|
|
565
|
+
case "end":
|
|
566
|
+
return _context8.stop();
|
|
567
|
+
}
|
|
568
|
+
}, _callee8);
|
|
569
|
+
}));
|
|
570
|
+
return function (_x) {
|
|
571
|
+
return _ref8.apply(this, arguments);
|
|
511
572
|
};
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
573
|
+
}());
|
|
574
|
+
it('verify 409 response for a caller that does not handle a superseded session', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
575
|
+
var webexPayload, result;
|
|
576
|
+
return _regenerator.default.wrap(function (_context9) {
|
|
577
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
578
|
+
case 0:
|
|
579
|
+
webexPayload = {
|
|
580
|
+
statusCode: _types2.ERROR_CODE.CONFLICT,
|
|
581
|
+
headers: {
|
|
582
|
+
trackingid: 'webex-js-sdk_b5812e58-7246-4a9b-bf64-831bdf13b0cd_31'
|
|
583
|
+
}
|
|
584
|
+
};
|
|
585
|
+
_context9.next = 1;
|
|
586
|
+
return (0, _Utils.handleRegistrationErrors)(webexPayload, mockEmitterCb, logObj, {
|
|
587
|
+
retry429Cb: mock429RetryCb,
|
|
588
|
+
restoreRegCb: mockRestoreCb
|
|
589
|
+
});
|
|
590
|
+
case 1:
|
|
591
|
+
result = _context9.sent;
|
|
592
|
+
expect(result).toStrictEqual({
|
|
593
|
+
finalError: false,
|
|
594
|
+
shouldDisconnect: false,
|
|
595
|
+
handledByCallback: false
|
|
596
|
+
});
|
|
597
|
+
expect(mockEmitterCb).toBeCalledOnceWith(new _Errors.CallingClientError('Unknown error', logObj, _types2.ERROR_TYPE.DEFAULT, _types.RegistrationStatus.ACTIVE), false);
|
|
598
|
+
expect(logSpy).toHaveBeenCalledWith('Unknown Error', logObj);
|
|
599
|
+
case 2:
|
|
600
|
+
case "end":
|
|
601
|
+
return _context9.stop();
|
|
602
|
+
}
|
|
603
|
+
}, _callee9);
|
|
604
|
+
})));
|
|
530
605
|
});
|
|
531
606
|
describe('CallingClient Error Tests', function () {
|
|
532
607
|
var logSpy = jest.spyOn(_Logger.default, 'warn');
|
|
@@ -537,10 +612,10 @@ describe('CallingClient Error Tests', function () {
|
|
|
537
612
|
beforeEach(function () {
|
|
538
613
|
jest.clearAllMocks();
|
|
539
614
|
});
|
|
540
|
-
it('verify 401 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
615
|
+
it('verify 401 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
|
|
541
616
|
var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
|
|
542
|
-
return _regenerator.default.wrap(function (
|
|
543
|
-
while (1) switch (
|
|
617
|
+
return _regenerator.default.wrap(function (_context0) {
|
|
618
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
544
619
|
case 0:
|
|
545
620
|
statusCode = _types2.ERROR_CODE.UNAUTHORIZED;
|
|
546
621
|
message = 'User is unauthorized due to an expired token.';
|
|
@@ -565,24 +640,24 @@ describe('CallingClient Error Tests', function () {
|
|
|
565
640
|
context: logObj
|
|
566
641
|
};
|
|
567
642
|
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
568
|
-
|
|
643
|
+
_context0.next = 1;
|
|
569
644
|
return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
|
|
570
645
|
case 1:
|
|
571
|
-
result =
|
|
646
|
+
result = _context0.sent;
|
|
572
647
|
expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
|
|
573
648
|
expect(result).toBe(finalError);
|
|
574
649
|
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
|
|
575
650
|
expect(logSpy).toHaveBeenCalledWith('401 Unauthorized', logObj);
|
|
576
651
|
case 2:
|
|
577
652
|
case "end":
|
|
578
|
-
return
|
|
653
|
+
return _context0.stop();
|
|
579
654
|
}
|
|
580
|
-
},
|
|
655
|
+
}, _callee0);
|
|
581
656
|
})));
|
|
582
|
-
it('verify 500 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
657
|
+
it('verify 500 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
583
658
|
var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
|
|
584
|
-
return _regenerator.default.wrap(function (
|
|
585
|
-
while (1) switch (
|
|
659
|
+
return _regenerator.default.wrap(function (_context1) {
|
|
660
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
586
661
|
case 0:
|
|
587
662
|
statusCode = _types2.ERROR_CODE.INTERNAL_SERVER_ERROR;
|
|
588
663
|
message = 'An unknown error occurred while placing the request. Wait a moment and try again.';
|
|
@@ -607,24 +682,24 @@ describe('CallingClient Error Tests', function () {
|
|
|
607
682
|
context: logObj
|
|
608
683
|
};
|
|
609
684
|
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
610
|
-
|
|
685
|
+
_context1.next = 1;
|
|
611
686
|
return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
|
|
612
687
|
case 1:
|
|
613
|
-
result =
|
|
688
|
+
result = _context1.sent;
|
|
614
689
|
expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
|
|
615
690
|
expect(result).toBe(finalError);
|
|
616
691
|
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
|
|
617
692
|
expect(logSpy).toHaveBeenCalledWith('500 Internal Server Error', logObj);
|
|
618
693
|
case 2:
|
|
619
694
|
case "end":
|
|
620
|
-
return
|
|
695
|
+
return _context1.stop();
|
|
621
696
|
}
|
|
622
|
-
},
|
|
697
|
+
}, _callee1);
|
|
623
698
|
})));
|
|
624
|
-
it('verify unknown error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
699
|
+
it('verify unknown error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
625
700
|
var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
|
|
626
|
-
return _regenerator.default.wrap(function (
|
|
627
|
-
while (1) switch (
|
|
701
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
702
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
628
703
|
case 0:
|
|
629
704
|
statusCode = 206;
|
|
630
705
|
message = 'Unknown error';
|
|
@@ -649,19 +724,19 @@ describe('CallingClient Error Tests', function () {
|
|
|
649
724
|
context: logObj
|
|
650
725
|
};
|
|
651
726
|
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
652
|
-
|
|
727
|
+
_context10.next = 1;
|
|
653
728
|
return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
|
|
654
729
|
case 1:
|
|
655
|
-
result =
|
|
730
|
+
result = _context10.sent;
|
|
656
731
|
expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
|
|
657
732
|
expect(result).toBe(finalError);
|
|
658
733
|
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
|
|
659
734
|
expect(logSpy).toHaveBeenCalledWith('Unknown Error', logObj);
|
|
660
735
|
case 2:
|
|
661
736
|
case "end":
|
|
662
|
-
return
|
|
737
|
+
return _context10.stop();
|
|
663
738
|
}
|
|
664
|
-
},
|
|
739
|
+
}, _callee10);
|
|
665
740
|
})));
|
|
666
741
|
});
|
|
667
742
|
describe('Call Tests', function () {
|
|
@@ -1209,11 +1284,11 @@ describe('resolveContact tests', function () {
|
|
|
1209
1284
|
}));
|
|
1210
1285
|
});
|
|
1211
1286
|
});
|
|
1212
|
-
it('Resolve by userExternalId - SCIM exception', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1287
|
+
it('Resolve by userExternalId - SCIM exception', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
1213
1288
|
var _callingPartyInfo$use2;
|
|
1214
1289
|
var callingPartyInfo, warnSpy, webexSpy, displayInfo, query;
|
|
1215
|
-
return _regenerator.default.wrap(function (
|
|
1216
|
-
while (1) switch (
|
|
1290
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
1291
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1217
1292
|
case 0:
|
|
1218
1293
|
callingPartyInfo = {};
|
|
1219
1294
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
@@ -1223,10 +1298,10 @@ describe('resolveContact tests', function () {
|
|
|
1223
1298
|
callingPartyInfo.userExternalId = {
|
|
1224
1299
|
$: 'userExternalId'
|
|
1225
1300
|
};
|
|
1226
|
-
|
|
1301
|
+
_context11.next = 1;
|
|
1227
1302
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1228
1303
|
case 1:
|
|
1229
|
-
displayInfo =
|
|
1304
|
+
displayInfo = _context11.sent;
|
|
1230
1305
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
|
|
1231
1306
|
expect(warnSpy).toHaveBeenCalledWith('Error response: - 500', {
|
|
1232
1307
|
file: _constants.UTILS_FILE,
|
|
@@ -1238,15 +1313,15 @@ describe('resolveContact tests', function () {
|
|
|
1238
1313
|
}));
|
|
1239
1314
|
case 2:
|
|
1240
1315
|
case "end":
|
|
1241
|
-
return
|
|
1316
|
+
return _context11.stop();
|
|
1242
1317
|
}
|
|
1243
|
-
},
|
|
1318
|
+
}, _callee11);
|
|
1244
1319
|
})));
|
|
1245
|
-
it('Resolve by userExternalId - totalResults zero', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1320
|
+
it('Resolve by userExternalId - totalResults zero', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
1246
1321
|
var _callingPartyInfo$use3;
|
|
1247
1322
|
var callingPartyInfo, scimResponse, webexSpy, displayInfo, query;
|
|
1248
|
-
return _regenerator.default.wrap(function (
|
|
1249
|
-
while (1) switch (
|
|
1323
|
+
return _regenerator.default.wrap(function (_context12) {
|
|
1324
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1250
1325
|
case 0:
|
|
1251
1326
|
callingPartyInfo = {};
|
|
1252
1327
|
scimResponse = (0, _testUtil.getSampleScimResponse)();
|
|
@@ -1258,10 +1333,10 @@ describe('resolveContact tests', function () {
|
|
|
1258
1333
|
callingPartyInfo.userExternalId = {
|
|
1259
1334
|
$: 'userExternalId'
|
|
1260
1335
|
};
|
|
1261
|
-
|
|
1336
|
+
_context12.next = 1;
|
|
1262
1337
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1263
1338
|
case 1:
|
|
1264
|
-
displayInfo =
|
|
1339
|
+
displayInfo = _context12.sent;
|
|
1265
1340
|
query = scimUrl + encodeURIComponent("id eq \"".concat((_callingPartyInfo$use3 = callingPartyInfo.userExternalId) === null || _callingPartyInfo$use3 === void 0 ? void 0 : _callingPartyInfo$use3.$, "\""));
|
|
1266
1341
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
|
|
1267
1342
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
@@ -1270,15 +1345,15 @@ describe('resolveContact tests', function () {
|
|
|
1270
1345
|
scimResponse.totalResults = '1';
|
|
1271
1346
|
case 2:
|
|
1272
1347
|
case "end":
|
|
1273
|
-
return
|
|
1348
|
+
return _context12.stop();
|
|
1274
1349
|
}
|
|
1275
|
-
},
|
|
1350
|
+
}, _callee12);
|
|
1276
1351
|
})));
|
|
1277
|
-
it('Resolve by userExternalId - no primary number and no phone numbers', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1352
|
+
it('Resolve by userExternalId - no primary number and no phone numbers', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
1278
1353
|
var _callingPartyInfo$use4, _displayInfo, _displayInfo2;
|
|
1279
1354
|
var callingPartyInfo, scimResponse, webexSpy, displayInfo, query, phoneNumbers;
|
|
1280
|
-
return _regenerator.default.wrap(function (
|
|
1281
|
-
while (1) switch (
|
|
1355
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
1356
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1282
1357
|
case 0:
|
|
1283
1358
|
callingPartyInfo = {};
|
|
1284
1359
|
scimResponse = (0, _testUtil.getSampleScimResponse)();
|
|
@@ -1290,10 +1365,10 @@ describe('resolveContact tests', function () {
|
|
|
1290
1365
|
callingPartyInfo.userExternalId = {
|
|
1291
1366
|
$: 'userExternalId'
|
|
1292
1367
|
};
|
|
1293
|
-
|
|
1368
|
+
_context13.next = 1;
|
|
1294
1369
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1295
1370
|
case 1:
|
|
1296
|
-
displayInfo =
|
|
1371
|
+
displayInfo = _context13.sent;
|
|
1297
1372
|
query = scimUrl + encodeURIComponent("id eq \"".concat((_callingPartyInfo$use4 = callingPartyInfo.userExternalId) === null || _callingPartyInfo$use4 === void 0 ? void 0 : _callingPartyInfo$use4.$, "\""));
|
|
1298
1373
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1299
1374
|
uri: query
|
|
@@ -1309,10 +1384,10 @@ describe('resolveContact tests', function () {
|
|
|
1309
1384
|
statusCode: 200,
|
|
1310
1385
|
body: scimResponse
|
|
1311
1386
|
});
|
|
1312
|
-
|
|
1387
|
+
_context13.next = 2;
|
|
1313
1388
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1314
1389
|
case 2:
|
|
1315
|
-
displayInfo =
|
|
1390
|
+
displayInfo = _context13.sent;
|
|
1316
1391
|
expect((_displayInfo2 = displayInfo) === null || _displayInfo2 === void 0 ? void 0 : _displayInfo2.num).toBeUndefined();
|
|
1317
1392
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1318
1393
|
uri: query
|
|
@@ -1320,9 +1395,9 @@ describe('resolveContact tests', function () {
|
|
|
1320
1395
|
scimResponse.Resources[0].phoneNumbers = phoneNumbers;
|
|
1321
1396
|
case 3:
|
|
1322
1397
|
case "end":
|
|
1323
|
-
return
|
|
1398
|
+
return _context13.stop();
|
|
1324
1399
|
}
|
|
1325
|
-
},
|
|
1400
|
+
}, _callee13);
|
|
1326
1401
|
})));
|
|
1327
1402
|
it('Resolve by userExternalId - no photo', function () {
|
|
1328
1403
|
var callingPartyInfo = {};
|
|
@@ -1387,10 +1462,10 @@ describe('resolveContact tests', function () {
|
|
|
1387
1462
|
}));
|
|
1388
1463
|
});
|
|
1389
1464
|
});
|
|
1390
|
-
it('Resolve by name - Empty Info', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1465
|
+
it('Resolve by name - Empty Info', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
1391
1466
|
var callingPartyInfo, peopleListResponse, items, webexSpy, displayInfo;
|
|
1392
|
-
return _regenerator.default.wrap(function (
|
|
1393
|
-
while (1) switch (
|
|
1467
|
+
return _regenerator.default.wrap(function (_context14) {
|
|
1468
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1394
1469
|
case 0:
|
|
1395
1470
|
callingPartyInfo = {};
|
|
1396
1471
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1400,10 +1475,10 @@ describe('resolveContact tests', function () {
|
|
|
1400
1475
|
callingPartyInfo.name = {
|
|
1401
1476
|
$: 'Name'
|
|
1402
1477
|
};
|
|
1403
|
-
|
|
1478
|
+
_context14.next = 1;
|
|
1404
1479
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1405
1480
|
case 1:
|
|
1406
|
-
displayInfo =
|
|
1481
|
+
displayInfo = _context14.sent;
|
|
1407
1482
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
|
|
1408
1483
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1409
1484
|
displayName: 'Name'
|
|
@@ -1411,15 +1486,15 @@ describe('resolveContact tests', function () {
|
|
|
1411
1486
|
peopleListResponse.items = items;
|
|
1412
1487
|
case 2:
|
|
1413
1488
|
case "end":
|
|
1414
|
-
return
|
|
1489
|
+
return _context14.stop();
|
|
1415
1490
|
}
|
|
1416
|
-
},
|
|
1491
|
+
}, _callee14);
|
|
1417
1492
|
})));
|
|
1418
|
-
it('Resolve by name - ID as plain UUID instead of part of URI', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1493
|
+
it('Resolve by name - ID as plain UUID instead of part of URI', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
1419
1494
|
var _displayInfo3, _displayInfo4, _displayInfo5, _displayInfo6, _displayInfo7, _displayInfo8;
|
|
1420
1495
|
var callingPartyInfo, peopleListResponse, id, webexSpy, displayInfo;
|
|
1421
|
-
return _regenerator.default.wrap(function (
|
|
1422
|
-
while (1) switch (
|
|
1496
|
+
return _regenerator.default.wrap(function (_context15) {
|
|
1497
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1423
1498
|
case 0:
|
|
1424
1499
|
callingPartyInfo = {};
|
|
1425
1500
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1430,10 +1505,10 @@ describe('resolveContact tests', function () {
|
|
|
1430
1505
|
callingPartyInfo.name = {
|
|
1431
1506
|
$: 'Name'
|
|
1432
1507
|
};
|
|
1433
|
-
|
|
1508
|
+
_context15.next = 1;
|
|
1434
1509
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1435
1510
|
case 1:
|
|
1436
|
-
displayInfo =
|
|
1511
|
+
displayInfo = _context15.sent;
|
|
1437
1512
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1438
1513
|
displayName: 'Name'
|
|
1439
1514
|
}));
|
|
@@ -1446,10 +1521,10 @@ describe('resolveContact tests', function () {
|
|
|
1446
1521
|
/* Also test empty id */
|
|
1447
1522
|
peopleListResponse.items[0].id = '';
|
|
1448
1523
|
webex.people.list.mockResolvedValueOnce(peopleListResponse);
|
|
1449
|
-
|
|
1524
|
+
_context15.next = 2;
|
|
1450
1525
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1451
1526
|
case 2:
|
|
1452
|
-
displayInfo =
|
|
1527
|
+
displayInfo = _context15.sent;
|
|
1453
1528
|
expect((_displayInfo7 = displayInfo) === null || _displayInfo7 === void 0 ? void 0 : _displayInfo7.id).toStrictEqual('');
|
|
1454
1529
|
expect((_displayInfo8 = displayInfo) === null || _displayInfo8 === void 0 ? void 0 : _displayInfo8.name).toStrictEqual(peopleListResponse.items[0].displayName);
|
|
1455
1530
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
@@ -1458,14 +1533,14 @@ describe('resolveContact tests', function () {
|
|
|
1458
1533
|
peopleListResponse.items[0].id = id;
|
|
1459
1534
|
case 3:
|
|
1460
1535
|
case "end":
|
|
1461
|
-
return
|
|
1536
|
+
return _context15.stop();
|
|
1462
1537
|
}
|
|
1463
|
-
},
|
|
1538
|
+
}, _callee15);
|
|
1464
1539
|
})));
|
|
1465
|
-
it('Resolve by name - Phone numbers no match for type - work', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1540
|
+
it('Resolve by name - Phone numbers no match for type - work', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
1466
1541
|
var callingPartyInfo, peopleListResponse, phoneNumbers, webexSpy, displayInfo;
|
|
1467
|
-
return _regenerator.default.wrap(function (
|
|
1468
|
-
while (1) switch (
|
|
1542
|
+
return _regenerator.default.wrap(function (_context16) {
|
|
1543
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1469
1544
|
case 0:
|
|
1470
1545
|
callingPartyInfo = {};
|
|
1471
1546
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1476,10 +1551,10 @@ describe('resolveContact tests', function () {
|
|
|
1476
1551
|
callingPartyInfo.name = {
|
|
1477
1552
|
$: 'Name'
|
|
1478
1553
|
};
|
|
1479
|
-
|
|
1554
|
+
_context16.next = 1;
|
|
1480
1555
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1481
1556
|
case 1:
|
|
1482
|
-
displayInfo =
|
|
1557
|
+
displayInfo = _context16.sent;
|
|
1483
1558
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toStrictEqual(peopleListResponse.items[0].displayName);
|
|
1484
1559
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.num).toStrictEqual(peopleListResponse.items[0].phoneNumbers[0].value);
|
|
1485
1560
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.avatarSrc).toStrictEqual(peopleListResponse.items[0].avatar);
|
|
@@ -1489,14 +1564,14 @@ describe('resolveContact tests', function () {
|
|
|
1489
1564
|
peopleListResponse.items[0].phoneNumbers = phoneNumbers;
|
|
1490
1565
|
case 2:
|
|
1491
1566
|
case "end":
|
|
1492
|
-
return
|
|
1567
|
+
return _context16.stop();
|
|
1493
1568
|
}
|
|
1494
|
-
},
|
|
1569
|
+
}, _callee16);
|
|
1495
1570
|
})));
|
|
1496
|
-
it('Resolve by name - Phone numbers empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1571
|
+
it('Resolve by name - Phone numbers empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
1497
1572
|
var callingPartyInfo, peopleListResponse, phoneNumbers, webexSpy, displayInfo;
|
|
1498
|
-
return _regenerator.default.wrap(function (
|
|
1499
|
-
while (1) switch (
|
|
1573
|
+
return _regenerator.default.wrap(function (_context17) {
|
|
1574
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1500
1575
|
case 0:
|
|
1501
1576
|
callingPartyInfo = {};
|
|
1502
1577
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1506,10 +1581,10 @@ describe('resolveContact tests', function () {
|
|
|
1506
1581
|
callingPartyInfo.name = {
|
|
1507
1582
|
$: 'Name'
|
|
1508
1583
|
};
|
|
1509
|
-
|
|
1584
|
+
_context17.next = 1;
|
|
1510
1585
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1511
1586
|
case 1:
|
|
1512
|
-
displayInfo =
|
|
1587
|
+
displayInfo = _context17.sent;
|
|
1513
1588
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1514
1589
|
displayName: 'Name'
|
|
1515
1590
|
}));
|
|
@@ -1519,9 +1594,9 @@ describe('resolveContact tests', function () {
|
|
|
1519
1594
|
peopleListResponse.items[0].phoneNumbers = phoneNumbers;
|
|
1520
1595
|
case 2:
|
|
1521
1596
|
case "end":
|
|
1522
|
-
return
|
|
1597
|
+
return _context17.stop();
|
|
1523
1598
|
}
|
|
1524
|
-
},
|
|
1599
|
+
}, _callee17);
|
|
1525
1600
|
})));
|
|
1526
1601
|
});
|
|
1527
1602
|
describe('Store and Fetch voicemail tests', function () {
|
|
@@ -1639,40 +1714,40 @@ describe('Infer id from UUID Tests', function () {
|
|
|
1639
1714
|
});
|
|
1640
1715
|
});
|
|
1641
1716
|
describe('Get endpoint by CALLING_BACKEND tests', function () {
|
|
1642
|
-
it('verify invalid calling backend ucm for xsi endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1717
|
+
it('verify invalid calling backend ucm for xsi endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
1643
1718
|
var _t;
|
|
1644
|
-
return _regenerator.default.wrap(function (
|
|
1645
|
-
while (1) switch (
|
|
1719
|
+
return _regenerator.default.wrap(function (_context18) {
|
|
1720
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1646
1721
|
case 0:
|
|
1647
1722
|
_t = expect;
|
|
1648
|
-
|
|
1723
|
+
_context18.next = 1;
|
|
1649
1724
|
return (0, _Utils.getXsiActionEndpoint)(webex, {
|
|
1650
1725
|
file: 'testFile',
|
|
1651
1726
|
method: 'testMethod'
|
|
1652
1727
|
}, _types.CALLING_BACKEND.UCM);
|
|
1653
1728
|
case 1:
|
|
1654
|
-
_t(
|
|
1729
|
+
_t(_context18.sent).toBeInstanceOf(Error);
|
|
1655
1730
|
case 2:
|
|
1656
1731
|
case "end":
|
|
1657
|
-
return
|
|
1732
|
+
return _context18.stop();
|
|
1658
1733
|
}
|
|
1659
|
-
},
|
|
1734
|
+
}, _callee18);
|
|
1660
1735
|
})));
|
|
1661
|
-
it('verify invalid calling backend wxc for vg endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1736
|
+
it('verify invalid calling backend wxc for vg endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
1662
1737
|
var _t2;
|
|
1663
|
-
return _regenerator.default.wrap(function (
|
|
1664
|
-
while (1) switch (
|
|
1738
|
+
return _regenerator.default.wrap(function (_context19) {
|
|
1739
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1665
1740
|
case 0:
|
|
1666
1741
|
_t2 = expect;
|
|
1667
|
-
|
|
1742
|
+
_context19.next = 1;
|
|
1668
1743
|
return (0, _Utils.getVgActionEndpoint)(webex, _types.CALLING_BACKEND.WXC);
|
|
1669
1744
|
case 1:
|
|
1670
|
-
_t2(
|
|
1745
|
+
_t2(_context19.sent).toBeInstanceOf(Error);
|
|
1671
1746
|
case 2:
|
|
1672
1747
|
case "end":
|
|
1673
|
-
return
|
|
1748
|
+
return _context19.stop();
|
|
1674
1749
|
}
|
|
1675
|
-
},
|
|
1750
|
+
}, _callee19);
|
|
1676
1751
|
})));
|
|
1677
1752
|
});
|
|
1678
1753
|
describe('Get XSI Action Endpoint tests', function () {
|
|
@@ -1694,10 +1769,10 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1694
1769
|
beforeEach(function () {
|
|
1695
1770
|
mockWebex.request.mockClear();
|
|
1696
1771
|
});
|
|
1697
|
-
it('should return xsiEndpoint for WXC backend using _serviceUrls.hydra', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1772
|
+
it('should return xsiEndpoint for WXC backend using _serviceUrls.hydra', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
1698
1773
|
var hydraEndpoint, wxcWebex, result;
|
|
1699
|
-
return _regenerator.default.wrap(function (
|
|
1700
|
-
while (1) switch (
|
|
1774
|
+
return _regenerator.default.wrap(function (_context20) {
|
|
1775
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1701
1776
|
case 0:
|
|
1702
1777
|
hydraEndpoint = 'https://hydra-a.wbx2.com/v1/';
|
|
1703
1778
|
wxcWebex = {
|
|
@@ -1717,10 +1792,10 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1717
1792
|
}
|
|
1718
1793
|
}
|
|
1719
1794
|
};
|
|
1720
|
-
|
|
1795
|
+
_context20.next = 1;
|
|
1721
1796
|
return (0, _Utils.getXsiActionEndpoint)(wxcWebex, loggerContext, _types.CALLING_BACKEND.WXC);
|
|
1722
1797
|
case 1:
|
|
1723
|
-
result =
|
|
1798
|
+
result = _context20.sent;
|
|
1724
1799
|
expect(wxcWebex.request).toBeCalledOnceWith({
|
|
1725
1800
|
method: _types.HTTP_METHODS.GET,
|
|
1726
1801
|
uri: "".concat(hydraEndpoint, "/").concat(_constants2.XSI_ACTION_ENDPOINT_ORG_URL_PARAM)
|
|
@@ -1729,14 +1804,14 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1729
1804
|
expect(wxcWebex.internal.services.get).not.toHaveBeenCalled();
|
|
1730
1805
|
case 2:
|
|
1731
1806
|
case "end":
|
|
1732
|
-
return
|
|
1807
|
+
return _context20.stop();
|
|
1733
1808
|
}
|
|
1734
|
-
},
|
|
1809
|
+
}, _callee20);
|
|
1735
1810
|
})));
|
|
1736
|
-
it('should return xsiEndpoint for WXC backend using services.get when _serviceUrls is undefined', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1811
|
+
it('should return xsiEndpoint for WXC backend using services.get when _serviceUrls is undefined', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
1737
1812
|
var hydraEndpoint, activeHydraCluster, wxcWebex, result;
|
|
1738
|
-
return _regenerator.default.wrap(function (
|
|
1739
|
-
while (1) switch (
|
|
1813
|
+
return _regenerator.default.wrap(function (_context21) {
|
|
1814
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1740
1815
|
case 0:
|
|
1741
1816
|
hydraEndpoint = 'https://hydra-a.wbx2.com/v1/';
|
|
1742
1817
|
activeHydraCluster = 'urn:TEAM:us-east-2_a:hydra';
|
|
@@ -1755,10 +1830,10 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1755
1830
|
}
|
|
1756
1831
|
}
|
|
1757
1832
|
};
|
|
1758
|
-
|
|
1833
|
+
_context21.next = 1;
|
|
1759
1834
|
return (0, _Utils.getXsiActionEndpoint)(wxcWebex, loggerContext, _types.CALLING_BACKEND.WXC);
|
|
1760
1835
|
case 1:
|
|
1761
|
-
result =
|
|
1836
|
+
result = _context21.sent;
|
|
1762
1837
|
expect(wxcWebex.internal.services.get).toBeCalledOnceWith(activeHydraCluster);
|
|
1763
1838
|
expect(wxcWebex.request).toBeCalledOnceWith({
|
|
1764
1839
|
method: _types.HTTP_METHODS.GET,
|
|
@@ -1767,14 +1842,14 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1767
1842
|
expect(result).toBe(expectedXsiEndpoint);
|
|
1768
1843
|
case 2:
|
|
1769
1844
|
case "end":
|
|
1770
|
-
return
|
|
1845
|
+
return _context21.stop();
|
|
1771
1846
|
}
|
|
1772
|
-
},
|
|
1847
|
+
}, _callee21);
|
|
1773
1848
|
})));
|
|
1774
|
-
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1849
|
+
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
1775
1850
|
var mockResponse, xsiEndpoint;
|
|
1776
|
-
return _regenerator.default.wrap(function (
|
|
1777
|
-
while (1) switch (
|
|
1851
|
+
return _regenerator.default.wrap(function (_context22) {
|
|
1852
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1778
1853
|
case 0:
|
|
1779
1854
|
mockResponse = {
|
|
1780
1855
|
body: {
|
|
@@ -1786,22 +1861,22 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1786
1861
|
}
|
|
1787
1862
|
};
|
|
1788
1863
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1789
|
-
|
|
1864
|
+
_context22.next = 1;
|
|
1790
1865
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1791
1866
|
case 1:
|
|
1792
|
-
xsiEndpoint =
|
|
1867
|
+
xsiEndpoint = _context22.sent;
|
|
1793
1868
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1794
1869
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1795
1870
|
case 2:
|
|
1796
1871
|
case "end":
|
|
1797
|
-
return
|
|
1872
|
+
return _context22.stop();
|
|
1798
1873
|
}
|
|
1799
|
-
},
|
|
1874
|
+
}, _callee22);
|
|
1800
1875
|
})));
|
|
1801
|
-
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1876
|
+
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
1802
1877
|
var mockResponse, xsiEndpoint;
|
|
1803
|
-
return _regenerator.default.wrap(function (
|
|
1804
|
-
while (1) switch (
|
|
1878
|
+
return _regenerator.default.wrap(function (_context23) {
|
|
1879
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1805
1880
|
case 0:
|
|
1806
1881
|
mockResponse = {
|
|
1807
1882
|
body: {
|
|
@@ -1813,22 +1888,22 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1813
1888
|
}
|
|
1814
1889
|
};
|
|
1815
1890
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1816
|
-
|
|
1891
|
+
_context23.next = 1;
|
|
1817
1892
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1818
1893
|
case 1:
|
|
1819
|
-
xsiEndpoint =
|
|
1894
|
+
xsiEndpoint = _context23.sent;
|
|
1820
1895
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1821
1896
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1822
1897
|
case 2:
|
|
1823
1898
|
case "end":
|
|
1824
|
-
return
|
|
1899
|
+
return _context23.stop();
|
|
1825
1900
|
}
|
|
1826
|
-
},
|
|
1901
|
+
}, _callee23);
|
|
1827
1902
|
})));
|
|
1828
|
-
it('should return xsiEndpoint for BWRKS backend when URL does not end with any version', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1903
|
+
it('should return xsiEndpoint for BWRKS backend when URL does not end with any version', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
1829
1904
|
var mockResponse, xsiEndpoint;
|
|
1830
|
-
return _regenerator.default.wrap(function (
|
|
1831
|
-
while (1) switch (
|
|
1905
|
+
return _regenerator.default.wrap(function (_context24) {
|
|
1906
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1832
1907
|
case 0:
|
|
1833
1908
|
mockResponse = {
|
|
1834
1909
|
body: {
|
|
@@ -1840,17 +1915,17 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1840
1915
|
}
|
|
1841
1916
|
};
|
|
1842
1917
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1843
|
-
|
|
1918
|
+
_context24.next = 1;
|
|
1844
1919
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1845
1920
|
case 1:
|
|
1846
|
-
xsiEndpoint =
|
|
1921
|
+
xsiEndpoint = _context24.sent;
|
|
1847
1922
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1848
1923
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1849
1924
|
case 2:
|
|
1850
1925
|
case "end":
|
|
1851
|
-
return
|
|
1926
|
+
return _context24.stop();
|
|
1852
1927
|
}
|
|
1853
|
-
},
|
|
1928
|
+
}, _callee24);
|
|
1854
1929
|
})));
|
|
1855
1930
|
});
|
|
1856
1931
|
describe('modifySdpForIPv4', function () {
|
|
@@ -1920,19 +1995,19 @@ describe('uploadLogs', function () {
|
|
|
1920
1995
|
afterEach(function () {
|
|
1921
1996
|
jest.clearAllMocks();
|
|
1922
1997
|
});
|
|
1923
|
-
it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1998
|
+
it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
1924
1999
|
var mockMetaData, logSpy, result;
|
|
1925
|
-
return _regenerator.default.wrap(function (
|
|
1926
|
-
while (1) switch (
|
|
2000
|
+
return _regenerator.default.wrap(function (_context25) {
|
|
2001
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1927
2002
|
case 0:
|
|
1928
2003
|
mockMetaData = {
|
|
1929
2004
|
correlationId: 'test-correlation'
|
|
1930
2005
|
};
|
|
1931
2006
|
logSpy = jest.spyOn(_Logger.default, 'info');
|
|
1932
|
-
|
|
2007
|
+
_context25.next = 1;
|
|
1933
2008
|
return (0, _Utils.uploadLogs)(mockMetaData, true);
|
|
1934
2009
|
case 1:
|
|
1935
|
-
result =
|
|
2010
|
+
result = _context25.sent;
|
|
1936
2011
|
expect(result).toEqual({
|
|
1937
2012
|
trackingid: '1234',
|
|
1938
2013
|
feedbackId: 'mocked-uuid-12345'
|
|
@@ -1965,14 +2040,14 @@ describe('uploadLogs', function () {
|
|
|
1965
2040
|
});
|
|
1966
2041
|
case 2:
|
|
1967
2042
|
case "end":
|
|
1968
|
-
return
|
|
2043
|
+
return _context25.stop();
|
|
1969
2044
|
}
|
|
1970
|
-
},
|
|
2045
|
+
}, _callee25);
|
|
1971
2046
|
})));
|
|
1972
|
-
it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2047
|
+
it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
1973
2048
|
var mockMetaData, mockError, logSpy, _t3;
|
|
1974
|
-
return _regenerator.default.wrap(function (
|
|
1975
|
-
while (1) switch (
|
|
2049
|
+
return _regenerator.default.wrap(function (_context26) {
|
|
2050
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1976
2051
|
case 0:
|
|
1977
2052
|
mockMetaData = {
|
|
1978
2053
|
correlationId: 'test-correlation'
|
|
@@ -1980,17 +2055,17 @@ describe('uploadLogs', function () {
|
|
|
1980
2055
|
mockError = new Error('Upload failed'); // Mock the submitLogs to fail
|
|
1981
2056
|
submitLogsMock.mockRejectedValueOnce(mockError);
|
|
1982
2057
|
logSpy = jest.spyOn(_Logger.default, 'error');
|
|
1983
|
-
|
|
1984
|
-
|
|
2058
|
+
_context26.prev = 1;
|
|
2059
|
+
_context26.next = 2;
|
|
1985
2060
|
return (0, _Utils.uploadLogs)(mockMetaData, true);
|
|
1986
2061
|
case 2:
|
|
1987
2062
|
// If we get here, the test should fail since we expected an exception
|
|
1988
2063
|
expect(true).toBe(false); // This will fail the test if no exception is thrown
|
|
1989
|
-
|
|
2064
|
+
_context26.next = 4;
|
|
1990
2065
|
break;
|
|
1991
2066
|
case 3:
|
|
1992
|
-
|
|
1993
|
-
_t3 =
|
|
2067
|
+
_context26.prev = 3;
|
|
2068
|
+
_t3 = _context26["catch"](1);
|
|
1994
2069
|
expect(_t3).toBe(mockError);
|
|
1995
2070
|
expect(logSpy).toHaveBeenCalledWith("Failed to upload Logs ".concat((0, _stringify.default)(_t3)), {
|
|
1996
2071
|
file: _constants.UTILS_FILE,
|
|
@@ -2017,14 +2092,14 @@ describe('uploadLogs', function () {
|
|
|
2017
2092
|
});
|
|
2018
2093
|
case 4:
|
|
2019
2094
|
case "end":
|
|
2020
|
-
return
|
|
2095
|
+
return _context26.stop();
|
|
2021
2096
|
}
|
|
2022
|
-
},
|
|
2097
|
+
}, _callee26, null, [[1, 3]]);
|
|
2023
2098
|
})));
|
|
2024
|
-
it('should log error and not throw an error if the upload fails with throw exception false', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2099
|
+
it('should log error and not throw an error if the upload fails with throw exception false', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
|
|
2025
2100
|
var mockMetaData, mockError, logSpy, result;
|
|
2026
|
-
return _regenerator.default.wrap(function (
|
|
2027
|
-
while (1) switch (
|
|
2101
|
+
return _regenerator.default.wrap(function (_context27) {
|
|
2102
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2028
2103
|
case 0:
|
|
2029
2104
|
mockMetaData = {
|
|
2030
2105
|
correlationId: 'test-correlation',
|
|
@@ -2033,10 +2108,10 @@ describe('uploadLogs', function () {
|
|
|
2033
2108
|
mockError = new Error('Upload failed'); // Mock the submitLogs to fail
|
|
2034
2109
|
submitLogsMock.mockRejectedValueOnce(mockError);
|
|
2035
2110
|
logSpy = jest.spyOn(_Logger.default, 'error');
|
|
2036
|
-
|
|
2111
|
+
_context27.next = 1;
|
|
2037
2112
|
return (0, _Utils.uploadLogs)(mockMetaData, false);
|
|
2038
2113
|
case 1:
|
|
2039
|
-
result =
|
|
2114
|
+
result = _context27.sent;
|
|
2040
2115
|
expect(result).toBeUndefined();
|
|
2041
2116
|
expect(logSpy).toHaveBeenCalledWith("Failed to upload Logs ".concat((0, _stringify.default)(mockError)), {
|
|
2042
2117
|
file: _constants.UTILS_FILE,
|
|
@@ -2063,9 +2138,9 @@ describe('uploadLogs', function () {
|
|
|
2063
2138
|
});
|
|
2064
2139
|
case 2:
|
|
2065
2140
|
case "end":
|
|
2066
|
-
return
|
|
2141
|
+
return _context27.stop();
|
|
2067
2142
|
}
|
|
2068
|
-
},
|
|
2143
|
+
}, _callee27);
|
|
2069
2144
|
})));
|
|
2070
2145
|
});
|
|
2071
2146
|
describe('resolveCallingBackend', function () {
|