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