@webex/calling 3.13.0-next.5 → 3.13.0-next.7
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/registration/register.js +2 -2
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +133 -97
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/common/Utils.js +6 -5
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +294 -239
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/module/CallingClient/registration/register.js +1 -1
- package/dist/module/common/Utils.js +7 -5
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -40,6 +40,23 @@ var mockEmitterCb = jest.fn();
|
|
|
40
40
|
var mockRestoreCb = jest.fn();
|
|
41
41
|
var mock429RetryCb = jest.fn();
|
|
42
42
|
var mockSessionSupersededCb = jest.fn();
|
|
43
|
+
var retryAfterCases = [{
|
|
44
|
+
headers: {
|
|
45
|
+
'retry-after': '120'
|
|
46
|
+
},
|
|
47
|
+
retryAfter: 120
|
|
48
|
+
}, {
|
|
49
|
+
headers: {
|
|
50
|
+
'Retry-After': '120'
|
|
51
|
+
},
|
|
52
|
+
retryAfter: 120
|
|
53
|
+
}, {
|
|
54
|
+
headers: {
|
|
55
|
+
'retry-after': '0',
|
|
56
|
+
'Retry-After': '120'
|
|
57
|
+
},
|
|
58
|
+
retryAfter: 0
|
|
59
|
+
}];
|
|
43
60
|
var webex = (0, _testUtil.getTestUtilsWebex)();
|
|
44
61
|
_SDKConnector.default.setWebex(webex);
|
|
45
62
|
webex.internal.metrics.submitClientMetrics = mockSubmitRegistrationMetric;
|
|
@@ -166,41 +183,46 @@ describe('Call Tests - keepalive (handleCallEstablished) cases', function () {
|
|
|
166
183
|
}
|
|
167
184
|
}, _callee2);
|
|
168
185
|
})));
|
|
169
|
-
it('500
|
|
170
|
-
var
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
186
|
+
it.each(retryAfterCases)('500 keepalive honors $headers', /*#__PURE__*/function () {
|
|
187
|
+
var _ref4 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3(_ref3) {
|
|
188
|
+
var headers, retryAfter, emitted, endSpy, retrySpy, payload;
|
|
189
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
190
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
191
|
+
case 0:
|
|
192
|
+
headers = _ref3.headers, retryAfter = _ref3.retryAfter;
|
|
193
|
+
emitted = false;
|
|
194
|
+
endSpy = jest.fn();
|
|
195
|
+
retrySpy = jest.fn();
|
|
196
|
+
payload = {
|
|
197
|
+
statusCode: 500,
|
|
198
|
+
headers: _objectSpread({
|
|
199
|
+
trackingid: 't'
|
|
200
|
+
}, headers),
|
|
201
|
+
body: {
|
|
202
|
+
device: {
|
|
203
|
+
deviceId: 'd'
|
|
204
|
+
},
|
|
205
|
+
errorCode: 0
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
_context3.next = 1;
|
|
209
|
+
return (0, _Utils.handleCallErrors)(function () {
|
|
210
|
+
emitted = true;
|
|
211
|
+
}, _types2.ERROR_LAYER.CALL_CONTROL, retrySpy, dummyCorrelationId, payload, 'handleCallEstablished', logObj.file, endSpy);
|
|
212
|
+
case 1:
|
|
213
|
+
expect(emitted).toBe(true);
|
|
214
|
+
expect(endSpy).not.toHaveBeenCalled();
|
|
215
|
+
expect(retrySpy).toBeCalledOnceWith(retryAfter);
|
|
216
|
+
case 2:
|
|
217
|
+
case "end":
|
|
218
|
+
return _context3.stop();
|
|
219
|
+
}
|
|
220
|
+
}, _callee3);
|
|
221
|
+
}));
|
|
222
|
+
return function (_x) {
|
|
223
|
+
return _ref4.apply(this, arguments);
|
|
224
|
+
};
|
|
225
|
+
}());
|
|
204
226
|
it('500 during keepalive without retry-after triggers retryCb without args', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
205
227
|
var emitted, retrySpy, payload, abort;
|
|
206
228
|
return _regenerator.default.wrap(function (_context4) {
|
|
@@ -268,41 +290,46 @@ describe('Call Tests - keepalive (handleCallEstablished) cases', function () {
|
|
|
268
290
|
}
|
|
269
291
|
}, _callee5);
|
|
270
292
|
})));
|
|
271
|
-
it('503
|
|
272
|
-
var
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
293
|
+
it.each(retryAfterCases)('503 keepalive honors $headers', /*#__PURE__*/function () {
|
|
294
|
+
var _ref8 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(_ref7) {
|
|
295
|
+
var headers, retryAfter, emitted, retrySpy, payload, abort;
|
|
296
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
297
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
298
|
+
case 0:
|
|
299
|
+
headers = _ref7.headers, retryAfter = _ref7.retryAfter;
|
|
300
|
+
emitted = false;
|
|
301
|
+
retrySpy = jest.fn();
|
|
302
|
+
payload = {
|
|
303
|
+
statusCode: 503,
|
|
304
|
+
headers: _objectSpread({
|
|
305
|
+
trackingid: 't'
|
|
306
|
+
}, headers),
|
|
307
|
+
body: {
|
|
308
|
+
device: {
|
|
309
|
+
deviceId: 'd'
|
|
310
|
+
},
|
|
311
|
+
errorCode: 0
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
_context6.next = 1;
|
|
315
|
+
return (0, _Utils.handleCallErrors)(function () {
|
|
316
|
+
emitted = true;
|
|
317
|
+
}, _types2.ERROR_LAYER.CALL_CONTROL, retrySpy, dummyCorrelationId, payload, 'handleCallEstablished', logObj.file);
|
|
318
|
+
case 1:
|
|
319
|
+
abort = _context6.sent;
|
|
320
|
+
expect(abort).toBe(false);
|
|
321
|
+
expect(emitted).toBe(false);
|
|
322
|
+
expect(retrySpy).toBeCalledOnceWith(retryAfter);
|
|
323
|
+
case 2:
|
|
324
|
+
case "end":
|
|
325
|
+
return _context6.stop();
|
|
326
|
+
}
|
|
327
|
+
}, _callee6);
|
|
328
|
+
}));
|
|
329
|
+
return function (_x2) {
|
|
330
|
+
return _ref8.apply(this, arguments);
|
|
331
|
+
};
|
|
332
|
+
}());
|
|
306
333
|
it('503 during keepalive without retry-after invokes emitterCb and triggers retryCb without args', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
307
334
|
var emitted, retrySpy, payload, abort;
|
|
308
335
|
return _regenerator.default.wrap(function (_context7) {
|
|
@@ -514,7 +541,7 @@ describe('Registration Tests', function () {
|
|
|
514
541
|
|
|
515
542
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
516
543
|
it.each(errorCodes)('%s', /*#__PURE__*/function () {
|
|
517
|
-
var
|
|
544
|
+
var _ref0 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8(codeObj) {
|
|
518
545
|
var webexPayload, mockErrorEvent, callClientError, result;
|
|
519
546
|
return _regenerator.default.wrap(function (_context8) {
|
|
520
547
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -587,14 +614,42 @@ describe('Registration Tests', function () {
|
|
|
587
614
|
}
|
|
588
615
|
}, _callee8);
|
|
589
616
|
}));
|
|
590
|
-
return function (
|
|
591
|
-
return
|
|
617
|
+
return function (_x3) {
|
|
618
|
+
return _ref0.apply(this, arguments);
|
|
592
619
|
};
|
|
593
620
|
}());
|
|
594
|
-
it('
|
|
621
|
+
it.each(retryAfterCases)('429 honors $headers', /*#__PURE__*/function () {
|
|
622
|
+
var _ref10 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9(_ref1) {
|
|
623
|
+
var headers, retryAfter, webexPayload;
|
|
624
|
+
return _regenerator.default.wrap(function (_context9) {
|
|
625
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
626
|
+
case 0:
|
|
627
|
+
headers = _ref1.headers, retryAfter = _ref1.retryAfter;
|
|
628
|
+
webexPayload = {
|
|
629
|
+
statusCode: _types2.ERROR_CODE.TOO_MANY_REQUESTS,
|
|
630
|
+
headers: headers
|
|
631
|
+
};
|
|
632
|
+
_context9.next = 1;
|
|
633
|
+
return (0, _Utils.handleRegistrationErrors)(webexPayload, mockEmitterCb, logObj, {
|
|
634
|
+
retry429Cb: mock429RetryCb
|
|
635
|
+
});
|
|
636
|
+
case 1:
|
|
637
|
+
expect(mock429RetryCb).toBeCalledOnceWith(retryAfter, logObj.method);
|
|
638
|
+
expect(mockEmitterCb).not.toHaveBeenCalled();
|
|
639
|
+
case 2:
|
|
640
|
+
case "end":
|
|
641
|
+
return _context9.stop();
|
|
642
|
+
}
|
|
643
|
+
}, _callee9);
|
|
644
|
+
}));
|
|
645
|
+
return function (_x4) {
|
|
646
|
+
return _ref10.apply(this, arguments);
|
|
647
|
+
};
|
|
648
|
+
}());
|
|
649
|
+
it('verify 409 response for a caller that does not handle a superseded session', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
|
|
595
650
|
var webexPayload, result;
|
|
596
|
-
return _regenerator.default.wrap(function (
|
|
597
|
-
while (1) switch (
|
|
651
|
+
return _regenerator.default.wrap(function (_context0) {
|
|
652
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
598
653
|
case 0:
|
|
599
654
|
webexPayload = {
|
|
600
655
|
statusCode: _types2.ERROR_CODE.CONFLICT,
|
|
@@ -602,13 +657,13 @@ describe('Registration Tests', function () {
|
|
|
602
657
|
trackingid: 'webex-js-sdk_b5812e58-7246-4a9b-bf64-831bdf13b0cd_31'
|
|
603
658
|
}
|
|
604
659
|
};
|
|
605
|
-
|
|
660
|
+
_context0.next = 1;
|
|
606
661
|
return (0, _Utils.handleRegistrationErrors)(webexPayload, mockEmitterCb, logObj, {
|
|
607
662
|
retry429Cb: mock429RetryCb,
|
|
608
663
|
restoreRegCb: mockRestoreCb
|
|
609
664
|
});
|
|
610
665
|
case 1:
|
|
611
|
-
result =
|
|
666
|
+
result = _context0.sent;
|
|
612
667
|
expect(result).toStrictEqual({
|
|
613
668
|
finalError: false,
|
|
614
669
|
shouldDisconnect: false
|
|
@@ -617,9 +672,9 @@ describe('Registration Tests', function () {
|
|
|
617
672
|
expect(logSpy).toHaveBeenCalledWith('409 Conflict: ignored, caller does not handle a superseded session', logObj);
|
|
618
673
|
case 2:
|
|
619
674
|
case "end":
|
|
620
|
-
return
|
|
675
|
+
return _context0.stop();
|
|
621
676
|
}
|
|
622
|
-
},
|
|
677
|
+
}, _callee0);
|
|
623
678
|
})));
|
|
624
679
|
});
|
|
625
680
|
describe('CallingClient Error Tests', function () {
|
|
@@ -631,10 +686,10 @@ describe('CallingClient Error Tests', function () {
|
|
|
631
686
|
beforeEach(function () {
|
|
632
687
|
jest.clearAllMocks();
|
|
633
688
|
});
|
|
634
|
-
it('verify 401 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
689
|
+
it('verify 401 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
635
690
|
var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
|
|
636
|
-
return _regenerator.default.wrap(function (
|
|
637
|
-
while (1) switch (
|
|
691
|
+
return _regenerator.default.wrap(function (_context1) {
|
|
692
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
638
693
|
case 0:
|
|
639
694
|
statusCode = _types2.ERROR_CODE.UNAUTHORIZED;
|
|
640
695
|
message = 'User is unauthorized due to an expired token.';
|
|
@@ -659,24 +714,24 @@ describe('CallingClient Error Tests', function () {
|
|
|
659
714
|
context: logObj
|
|
660
715
|
};
|
|
661
716
|
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
662
|
-
|
|
717
|
+
_context1.next = 1;
|
|
663
718
|
return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
|
|
664
719
|
case 1:
|
|
665
|
-
result =
|
|
720
|
+
result = _context1.sent;
|
|
666
721
|
expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
|
|
667
722
|
expect(result).toBe(finalError);
|
|
668
723
|
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
|
|
669
724
|
expect(logSpy).toHaveBeenCalledWith('401 Unauthorized', logObj);
|
|
670
725
|
case 2:
|
|
671
726
|
case "end":
|
|
672
|
-
return
|
|
727
|
+
return _context1.stop();
|
|
673
728
|
}
|
|
674
|
-
},
|
|
729
|
+
}, _callee1);
|
|
675
730
|
})));
|
|
676
|
-
it('verify 500 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
731
|
+
it('verify 500 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
677
732
|
var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
|
|
678
|
-
return _regenerator.default.wrap(function (
|
|
679
|
-
while (1) switch (
|
|
733
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
734
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
680
735
|
case 0:
|
|
681
736
|
statusCode = _types2.ERROR_CODE.INTERNAL_SERVER_ERROR;
|
|
682
737
|
message = 'An unknown error occurred while placing the request. Wait a moment and try again.';
|
|
@@ -701,24 +756,24 @@ describe('CallingClient Error Tests', function () {
|
|
|
701
756
|
context: logObj
|
|
702
757
|
};
|
|
703
758
|
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
704
|
-
|
|
759
|
+
_context10.next = 1;
|
|
705
760
|
return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
|
|
706
761
|
case 1:
|
|
707
|
-
result =
|
|
762
|
+
result = _context10.sent;
|
|
708
763
|
expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
|
|
709
764
|
expect(result).toBe(finalError);
|
|
710
765
|
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
|
|
711
766
|
expect(logSpy).toHaveBeenCalledWith('500 Internal Server Error', logObj);
|
|
712
767
|
case 2:
|
|
713
768
|
case "end":
|
|
714
|
-
return
|
|
769
|
+
return _context10.stop();
|
|
715
770
|
}
|
|
716
|
-
},
|
|
771
|
+
}, _callee10);
|
|
717
772
|
})));
|
|
718
|
-
it('verify unknown error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
773
|
+
it('verify unknown error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
719
774
|
var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
|
|
720
|
-
return _regenerator.default.wrap(function (
|
|
721
|
-
while (1) switch (
|
|
775
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
776
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
722
777
|
case 0:
|
|
723
778
|
statusCode = 206;
|
|
724
779
|
message = 'Unknown error';
|
|
@@ -743,19 +798,19 @@ describe('CallingClient Error Tests', function () {
|
|
|
743
798
|
context: logObj
|
|
744
799
|
};
|
|
745
800
|
callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
|
|
746
|
-
|
|
801
|
+
_context11.next = 1;
|
|
747
802
|
return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
|
|
748
803
|
case 1:
|
|
749
|
-
result =
|
|
804
|
+
result = _context11.sent;
|
|
750
805
|
expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
|
|
751
806
|
expect(result).toBe(finalError);
|
|
752
807
|
expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
|
|
753
808
|
expect(logSpy).toHaveBeenCalledWith('Unknown Error', logObj);
|
|
754
809
|
case 2:
|
|
755
810
|
case "end":
|
|
756
|
-
return
|
|
811
|
+
return _context11.stop();
|
|
757
812
|
}
|
|
758
|
-
},
|
|
813
|
+
}, _callee11);
|
|
759
814
|
})));
|
|
760
815
|
});
|
|
761
816
|
describe('Call Tests', function () {
|
|
@@ -1303,11 +1358,11 @@ describe('resolveContact tests', function () {
|
|
|
1303
1358
|
}));
|
|
1304
1359
|
});
|
|
1305
1360
|
});
|
|
1306
|
-
it('Resolve by userExternalId - SCIM exception', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1361
|
+
it('Resolve by userExternalId - SCIM exception', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
1307
1362
|
var _callingPartyInfo$use2;
|
|
1308
1363
|
var callingPartyInfo, warnSpy, webexSpy, displayInfo, query;
|
|
1309
|
-
return _regenerator.default.wrap(function (
|
|
1310
|
-
while (1) switch (
|
|
1364
|
+
return _regenerator.default.wrap(function (_context12) {
|
|
1365
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1311
1366
|
case 0:
|
|
1312
1367
|
callingPartyInfo = {};
|
|
1313
1368
|
warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
@@ -1317,10 +1372,10 @@ describe('resolveContact tests', function () {
|
|
|
1317
1372
|
callingPartyInfo.userExternalId = {
|
|
1318
1373
|
$: 'userExternalId'
|
|
1319
1374
|
};
|
|
1320
|
-
|
|
1375
|
+
_context12.next = 1;
|
|
1321
1376
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1322
1377
|
case 1:
|
|
1323
|
-
displayInfo =
|
|
1378
|
+
displayInfo = _context12.sent;
|
|
1324
1379
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
|
|
1325
1380
|
expect(warnSpy).toHaveBeenCalledWith('Error response: - 500', {
|
|
1326
1381
|
file: _constants.UTILS_FILE,
|
|
@@ -1332,15 +1387,15 @@ describe('resolveContact tests', function () {
|
|
|
1332
1387
|
}));
|
|
1333
1388
|
case 2:
|
|
1334
1389
|
case "end":
|
|
1335
|
-
return
|
|
1390
|
+
return _context12.stop();
|
|
1336
1391
|
}
|
|
1337
|
-
},
|
|
1392
|
+
}, _callee12);
|
|
1338
1393
|
})));
|
|
1339
|
-
it('Resolve by userExternalId - totalResults zero', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1394
|
+
it('Resolve by userExternalId - totalResults zero', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
1340
1395
|
var _callingPartyInfo$use3;
|
|
1341
1396
|
var callingPartyInfo, scimResponse, webexSpy, displayInfo, query;
|
|
1342
|
-
return _regenerator.default.wrap(function (
|
|
1343
|
-
while (1) switch (
|
|
1397
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
1398
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1344
1399
|
case 0:
|
|
1345
1400
|
callingPartyInfo = {};
|
|
1346
1401
|
scimResponse = (0, _testUtil.getSampleScimResponse)();
|
|
@@ -1352,10 +1407,10 @@ describe('resolveContact tests', function () {
|
|
|
1352
1407
|
callingPartyInfo.userExternalId = {
|
|
1353
1408
|
$: 'userExternalId'
|
|
1354
1409
|
};
|
|
1355
|
-
|
|
1410
|
+
_context13.next = 1;
|
|
1356
1411
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1357
1412
|
case 1:
|
|
1358
|
-
displayInfo =
|
|
1413
|
+
displayInfo = _context13.sent;
|
|
1359
1414
|
query = scimUrl + encodeURIComponent("id eq \"".concat((_callingPartyInfo$use3 = callingPartyInfo.userExternalId) === null || _callingPartyInfo$use3 === void 0 ? void 0 : _callingPartyInfo$use3.$, "\""));
|
|
1360
1415
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
|
|
1361
1416
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
@@ -1364,15 +1419,15 @@ describe('resolveContact tests', function () {
|
|
|
1364
1419
|
scimResponse.totalResults = '1';
|
|
1365
1420
|
case 2:
|
|
1366
1421
|
case "end":
|
|
1367
|
-
return
|
|
1422
|
+
return _context13.stop();
|
|
1368
1423
|
}
|
|
1369
|
-
},
|
|
1424
|
+
}, _callee13);
|
|
1370
1425
|
})));
|
|
1371
|
-
it('Resolve by userExternalId - no primary number and no phone numbers', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1426
|
+
it('Resolve by userExternalId - no primary number and no phone numbers', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
1372
1427
|
var _callingPartyInfo$use4, _displayInfo, _displayInfo2;
|
|
1373
1428
|
var callingPartyInfo, scimResponse, webexSpy, displayInfo, query, phoneNumbers;
|
|
1374
|
-
return _regenerator.default.wrap(function (
|
|
1375
|
-
while (1) switch (
|
|
1429
|
+
return _regenerator.default.wrap(function (_context14) {
|
|
1430
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1376
1431
|
case 0:
|
|
1377
1432
|
callingPartyInfo = {};
|
|
1378
1433
|
scimResponse = (0, _testUtil.getSampleScimResponse)();
|
|
@@ -1384,10 +1439,10 @@ describe('resolveContact tests', function () {
|
|
|
1384
1439
|
callingPartyInfo.userExternalId = {
|
|
1385
1440
|
$: 'userExternalId'
|
|
1386
1441
|
};
|
|
1387
|
-
|
|
1442
|
+
_context14.next = 1;
|
|
1388
1443
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1389
1444
|
case 1:
|
|
1390
|
-
displayInfo =
|
|
1445
|
+
displayInfo = _context14.sent;
|
|
1391
1446
|
query = scimUrl + encodeURIComponent("id eq \"".concat((_callingPartyInfo$use4 = callingPartyInfo.userExternalId) === null || _callingPartyInfo$use4 === void 0 ? void 0 : _callingPartyInfo$use4.$, "\""));
|
|
1392
1447
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1393
1448
|
uri: query
|
|
@@ -1403,10 +1458,10 @@ describe('resolveContact tests', function () {
|
|
|
1403
1458
|
statusCode: 200,
|
|
1404
1459
|
body: scimResponse
|
|
1405
1460
|
});
|
|
1406
|
-
|
|
1461
|
+
_context14.next = 2;
|
|
1407
1462
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1408
1463
|
case 2:
|
|
1409
|
-
displayInfo =
|
|
1464
|
+
displayInfo = _context14.sent;
|
|
1410
1465
|
expect((_displayInfo2 = displayInfo) === null || _displayInfo2 === void 0 ? void 0 : _displayInfo2.num).toBeUndefined();
|
|
1411
1466
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1412
1467
|
uri: query
|
|
@@ -1414,9 +1469,9 @@ describe('resolveContact tests', function () {
|
|
|
1414
1469
|
scimResponse.Resources[0].phoneNumbers = phoneNumbers;
|
|
1415
1470
|
case 3:
|
|
1416
1471
|
case "end":
|
|
1417
|
-
return
|
|
1472
|
+
return _context14.stop();
|
|
1418
1473
|
}
|
|
1419
|
-
},
|
|
1474
|
+
}, _callee14);
|
|
1420
1475
|
})));
|
|
1421
1476
|
it('Resolve by userExternalId - no photo', function () {
|
|
1422
1477
|
var callingPartyInfo = {};
|
|
@@ -1441,10 +1496,10 @@ describe('resolveContact tests', function () {
|
|
|
1441
1496
|
}));
|
|
1442
1497
|
});
|
|
1443
1498
|
});
|
|
1444
|
-
it('resolveContact escapes SCIM filter injection in userExternalId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1499
|
+
it('resolveContact escapes SCIM filter injection in userExternalId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
1445
1500
|
var callingPartyInfo, injectionPayload, webexSpy, escapedValue, expectedQuery;
|
|
1446
|
-
return _regenerator.default.wrap(function (
|
|
1447
|
-
while (1) switch (
|
|
1501
|
+
return _regenerator.default.wrap(function (_context15) {
|
|
1502
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1448
1503
|
case 0:
|
|
1449
1504
|
callingPartyInfo = {};
|
|
1450
1505
|
injectionPayload = 'x" or userName pr "';
|
|
@@ -1455,7 +1510,7 @@ describe('resolveContact tests', function () {
|
|
|
1455
1510
|
callingPartyInfo.userExternalId = {
|
|
1456
1511
|
$: injectionPayload
|
|
1457
1512
|
};
|
|
1458
|
-
|
|
1513
|
+
_context15.next = 1;
|
|
1459
1514
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1460
1515
|
case 1:
|
|
1461
1516
|
// After escaping: backslash → \\ then double-quote → \"
|
|
@@ -1466,14 +1521,14 @@ describe('resolveContact tests', function () {
|
|
|
1466
1521
|
}));
|
|
1467
1522
|
case 2:
|
|
1468
1523
|
case "end":
|
|
1469
|
-
return
|
|
1524
|
+
return _context15.stop();
|
|
1470
1525
|
}
|
|
1471
|
-
},
|
|
1526
|
+
}, _callee15);
|
|
1472
1527
|
})));
|
|
1473
|
-
it('legitimate externalId still resolves', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1528
|
+
it('legitimate externalId still resolves', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
1474
1529
|
var callingPartyInfo, legitimateId, webexSpy, expectedQuery;
|
|
1475
|
-
return _regenerator.default.wrap(function (
|
|
1476
|
-
while (1) switch (
|
|
1530
|
+
return _regenerator.default.wrap(function (_context16) {
|
|
1531
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1477
1532
|
case 0:
|
|
1478
1533
|
callingPartyInfo = {};
|
|
1479
1534
|
legitimateId = '69fde5ad-fb8b-4a1b-9998-b0999e95719b';
|
|
@@ -1484,7 +1539,7 @@ describe('resolveContact tests', function () {
|
|
|
1484
1539
|
callingPartyInfo.userExternalId = {
|
|
1485
1540
|
$: legitimateId
|
|
1486
1541
|
};
|
|
1487
|
-
|
|
1542
|
+
_context16.next = 1;
|
|
1488
1543
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1489
1544
|
case 1:
|
|
1490
1545
|
// A UUID contains no SCIM metacharacters; the query string is unchanged
|
|
@@ -1494,9 +1549,9 @@ describe('resolveContact tests', function () {
|
|
|
1494
1549
|
}));
|
|
1495
1550
|
case 2:
|
|
1496
1551
|
case "end":
|
|
1497
|
-
return
|
|
1552
|
+
return _context16.stop();
|
|
1498
1553
|
}
|
|
1499
|
-
},
|
|
1554
|
+
}, _callee16);
|
|
1500
1555
|
})));
|
|
1501
1556
|
it('Resolve with minimal response from SCIM', function () {
|
|
1502
1557
|
var callingPartyInfo = {};
|
|
@@ -1538,10 +1593,10 @@ describe('resolveContact tests', function () {
|
|
|
1538
1593
|
}));
|
|
1539
1594
|
});
|
|
1540
1595
|
});
|
|
1541
|
-
it('Resolve by name - Empty Info', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1596
|
+
it('Resolve by name - Empty Info', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
1542
1597
|
var callingPartyInfo, peopleListResponse, items, webexSpy, displayInfo;
|
|
1543
|
-
return _regenerator.default.wrap(function (
|
|
1544
|
-
while (1) switch (
|
|
1598
|
+
return _regenerator.default.wrap(function (_context17) {
|
|
1599
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1545
1600
|
case 0:
|
|
1546
1601
|
callingPartyInfo = {};
|
|
1547
1602
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1551,10 +1606,10 @@ describe('resolveContact tests', function () {
|
|
|
1551
1606
|
callingPartyInfo.name = {
|
|
1552
1607
|
$: 'Name'
|
|
1553
1608
|
};
|
|
1554
|
-
|
|
1609
|
+
_context17.next = 1;
|
|
1555
1610
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1556
1611
|
case 1:
|
|
1557
|
-
displayInfo =
|
|
1612
|
+
displayInfo = _context17.sent;
|
|
1558
1613
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
|
|
1559
1614
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1560
1615
|
displayName: 'Name'
|
|
@@ -1562,15 +1617,15 @@ describe('resolveContact tests', function () {
|
|
|
1562
1617
|
peopleListResponse.items = items;
|
|
1563
1618
|
case 2:
|
|
1564
1619
|
case "end":
|
|
1565
|
-
return
|
|
1620
|
+
return _context17.stop();
|
|
1566
1621
|
}
|
|
1567
|
-
},
|
|
1622
|
+
}, _callee17);
|
|
1568
1623
|
})));
|
|
1569
|
-
it('Resolve by name - ID as plain UUID instead of part of URI', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1624
|
+
it('Resolve by name - ID as plain UUID instead of part of URI', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
1570
1625
|
var _displayInfo3, _displayInfo4, _displayInfo5, _displayInfo6, _displayInfo7, _displayInfo8;
|
|
1571
1626
|
var callingPartyInfo, peopleListResponse, id, webexSpy, displayInfo;
|
|
1572
|
-
return _regenerator.default.wrap(function (
|
|
1573
|
-
while (1) switch (
|
|
1627
|
+
return _regenerator.default.wrap(function (_context18) {
|
|
1628
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1574
1629
|
case 0:
|
|
1575
1630
|
callingPartyInfo = {};
|
|
1576
1631
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1581,10 +1636,10 @@ describe('resolveContact tests', function () {
|
|
|
1581
1636
|
callingPartyInfo.name = {
|
|
1582
1637
|
$: 'Name'
|
|
1583
1638
|
};
|
|
1584
|
-
|
|
1639
|
+
_context18.next = 1;
|
|
1585
1640
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1586
1641
|
case 1:
|
|
1587
|
-
displayInfo =
|
|
1642
|
+
displayInfo = _context18.sent;
|
|
1588
1643
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1589
1644
|
displayName: 'Name'
|
|
1590
1645
|
}));
|
|
@@ -1597,10 +1652,10 @@ describe('resolveContact tests', function () {
|
|
|
1597
1652
|
/* Also test empty id */
|
|
1598
1653
|
peopleListResponse.items[0].id = '';
|
|
1599
1654
|
webex.people.list.mockResolvedValueOnce(peopleListResponse);
|
|
1600
|
-
|
|
1655
|
+
_context18.next = 2;
|
|
1601
1656
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1602
1657
|
case 2:
|
|
1603
|
-
displayInfo =
|
|
1658
|
+
displayInfo = _context18.sent;
|
|
1604
1659
|
expect((_displayInfo7 = displayInfo) === null || _displayInfo7 === void 0 ? void 0 : _displayInfo7.id).toStrictEqual('');
|
|
1605
1660
|
expect((_displayInfo8 = displayInfo) === null || _displayInfo8 === void 0 ? void 0 : _displayInfo8.name).toStrictEqual(peopleListResponse.items[0].displayName);
|
|
1606
1661
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
@@ -1609,14 +1664,14 @@ describe('resolveContact tests', function () {
|
|
|
1609
1664
|
peopleListResponse.items[0].id = id;
|
|
1610
1665
|
case 3:
|
|
1611
1666
|
case "end":
|
|
1612
|
-
return
|
|
1667
|
+
return _context18.stop();
|
|
1613
1668
|
}
|
|
1614
|
-
},
|
|
1669
|
+
}, _callee18);
|
|
1615
1670
|
})));
|
|
1616
|
-
it('Resolve by name - Phone numbers no match for type - work', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1671
|
+
it('Resolve by name - Phone numbers no match for type - work', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
1617
1672
|
var callingPartyInfo, peopleListResponse, phoneNumbers, webexSpy, displayInfo;
|
|
1618
|
-
return _regenerator.default.wrap(function (
|
|
1619
|
-
while (1) switch (
|
|
1673
|
+
return _regenerator.default.wrap(function (_context19) {
|
|
1674
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1620
1675
|
case 0:
|
|
1621
1676
|
callingPartyInfo = {};
|
|
1622
1677
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1627,10 +1682,10 @@ describe('resolveContact tests', function () {
|
|
|
1627
1682
|
callingPartyInfo.name = {
|
|
1628
1683
|
$: 'Name'
|
|
1629
1684
|
};
|
|
1630
|
-
|
|
1685
|
+
_context19.next = 1;
|
|
1631
1686
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1632
1687
|
case 1:
|
|
1633
|
-
displayInfo =
|
|
1688
|
+
displayInfo = _context19.sent;
|
|
1634
1689
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toStrictEqual(peopleListResponse.items[0].displayName);
|
|
1635
1690
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.num).toStrictEqual(peopleListResponse.items[0].phoneNumbers[0].value);
|
|
1636
1691
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.avatarSrc).toStrictEqual(peopleListResponse.items[0].avatar);
|
|
@@ -1640,14 +1695,14 @@ describe('resolveContact tests', function () {
|
|
|
1640
1695
|
peopleListResponse.items[0].phoneNumbers = phoneNumbers;
|
|
1641
1696
|
case 2:
|
|
1642
1697
|
case "end":
|
|
1643
|
-
return
|
|
1698
|
+
return _context19.stop();
|
|
1644
1699
|
}
|
|
1645
|
-
},
|
|
1700
|
+
}, _callee19);
|
|
1646
1701
|
})));
|
|
1647
|
-
it('Resolve by name - Phone numbers empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1702
|
+
it('Resolve by name - Phone numbers empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
1648
1703
|
var callingPartyInfo, peopleListResponse, phoneNumbers, webexSpy, displayInfo;
|
|
1649
|
-
return _regenerator.default.wrap(function (
|
|
1650
|
-
while (1) switch (
|
|
1704
|
+
return _regenerator.default.wrap(function (_context20) {
|
|
1705
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1651
1706
|
case 0:
|
|
1652
1707
|
callingPartyInfo = {};
|
|
1653
1708
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1657,10 +1712,10 @@ describe('resolveContact tests', function () {
|
|
|
1657
1712
|
callingPartyInfo.name = {
|
|
1658
1713
|
$: 'Name'
|
|
1659
1714
|
};
|
|
1660
|
-
|
|
1715
|
+
_context20.next = 1;
|
|
1661
1716
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1662
1717
|
case 1:
|
|
1663
|
-
displayInfo =
|
|
1718
|
+
displayInfo = _context20.sent;
|
|
1664
1719
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1665
1720
|
displayName: 'Name'
|
|
1666
1721
|
}));
|
|
@@ -1670,9 +1725,9 @@ describe('resolveContact tests', function () {
|
|
|
1670
1725
|
peopleListResponse.items[0].phoneNumbers = phoneNumbers;
|
|
1671
1726
|
case 2:
|
|
1672
1727
|
case "end":
|
|
1673
|
-
return
|
|
1728
|
+
return _context20.stop();
|
|
1674
1729
|
}
|
|
1675
|
-
},
|
|
1730
|
+
}, _callee20);
|
|
1676
1731
|
})));
|
|
1677
1732
|
});
|
|
1678
1733
|
describe('Store and Fetch voicemail tests', function () {
|
|
@@ -1790,40 +1845,40 @@ describe('Infer id from UUID Tests', function () {
|
|
|
1790
1845
|
});
|
|
1791
1846
|
});
|
|
1792
1847
|
describe('Get endpoint by CALLING_BACKEND tests', function () {
|
|
1793
|
-
it('verify invalid calling backend ucm for xsi endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1848
|
+
it('verify invalid calling backend ucm for xsi endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
1794
1849
|
var _t;
|
|
1795
|
-
return _regenerator.default.wrap(function (
|
|
1796
|
-
while (1) switch (
|
|
1850
|
+
return _regenerator.default.wrap(function (_context21) {
|
|
1851
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1797
1852
|
case 0:
|
|
1798
1853
|
_t = expect;
|
|
1799
|
-
|
|
1854
|
+
_context21.next = 1;
|
|
1800
1855
|
return (0, _Utils.getXsiActionEndpoint)(webex, {
|
|
1801
1856
|
file: 'testFile',
|
|
1802
1857
|
method: 'testMethod'
|
|
1803
1858
|
}, _types.CALLING_BACKEND.UCM);
|
|
1804
1859
|
case 1:
|
|
1805
|
-
_t(
|
|
1860
|
+
_t(_context21.sent).toBeInstanceOf(Error);
|
|
1806
1861
|
case 2:
|
|
1807
1862
|
case "end":
|
|
1808
|
-
return
|
|
1863
|
+
return _context21.stop();
|
|
1809
1864
|
}
|
|
1810
|
-
},
|
|
1865
|
+
}, _callee21);
|
|
1811
1866
|
})));
|
|
1812
|
-
it('verify invalid calling backend wxc for vg endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1867
|
+
it('verify invalid calling backend wxc for vg endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
1813
1868
|
var _t2;
|
|
1814
|
-
return _regenerator.default.wrap(function (
|
|
1815
|
-
while (1) switch (
|
|
1869
|
+
return _regenerator.default.wrap(function (_context22) {
|
|
1870
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1816
1871
|
case 0:
|
|
1817
1872
|
_t2 = expect;
|
|
1818
|
-
|
|
1873
|
+
_context22.next = 1;
|
|
1819
1874
|
return (0, _Utils.getVgActionEndpoint)(webex, _types.CALLING_BACKEND.WXC);
|
|
1820
1875
|
case 1:
|
|
1821
|
-
_t2(
|
|
1876
|
+
_t2(_context22.sent).toBeInstanceOf(Error);
|
|
1822
1877
|
case 2:
|
|
1823
1878
|
case "end":
|
|
1824
|
-
return
|
|
1879
|
+
return _context22.stop();
|
|
1825
1880
|
}
|
|
1826
|
-
},
|
|
1881
|
+
}, _callee22);
|
|
1827
1882
|
})));
|
|
1828
1883
|
});
|
|
1829
1884
|
describe('Get XSI Action Endpoint tests', function () {
|
|
@@ -1845,10 +1900,10 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1845
1900
|
beforeEach(function () {
|
|
1846
1901
|
mockWebex.request.mockClear();
|
|
1847
1902
|
});
|
|
1848
|
-
it('should return xsiEndpoint for WXC backend using _serviceUrls.hydra', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1903
|
+
it('should return xsiEndpoint for WXC backend using _serviceUrls.hydra', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
1849
1904
|
var hydraEndpoint, wxcWebex, result;
|
|
1850
|
-
return _regenerator.default.wrap(function (
|
|
1851
|
-
while (1) switch (
|
|
1905
|
+
return _regenerator.default.wrap(function (_context23) {
|
|
1906
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1852
1907
|
case 0:
|
|
1853
1908
|
hydraEndpoint = 'https://hydra-a.wbx2.com/v1/';
|
|
1854
1909
|
wxcWebex = {
|
|
@@ -1868,10 +1923,10 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1868
1923
|
}
|
|
1869
1924
|
}
|
|
1870
1925
|
};
|
|
1871
|
-
|
|
1926
|
+
_context23.next = 1;
|
|
1872
1927
|
return (0, _Utils.getXsiActionEndpoint)(wxcWebex, loggerContext, _types.CALLING_BACKEND.WXC);
|
|
1873
1928
|
case 1:
|
|
1874
|
-
result =
|
|
1929
|
+
result = _context23.sent;
|
|
1875
1930
|
expect(wxcWebex.request).toBeCalledOnceWith({
|
|
1876
1931
|
method: _types.HTTP_METHODS.GET,
|
|
1877
1932
|
uri: "".concat(hydraEndpoint, "/").concat(_constants2.XSI_ACTION_ENDPOINT_ORG_URL_PARAM)
|
|
@@ -1880,14 +1935,14 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1880
1935
|
expect(wxcWebex.internal.services.get).not.toHaveBeenCalled();
|
|
1881
1936
|
case 2:
|
|
1882
1937
|
case "end":
|
|
1883
|
-
return
|
|
1938
|
+
return _context23.stop();
|
|
1884
1939
|
}
|
|
1885
|
-
},
|
|
1940
|
+
}, _callee23);
|
|
1886
1941
|
})));
|
|
1887
|
-
it('should return xsiEndpoint for WXC backend using services.get when _serviceUrls is undefined', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1942
|
+
it('should return xsiEndpoint for WXC backend using services.get when _serviceUrls is undefined', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
1888
1943
|
var hydraEndpoint, activeHydraCluster, wxcWebex, result;
|
|
1889
|
-
return _regenerator.default.wrap(function (
|
|
1890
|
-
while (1) switch (
|
|
1944
|
+
return _regenerator.default.wrap(function (_context24) {
|
|
1945
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1891
1946
|
case 0:
|
|
1892
1947
|
hydraEndpoint = 'https://hydra-a.wbx2.com/v1/';
|
|
1893
1948
|
activeHydraCluster = 'urn:TEAM:us-east-2_a:hydra';
|
|
@@ -1906,10 +1961,10 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1906
1961
|
}
|
|
1907
1962
|
}
|
|
1908
1963
|
};
|
|
1909
|
-
|
|
1964
|
+
_context24.next = 1;
|
|
1910
1965
|
return (0, _Utils.getXsiActionEndpoint)(wxcWebex, loggerContext, _types.CALLING_BACKEND.WXC);
|
|
1911
1966
|
case 1:
|
|
1912
|
-
result =
|
|
1967
|
+
result = _context24.sent;
|
|
1913
1968
|
expect(wxcWebex.internal.services.get).toBeCalledOnceWith(activeHydraCluster);
|
|
1914
1969
|
expect(wxcWebex.request).toBeCalledOnceWith({
|
|
1915
1970
|
method: _types.HTTP_METHODS.GET,
|
|
@@ -1918,14 +1973,14 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1918
1973
|
expect(result).toBe(expectedXsiEndpoint);
|
|
1919
1974
|
case 2:
|
|
1920
1975
|
case "end":
|
|
1921
|
-
return
|
|
1976
|
+
return _context24.stop();
|
|
1922
1977
|
}
|
|
1923
|
-
},
|
|
1978
|
+
}, _callee24);
|
|
1924
1979
|
})));
|
|
1925
|
-
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1980
|
+
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
1926
1981
|
var mockResponse, xsiEndpoint;
|
|
1927
|
-
return _regenerator.default.wrap(function (
|
|
1928
|
-
while (1) switch (
|
|
1982
|
+
return _regenerator.default.wrap(function (_context25) {
|
|
1983
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1929
1984
|
case 0:
|
|
1930
1985
|
mockResponse = {
|
|
1931
1986
|
body: {
|
|
@@ -1937,22 +1992,22 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1937
1992
|
}
|
|
1938
1993
|
};
|
|
1939
1994
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1940
|
-
|
|
1995
|
+
_context25.next = 1;
|
|
1941
1996
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1942
1997
|
case 1:
|
|
1943
|
-
xsiEndpoint =
|
|
1998
|
+
xsiEndpoint = _context25.sent;
|
|
1944
1999
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1945
2000
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1946
2001
|
case 2:
|
|
1947
2002
|
case "end":
|
|
1948
|
-
return
|
|
2003
|
+
return _context25.stop();
|
|
1949
2004
|
}
|
|
1950
|
-
},
|
|
2005
|
+
}, _callee25);
|
|
1951
2006
|
})));
|
|
1952
|
-
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2007
|
+
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
1953
2008
|
var mockResponse, xsiEndpoint;
|
|
1954
|
-
return _regenerator.default.wrap(function (
|
|
1955
|
-
while (1) switch (
|
|
2009
|
+
return _regenerator.default.wrap(function (_context26) {
|
|
2010
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1956
2011
|
case 0:
|
|
1957
2012
|
mockResponse = {
|
|
1958
2013
|
body: {
|
|
@@ -1964,22 +2019,22 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1964
2019
|
}
|
|
1965
2020
|
};
|
|
1966
2021
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1967
|
-
|
|
2022
|
+
_context26.next = 1;
|
|
1968
2023
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1969
2024
|
case 1:
|
|
1970
|
-
xsiEndpoint =
|
|
2025
|
+
xsiEndpoint = _context26.sent;
|
|
1971
2026
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1972
2027
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1973
2028
|
case 2:
|
|
1974
2029
|
case "end":
|
|
1975
|
-
return
|
|
2030
|
+
return _context26.stop();
|
|
1976
2031
|
}
|
|
1977
|
-
},
|
|
2032
|
+
}, _callee26);
|
|
1978
2033
|
})));
|
|
1979
|
-
it('should return xsiEndpoint for BWRKS backend when URL does not end with any version', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2034
|
+
it('should return xsiEndpoint for BWRKS backend when URL does not end with any version', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
|
|
1980
2035
|
var mockResponse, xsiEndpoint;
|
|
1981
|
-
return _regenerator.default.wrap(function (
|
|
1982
|
-
while (1) switch (
|
|
2036
|
+
return _regenerator.default.wrap(function (_context27) {
|
|
2037
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1983
2038
|
case 0:
|
|
1984
2039
|
mockResponse = {
|
|
1985
2040
|
body: {
|
|
@@ -1991,17 +2046,17 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1991
2046
|
}
|
|
1992
2047
|
};
|
|
1993
2048
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1994
|
-
|
|
2049
|
+
_context27.next = 1;
|
|
1995
2050
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1996
2051
|
case 1:
|
|
1997
|
-
xsiEndpoint =
|
|
2052
|
+
xsiEndpoint = _context27.sent;
|
|
1998
2053
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1999
2054
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
2000
2055
|
case 2:
|
|
2001
2056
|
case "end":
|
|
2002
|
-
return
|
|
2057
|
+
return _context27.stop();
|
|
2003
2058
|
}
|
|
2004
|
-
},
|
|
2059
|
+
}, _callee27);
|
|
2005
2060
|
})));
|
|
2006
2061
|
});
|
|
2007
2062
|
describe('uploadLogs', function () {
|
|
@@ -2023,19 +2078,19 @@ describe('uploadLogs', function () {
|
|
|
2023
2078
|
afterEach(function () {
|
|
2024
2079
|
jest.clearAllMocks();
|
|
2025
2080
|
});
|
|
2026
|
-
it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2081
|
+
it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
|
|
2027
2082
|
var mockMetaData, logSpy, result;
|
|
2028
|
-
return _regenerator.default.wrap(function (
|
|
2029
|
-
while (1) switch (
|
|
2083
|
+
return _regenerator.default.wrap(function (_context28) {
|
|
2084
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2030
2085
|
case 0:
|
|
2031
2086
|
mockMetaData = {
|
|
2032
2087
|
correlationId: 'test-correlation'
|
|
2033
2088
|
};
|
|
2034
2089
|
logSpy = jest.spyOn(_Logger.default, 'info');
|
|
2035
|
-
|
|
2090
|
+
_context28.next = 1;
|
|
2036
2091
|
return (0, _Utils.uploadLogs)(mockMetaData, true);
|
|
2037
2092
|
case 1:
|
|
2038
|
-
result =
|
|
2093
|
+
result = _context28.sent;
|
|
2039
2094
|
expect(result).toEqual({
|
|
2040
2095
|
trackingid: '1234',
|
|
2041
2096
|
feedbackId: 'mocked-uuid-12345'
|
|
@@ -2068,14 +2123,14 @@ describe('uploadLogs', function () {
|
|
|
2068
2123
|
});
|
|
2069
2124
|
case 2:
|
|
2070
2125
|
case "end":
|
|
2071
|
-
return
|
|
2126
|
+
return _context28.stop();
|
|
2072
2127
|
}
|
|
2073
|
-
},
|
|
2128
|
+
}, _callee28);
|
|
2074
2129
|
})));
|
|
2075
|
-
it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2130
|
+
it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
|
|
2076
2131
|
var mockMetaData, mockError, logSpy, _t3;
|
|
2077
|
-
return _regenerator.default.wrap(function (
|
|
2078
|
-
while (1) switch (
|
|
2132
|
+
return _regenerator.default.wrap(function (_context29) {
|
|
2133
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2079
2134
|
case 0:
|
|
2080
2135
|
mockMetaData = {
|
|
2081
2136
|
correlationId: 'test-correlation'
|
|
@@ -2083,17 +2138,17 @@ describe('uploadLogs', function () {
|
|
|
2083
2138
|
mockError = new Error('Upload failed'); // Mock the submitLogs to fail
|
|
2084
2139
|
submitLogsMock.mockRejectedValueOnce(mockError);
|
|
2085
2140
|
logSpy = jest.spyOn(_Logger.default, 'error');
|
|
2086
|
-
|
|
2087
|
-
|
|
2141
|
+
_context29.prev = 1;
|
|
2142
|
+
_context29.next = 2;
|
|
2088
2143
|
return (0, _Utils.uploadLogs)(mockMetaData, true);
|
|
2089
2144
|
case 2:
|
|
2090
2145
|
// If we get here, the test should fail since we expected an exception
|
|
2091
2146
|
expect(true).toBe(false); // This will fail the test if no exception is thrown
|
|
2092
|
-
|
|
2147
|
+
_context29.next = 4;
|
|
2093
2148
|
break;
|
|
2094
2149
|
case 3:
|
|
2095
|
-
|
|
2096
|
-
_t3 =
|
|
2150
|
+
_context29.prev = 3;
|
|
2151
|
+
_t3 = _context29["catch"](1);
|
|
2097
2152
|
expect(_t3).toBe(mockError);
|
|
2098
2153
|
expect(logSpy).toHaveBeenCalledWith("Failed to upload Logs ".concat((0, _stringify.default)(_t3)), {
|
|
2099
2154
|
file: _constants.UTILS_FILE,
|
|
@@ -2120,14 +2175,14 @@ describe('uploadLogs', function () {
|
|
|
2120
2175
|
});
|
|
2121
2176
|
case 4:
|
|
2122
2177
|
case "end":
|
|
2123
|
-
return
|
|
2178
|
+
return _context29.stop();
|
|
2124
2179
|
}
|
|
2125
|
-
},
|
|
2180
|
+
}, _callee29, null, [[1, 3]]);
|
|
2126
2181
|
})));
|
|
2127
|
-
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
|
|
2182
|
+
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 _callee30() {
|
|
2128
2183
|
var mockMetaData, mockError, logSpy, result;
|
|
2129
|
-
return _regenerator.default.wrap(function (
|
|
2130
|
-
while (1) switch (
|
|
2184
|
+
return _regenerator.default.wrap(function (_context30) {
|
|
2185
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2131
2186
|
case 0:
|
|
2132
2187
|
mockMetaData = {
|
|
2133
2188
|
correlationId: 'test-correlation',
|
|
@@ -2136,10 +2191,10 @@ describe('uploadLogs', function () {
|
|
|
2136
2191
|
mockError = new Error('Upload failed'); // Mock the submitLogs to fail
|
|
2137
2192
|
submitLogsMock.mockRejectedValueOnce(mockError);
|
|
2138
2193
|
logSpy = jest.spyOn(_Logger.default, 'error');
|
|
2139
|
-
|
|
2194
|
+
_context30.next = 1;
|
|
2140
2195
|
return (0, _Utils.uploadLogs)(mockMetaData, false);
|
|
2141
2196
|
case 1:
|
|
2142
|
-
result =
|
|
2197
|
+
result = _context30.sent;
|
|
2143
2198
|
expect(result).toBeUndefined();
|
|
2144
2199
|
expect(logSpy).toHaveBeenCalledWith("Failed to upload Logs ".concat((0, _stringify.default)(mockError)), {
|
|
2145
2200
|
file: _constants.UTILS_FILE,
|
|
@@ -2166,9 +2221,9 @@ describe('uploadLogs', function () {
|
|
|
2166
2221
|
});
|
|
2167
2222
|
case 2:
|
|
2168
2223
|
case "end":
|
|
2169
|
-
return
|
|
2224
|
+
return _context30.stop();
|
|
2170
2225
|
}
|
|
2171
|
-
},
|
|
2226
|
+
}, _callee30);
|
|
2172
2227
|
})));
|
|
2173
2228
|
});
|
|
2174
2229
|
describe('resolveCallingBackend', function () {
|