@webex/calling 3.12.0-next.119 → 3.12.0-next.120
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/calling/CallerId/index.js +3 -1
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +12 -2
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
- package/dist/common/Utils.js +56 -5
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +182 -103
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/constants.js +10 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/mobius-socket/mobius-socket-events.test.js +1 -0
- package/dist/mobius-socket/mobius-socket-events.test.js.map +1 -1
- package/dist/mobius-socket/mobius-socket.test.js +12 -12
- package/dist/mobius-socket/mobius-socket.test.js.map +1 -1
- package/dist/mobius-socket/socket/socket-base.js +10 -0
- package/dist/mobius-socket/socket/socket-base.js.map +1 -1
- package/dist/mobius-socket/socket.test.js +34 -14
- package/dist/mobius-socket/socket.test.js.map +1 -1
- package/dist/module/CallingClient/calling/CallerId/index.js +2 -2
- package/dist/module/common/Utils.js +28 -4
- package/dist/module/common/constants.js +6 -0
- package/dist/module/mobius-socket/socket/socket-base.js +8 -0
- package/dist/types/CallingClient/calling/CallerId/index.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +2 -0
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/constants.d.ts +1 -0
- package/dist/types/common/constants.d.ts.map +1 -1
- package/dist/types/mobius-socket/socket/socket-base.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -66,6 +66,28 @@ describe('Mobius service discovery tests', function () {
|
|
|
66
66
|
expect(filteredUris.primary[0]).toBe(defaultMobiusUrl + callingContext);
|
|
67
67
|
expect(filteredUris.backup.length).toBe(0);
|
|
68
68
|
});
|
|
69
|
+
it('filterMobiusUris drops untrusted wss hosts', function () {
|
|
70
|
+
var defaultMobiusUrl = 'https://mobius.webex.com/api/v1/calling/web';
|
|
71
|
+
var discoveryResponse = (0, _testUtil.getMobiusDiscoveryResponse)();
|
|
72
|
+
discoveryResponse.primary.wss = ['wss://mobius-dfw.webex.com/socket', 'wss://evil.example.com/socket'];
|
|
73
|
+
discoveryResponse.backup.wss = ['wss://mobius-sjc.webex.com/socket', 'wss://attacker.example.org/socket'];
|
|
74
|
+
var filteredUris = (0, _Utils.filterMobiusUris)(discoveryResponse, defaultMobiusUrl);
|
|
75
|
+
expect(filteredUris.primaryWss).toHaveLength(1);
|
|
76
|
+
expect(filteredUris.primaryWss[0]).toBe('wss://mobius-dfw.webex.com/socket');
|
|
77
|
+
expect(filteredUris.backupWss).toHaveLength(1);
|
|
78
|
+
expect(filteredUris.backupWss[0]).toBe('wss://mobius-sjc.webex.com/socket');
|
|
79
|
+
});
|
|
80
|
+
it('filterMobiusUris drops malformed/unparseable wss hosts', function () {
|
|
81
|
+
var defaultMobiusUrl = 'https://mobius.webex.com/api/v1/calling/web';
|
|
82
|
+
var discoveryResponse = (0, _testUtil.getMobiusDiscoveryResponse)();
|
|
83
|
+
discoveryResponse.primary.wss = ['wss://mobius-dfw.webex.com/socket', 'wss://', 'not a url'];
|
|
84
|
+
discoveryResponse.backup.wss = ['not a url', 'wss://mobius-sjc.webex.com/socket'];
|
|
85
|
+
var filteredUris = (0, _Utils.filterMobiusUris)(discoveryResponse, defaultMobiusUrl);
|
|
86
|
+
expect(filteredUris.primaryWss).toHaveLength(1);
|
|
87
|
+
expect(filteredUris.primaryWss[0]).toBe('wss://mobius-dfw.webex.com/socket');
|
|
88
|
+
expect(filteredUris.backupWss).toHaveLength(1);
|
|
89
|
+
expect(filteredUris.backupWss[0]).toBe('wss://mobius-sjc.webex.com/socket');
|
|
90
|
+
});
|
|
69
91
|
});
|
|
70
92
|
describe('Call Tests - keepalive (handleCallEstablished) cases', function () {
|
|
71
93
|
var logObj = {
|
|
@@ -1419,6 +1441,63 @@ describe('resolveContact tests', function () {
|
|
|
1419
1441
|
}));
|
|
1420
1442
|
});
|
|
1421
1443
|
});
|
|
1444
|
+
it('resolveContact escapes SCIM filter injection in userExternalId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
1445
|
+
var callingPartyInfo, injectionPayload, webexSpy, escapedValue, expectedQuery;
|
|
1446
|
+
return _regenerator.default.wrap(function (_context14) {
|
|
1447
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1448
|
+
case 0:
|
|
1449
|
+
callingPartyInfo = {};
|
|
1450
|
+
injectionPayload = 'x" or userName pr "';
|
|
1451
|
+
webexSpy = jest.spyOn(webex, 'request').mockResolvedValueOnce({
|
|
1452
|
+
statusCode: 200,
|
|
1453
|
+
body: (0, _testUtil.getSampleScimResponse)()
|
|
1454
|
+
});
|
|
1455
|
+
callingPartyInfo.userExternalId = {
|
|
1456
|
+
$: injectionPayload
|
|
1457
|
+
};
|
|
1458
|
+
_context14.next = 1;
|
|
1459
|
+
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1460
|
+
case 1:
|
|
1461
|
+
// After escaping: backslash → \\ then double-quote → \"
|
|
1462
|
+
escapedValue = injectionPayload.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
1463
|
+
expectedQuery = scimUrl + encodeURIComponent("id eq \"".concat(escapedValue, "\""));
|
|
1464
|
+
expect(webexSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
1465
|
+
uri: expectedQuery
|
|
1466
|
+
}));
|
|
1467
|
+
case 2:
|
|
1468
|
+
case "end":
|
|
1469
|
+
return _context14.stop();
|
|
1470
|
+
}
|
|
1471
|
+
}, _callee14);
|
|
1472
|
+
})));
|
|
1473
|
+
it('legitimate externalId still resolves', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
1474
|
+
var callingPartyInfo, legitimateId, webexSpy, expectedQuery;
|
|
1475
|
+
return _regenerator.default.wrap(function (_context15) {
|
|
1476
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1477
|
+
case 0:
|
|
1478
|
+
callingPartyInfo = {};
|
|
1479
|
+
legitimateId = '69fde5ad-fb8b-4a1b-9998-b0999e95719b';
|
|
1480
|
+
webexSpy = jest.spyOn(webex, 'request').mockResolvedValueOnce({
|
|
1481
|
+
statusCode: 200,
|
|
1482
|
+
body: (0, _testUtil.getSampleScimResponse)()
|
|
1483
|
+
});
|
|
1484
|
+
callingPartyInfo.userExternalId = {
|
|
1485
|
+
$: legitimateId
|
|
1486
|
+
};
|
|
1487
|
+
_context15.next = 1;
|
|
1488
|
+
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1489
|
+
case 1:
|
|
1490
|
+
// A UUID contains no SCIM metacharacters; the query string is unchanged
|
|
1491
|
+
expectedQuery = scimUrl + encodeURIComponent("id eq \"".concat(legitimateId, "\""));
|
|
1492
|
+
expect(webexSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
1493
|
+
uri: expectedQuery
|
|
1494
|
+
}));
|
|
1495
|
+
case 2:
|
|
1496
|
+
case "end":
|
|
1497
|
+
return _context15.stop();
|
|
1498
|
+
}
|
|
1499
|
+
}, _callee15);
|
|
1500
|
+
})));
|
|
1422
1501
|
it('Resolve with minimal response from SCIM', function () {
|
|
1423
1502
|
var callingPartyInfo = {};
|
|
1424
1503
|
var scimResponse = (0, _testUtil.getSampleMinimumScimResponse)();
|
|
@@ -1459,10 +1538,10 @@ describe('resolveContact tests', function () {
|
|
|
1459
1538
|
}));
|
|
1460
1539
|
});
|
|
1461
1540
|
});
|
|
1462
|
-
it('Resolve by name - Empty Info', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1541
|
+
it('Resolve by name - Empty Info', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
1463
1542
|
var callingPartyInfo, peopleListResponse, items, webexSpy, displayInfo;
|
|
1464
|
-
return _regenerator.default.wrap(function (
|
|
1465
|
-
while (1) switch (
|
|
1543
|
+
return _regenerator.default.wrap(function (_context16) {
|
|
1544
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1466
1545
|
case 0:
|
|
1467
1546
|
callingPartyInfo = {};
|
|
1468
1547
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1472,10 +1551,10 @@ describe('resolveContact tests', function () {
|
|
|
1472
1551
|
callingPartyInfo.name = {
|
|
1473
1552
|
$: 'Name'
|
|
1474
1553
|
};
|
|
1475
|
-
|
|
1554
|
+
_context16.next = 1;
|
|
1476
1555
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1477
1556
|
case 1:
|
|
1478
|
-
displayInfo =
|
|
1557
|
+
displayInfo = _context16.sent;
|
|
1479
1558
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
|
|
1480
1559
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1481
1560
|
displayName: 'Name'
|
|
@@ -1483,15 +1562,15 @@ describe('resolveContact tests', function () {
|
|
|
1483
1562
|
peopleListResponse.items = items;
|
|
1484
1563
|
case 2:
|
|
1485
1564
|
case "end":
|
|
1486
|
-
return
|
|
1565
|
+
return _context16.stop();
|
|
1487
1566
|
}
|
|
1488
|
-
},
|
|
1567
|
+
}, _callee16);
|
|
1489
1568
|
})));
|
|
1490
|
-
it('Resolve by name - ID as plain UUID instead of part of URI', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1569
|
+
it('Resolve by name - ID as plain UUID instead of part of URI', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
1491
1570
|
var _displayInfo3, _displayInfo4, _displayInfo5, _displayInfo6, _displayInfo7, _displayInfo8;
|
|
1492
1571
|
var callingPartyInfo, peopleListResponse, id, webexSpy, displayInfo;
|
|
1493
|
-
return _regenerator.default.wrap(function (
|
|
1494
|
-
while (1) switch (
|
|
1572
|
+
return _regenerator.default.wrap(function (_context17) {
|
|
1573
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1495
1574
|
case 0:
|
|
1496
1575
|
callingPartyInfo = {};
|
|
1497
1576
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1502,10 +1581,10 @@ describe('resolveContact tests', function () {
|
|
|
1502
1581
|
callingPartyInfo.name = {
|
|
1503
1582
|
$: 'Name'
|
|
1504
1583
|
};
|
|
1505
|
-
|
|
1584
|
+
_context17.next = 1;
|
|
1506
1585
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1507
1586
|
case 1:
|
|
1508
|
-
displayInfo =
|
|
1587
|
+
displayInfo = _context17.sent;
|
|
1509
1588
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1510
1589
|
displayName: 'Name'
|
|
1511
1590
|
}));
|
|
@@ -1518,10 +1597,10 @@ describe('resolveContact tests', function () {
|
|
|
1518
1597
|
/* Also test empty id */
|
|
1519
1598
|
peopleListResponse.items[0].id = '';
|
|
1520
1599
|
webex.people.list.mockResolvedValueOnce(peopleListResponse);
|
|
1521
|
-
|
|
1600
|
+
_context17.next = 2;
|
|
1522
1601
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1523
1602
|
case 2:
|
|
1524
|
-
displayInfo =
|
|
1603
|
+
displayInfo = _context17.sent;
|
|
1525
1604
|
expect((_displayInfo7 = displayInfo) === null || _displayInfo7 === void 0 ? void 0 : _displayInfo7.id).toStrictEqual('');
|
|
1526
1605
|
expect((_displayInfo8 = displayInfo) === null || _displayInfo8 === void 0 ? void 0 : _displayInfo8.name).toStrictEqual(peopleListResponse.items[0].displayName);
|
|
1527
1606
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
@@ -1530,14 +1609,14 @@ describe('resolveContact tests', function () {
|
|
|
1530
1609
|
peopleListResponse.items[0].id = id;
|
|
1531
1610
|
case 3:
|
|
1532
1611
|
case "end":
|
|
1533
|
-
return
|
|
1612
|
+
return _context17.stop();
|
|
1534
1613
|
}
|
|
1535
|
-
},
|
|
1614
|
+
}, _callee17);
|
|
1536
1615
|
})));
|
|
1537
|
-
it('Resolve by name - Phone numbers no match for type - work', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1616
|
+
it('Resolve by name - Phone numbers no match for type - work', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
1538
1617
|
var callingPartyInfo, peopleListResponse, phoneNumbers, webexSpy, displayInfo;
|
|
1539
|
-
return _regenerator.default.wrap(function (
|
|
1540
|
-
while (1) switch (
|
|
1618
|
+
return _regenerator.default.wrap(function (_context18) {
|
|
1619
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1541
1620
|
case 0:
|
|
1542
1621
|
callingPartyInfo = {};
|
|
1543
1622
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1548,10 +1627,10 @@ describe('resolveContact tests', function () {
|
|
|
1548
1627
|
callingPartyInfo.name = {
|
|
1549
1628
|
$: 'Name'
|
|
1550
1629
|
};
|
|
1551
|
-
|
|
1630
|
+
_context18.next = 1;
|
|
1552
1631
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1553
1632
|
case 1:
|
|
1554
|
-
displayInfo =
|
|
1633
|
+
displayInfo = _context18.sent;
|
|
1555
1634
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toStrictEqual(peopleListResponse.items[0].displayName);
|
|
1556
1635
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.num).toStrictEqual(peopleListResponse.items[0].phoneNumbers[0].value);
|
|
1557
1636
|
expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.avatarSrc).toStrictEqual(peopleListResponse.items[0].avatar);
|
|
@@ -1561,14 +1640,14 @@ describe('resolveContact tests', function () {
|
|
|
1561
1640
|
peopleListResponse.items[0].phoneNumbers = phoneNumbers;
|
|
1562
1641
|
case 2:
|
|
1563
1642
|
case "end":
|
|
1564
|
-
return
|
|
1643
|
+
return _context18.stop();
|
|
1565
1644
|
}
|
|
1566
|
-
},
|
|
1645
|
+
}, _callee18);
|
|
1567
1646
|
})));
|
|
1568
|
-
it('Resolve by name - Phone numbers empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1647
|
+
it('Resolve by name - Phone numbers empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
1569
1648
|
var callingPartyInfo, peopleListResponse, phoneNumbers, webexSpy, displayInfo;
|
|
1570
|
-
return _regenerator.default.wrap(function (
|
|
1571
|
-
while (1) switch (
|
|
1649
|
+
return _regenerator.default.wrap(function (_context19) {
|
|
1650
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1572
1651
|
case 0:
|
|
1573
1652
|
callingPartyInfo = {};
|
|
1574
1653
|
peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
|
|
@@ -1578,10 +1657,10 @@ describe('resolveContact tests', function () {
|
|
|
1578
1657
|
callingPartyInfo.name = {
|
|
1579
1658
|
$: 'Name'
|
|
1580
1659
|
};
|
|
1581
|
-
|
|
1660
|
+
_context19.next = 1;
|
|
1582
1661
|
return (0, _Utils.resolveContact)(callingPartyInfo);
|
|
1583
1662
|
case 1:
|
|
1584
|
-
displayInfo =
|
|
1663
|
+
displayInfo = _context19.sent;
|
|
1585
1664
|
expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
|
|
1586
1665
|
displayName: 'Name'
|
|
1587
1666
|
}));
|
|
@@ -1591,9 +1670,9 @@ describe('resolveContact tests', function () {
|
|
|
1591
1670
|
peopleListResponse.items[0].phoneNumbers = phoneNumbers;
|
|
1592
1671
|
case 2:
|
|
1593
1672
|
case "end":
|
|
1594
|
-
return
|
|
1673
|
+
return _context19.stop();
|
|
1595
1674
|
}
|
|
1596
|
-
},
|
|
1675
|
+
}, _callee19);
|
|
1597
1676
|
})));
|
|
1598
1677
|
});
|
|
1599
1678
|
describe('Store and Fetch voicemail tests', function () {
|
|
@@ -1711,40 +1790,40 @@ describe('Infer id from UUID Tests', function () {
|
|
|
1711
1790
|
});
|
|
1712
1791
|
});
|
|
1713
1792
|
describe('Get endpoint by CALLING_BACKEND tests', function () {
|
|
1714
|
-
it('verify invalid calling backend ucm for xsi endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1793
|
+
it('verify invalid calling backend ucm for xsi endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
1715
1794
|
var _t;
|
|
1716
|
-
return _regenerator.default.wrap(function (
|
|
1717
|
-
while (1) switch (
|
|
1795
|
+
return _regenerator.default.wrap(function (_context20) {
|
|
1796
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1718
1797
|
case 0:
|
|
1719
1798
|
_t = expect;
|
|
1720
|
-
|
|
1799
|
+
_context20.next = 1;
|
|
1721
1800
|
return (0, _Utils.getXsiActionEndpoint)(webex, {
|
|
1722
1801
|
file: 'testFile',
|
|
1723
1802
|
method: 'testMethod'
|
|
1724
1803
|
}, _types.CALLING_BACKEND.UCM);
|
|
1725
1804
|
case 1:
|
|
1726
|
-
_t(
|
|
1805
|
+
_t(_context20.sent).toBeInstanceOf(Error);
|
|
1727
1806
|
case 2:
|
|
1728
1807
|
case "end":
|
|
1729
|
-
return
|
|
1808
|
+
return _context20.stop();
|
|
1730
1809
|
}
|
|
1731
|
-
},
|
|
1810
|
+
}, _callee20);
|
|
1732
1811
|
})));
|
|
1733
|
-
it('verify invalid calling backend wxc for vg endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1812
|
+
it('verify invalid calling backend wxc for vg endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
1734
1813
|
var _t2;
|
|
1735
|
-
return _regenerator.default.wrap(function (
|
|
1736
|
-
while (1) switch (
|
|
1814
|
+
return _regenerator.default.wrap(function (_context21) {
|
|
1815
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1737
1816
|
case 0:
|
|
1738
1817
|
_t2 = expect;
|
|
1739
|
-
|
|
1818
|
+
_context21.next = 1;
|
|
1740
1819
|
return (0, _Utils.getVgActionEndpoint)(webex, _types.CALLING_BACKEND.WXC);
|
|
1741
1820
|
case 1:
|
|
1742
|
-
_t2(
|
|
1821
|
+
_t2(_context21.sent).toBeInstanceOf(Error);
|
|
1743
1822
|
case 2:
|
|
1744
1823
|
case "end":
|
|
1745
|
-
return
|
|
1824
|
+
return _context21.stop();
|
|
1746
1825
|
}
|
|
1747
|
-
},
|
|
1826
|
+
}, _callee21);
|
|
1748
1827
|
})));
|
|
1749
1828
|
});
|
|
1750
1829
|
describe('Get XSI Action Endpoint tests', function () {
|
|
@@ -1766,10 +1845,10 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1766
1845
|
beforeEach(function () {
|
|
1767
1846
|
mockWebex.request.mockClear();
|
|
1768
1847
|
});
|
|
1769
|
-
it('should return xsiEndpoint for WXC backend using _serviceUrls.hydra', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1848
|
+
it('should return xsiEndpoint for WXC backend using _serviceUrls.hydra', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
1770
1849
|
var hydraEndpoint, wxcWebex, result;
|
|
1771
|
-
return _regenerator.default.wrap(function (
|
|
1772
|
-
while (1) switch (
|
|
1850
|
+
return _regenerator.default.wrap(function (_context22) {
|
|
1851
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1773
1852
|
case 0:
|
|
1774
1853
|
hydraEndpoint = 'https://hydra-a.wbx2.com/v1/';
|
|
1775
1854
|
wxcWebex = {
|
|
@@ -1789,10 +1868,10 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1789
1868
|
}
|
|
1790
1869
|
}
|
|
1791
1870
|
};
|
|
1792
|
-
|
|
1871
|
+
_context22.next = 1;
|
|
1793
1872
|
return (0, _Utils.getXsiActionEndpoint)(wxcWebex, loggerContext, _types.CALLING_BACKEND.WXC);
|
|
1794
1873
|
case 1:
|
|
1795
|
-
result =
|
|
1874
|
+
result = _context22.sent;
|
|
1796
1875
|
expect(wxcWebex.request).toBeCalledOnceWith({
|
|
1797
1876
|
method: _types.HTTP_METHODS.GET,
|
|
1798
1877
|
uri: "".concat(hydraEndpoint, "/").concat(_constants2.XSI_ACTION_ENDPOINT_ORG_URL_PARAM)
|
|
@@ -1801,14 +1880,14 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1801
1880
|
expect(wxcWebex.internal.services.get).not.toHaveBeenCalled();
|
|
1802
1881
|
case 2:
|
|
1803
1882
|
case "end":
|
|
1804
|
-
return
|
|
1883
|
+
return _context22.stop();
|
|
1805
1884
|
}
|
|
1806
|
-
},
|
|
1885
|
+
}, _callee22);
|
|
1807
1886
|
})));
|
|
1808
|
-
it('should return xsiEndpoint for WXC backend using services.get when _serviceUrls is undefined', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1887
|
+
it('should return xsiEndpoint for WXC backend using services.get when _serviceUrls is undefined', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
1809
1888
|
var hydraEndpoint, activeHydraCluster, wxcWebex, result;
|
|
1810
|
-
return _regenerator.default.wrap(function (
|
|
1811
|
-
while (1) switch (
|
|
1889
|
+
return _regenerator.default.wrap(function (_context23) {
|
|
1890
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1812
1891
|
case 0:
|
|
1813
1892
|
hydraEndpoint = 'https://hydra-a.wbx2.com/v1/';
|
|
1814
1893
|
activeHydraCluster = 'urn:TEAM:us-east-2_a:hydra';
|
|
@@ -1827,10 +1906,10 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1827
1906
|
}
|
|
1828
1907
|
}
|
|
1829
1908
|
};
|
|
1830
|
-
|
|
1909
|
+
_context23.next = 1;
|
|
1831
1910
|
return (0, _Utils.getXsiActionEndpoint)(wxcWebex, loggerContext, _types.CALLING_BACKEND.WXC);
|
|
1832
1911
|
case 1:
|
|
1833
|
-
result =
|
|
1912
|
+
result = _context23.sent;
|
|
1834
1913
|
expect(wxcWebex.internal.services.get).toBeCalledOnceWith(activeHydraCluster);
|
|
1835
1914
|
expect(wxcWebex.request).toBeCalledOnceWith({
|
|
1836
1915
|
method: _types.HTTP_METHODS.GET,
|
|
@@ -1839,14 +1918,14 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1839
1918
|
expect(result).toBe(expectedXsiEndpoint);
|
|
1840
1919
|
case 2:
|
|
1841
1920
|
case "end":
|
|
1842
|
-
return
|
|
1921
|
+
return _context23.stop();
|
|
1843
1922
|
}
|
|
1844
|
-
},
|
|
1923
|
+
}, _callee23);
|
|
1845
1924
|
})));
|
|
1846
|
-
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1925
|
+
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
1847
1926
|
var mockResponse, xsiEndpoint;
|
|
1848
|
-
return _regenerator.default.wrap(function (
|
|
1849
|
-
while (1) switch (
|
|
1927
|
+
return _regenerator.default.wrap(function (_context24) {
|
|
1928
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1850
1929
|
case 0:
|
|
1851
1930
|
mockResponse = {
|
|
1852
1931
|
body: {
|
|
@@ -1858,22 +1937,22 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1858
1937
|
}
|
|
1859
1938
|
};
|
|
1860
1939
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1861
|
-
|
|
1940
|
+
_context24.next = 1;
|
|
1862
1941
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1863
1942
|
case 1:
|
|
1864
|
-
xsiEndpoint =
|
|
1943
|
+
xsiEndpoint = _context24.sent;
|
|
1865
1944
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1866
1945
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1867
1946
|
case 2:
|
|
1868
1947
|
case "end":
|
|
1869
|
-
return
|
|
1948
|
+
return _context24.stop();
|
|
1870
1949
|
}
|
|
1871
|
-
},
|
|
1950
|
+
}, _callee24);
|
|
1872
1951
|
})));
|
|
1873
|
-
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1952
|
+
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
1874
1953
|
var mockResponse, xsiEndpoint;
|
|
1875
|
-
return _regenerator.default.wrap(function (
|
|
1876
|
-
while (1) switch (
|
|
1954
|
+
return _regenerator.default.wrap(function (_context25) {
|
|
1955
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1877
1956
|
case 0:
|
|
1878
1957
|
mockResponse = {
|
|
1879
1958
|
body: {
|
|
@@ -1885,22 +1964,22 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1885
1964
|
}
|
|
1886
1965
|
};
|
|
1887
1966
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1888
|
-
|
|
1967
|
+
_context25.next = 1;
|
|
1889
1968
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1890
1969
|
case 1:
|
|
1891
|
-
xsiEndpoint =
|
|
1970
|
+
xsiEndpoint = _context25.sent;
|
|
1892
1971
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1893
1972
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1894
1973
|
case 2:
|
|
1895
1974
|
case "end":
|
|
1896
|
-
return
|
|
1975
|
+
return _context25.stop();
|
|
1897
1976
|
}
|
|
1898
|
-
},
|
|
1977
|
+
}, _callee25);
|
|
1899
1978
|
})));
|
|
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
|
|
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 _callee26() {
|
|
1901
1980
|
var mockResponse, xsiEndpoint;
|
|
1902
|
-
return _regenerator.default.wrap(function (
|
|
1903
|
-
while (1) switch (
|
|
1981
|
+
return _regenerator.default.wrap(function (_context26) {
|
|
1982
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1904
1983
|
case 0:
|
|
1905
1984
|
mockResponse = {
|
|
1906
1985
|
body: {
|
|
@@ -1912,17 +1991,17 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1912
1991
|
}
|
|
1913
1992
|
};
|
|
1914
1993
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1915
|
-
|
|
1994
|
+
_context26.next = 1;
|
|
1916
1995
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1917
1996
|
case 1:
|
|
1918
|
-
xsiEndpoint =
|
|
1997
|
+
xsiEndpoint = _context26.sent;
|
|
1919
1998
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1920
1999
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1921
2000
|
case 2:
|
|
1922
2001
|
case "end":
|
|
1923
|
-
return
|
|
2002
|
+
return _context26.stop();
|
|
1924
2003
|
}
|
|
1925
|
-
},
|
|
2004
|
+
}, _callee26);
|
|
1926
2005
|
})));
|
|
1927
2006
|
});
|
|
1928
2007
|
describe('uploadLogs', function () {
|
|
@@ -1944,19 +2023,19 @@ describe('uploadLogs', function () {
|
|
|
1944
2023
|
afterEach(function () {
|
|
1945
2024
|
jest.clearAllMocks();
|
|
1946
2025
|
});
|
|
1947
|
-
it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2026
|
+
it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
|
|
1948
2027
|
var mockMetaData, logSpy, result;
|
|
1949
|
-
return _regenerator.default.wrap(function (
|
|
1950
|
-
while (1) switch (
|
|
2028
|
+
return _regenerator.default.wrap(function (_context27) {
|
|
2029
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1951
2030
|
case 0:
|
|
1952
2031
|
mockMetaData = {
|
|
1953
2032
|
correlationId: 'test-correlation'
|
|
1954
2033
|
};
|
|
1955
2034
|
logSpy = jest.spyOn(_Logger.default, 'info');
|
|
1956
|
-
|
|
2035
|
+
_context27.next = 1;
|
|
1957
2036
|
return (0, _Utils.uploadLogs)(mockMetaData, true);
|
|
1958
2037
|
case 1:
|
|
1959
|
-
result =
|
|
2038
|
+
result = _context27.sent;
|
|
1960
2039
|
expect(result).toEqual({
|
|
1961
2040
|
trackingid: '1234',
|
|
1962
2041
|
feedbackId: 'mocked-uuid-12345'
|
|
@@ -1989,14 +2068,14 @@ describe('uploadLogs', function () {
|
|
|
1989
2068
|
});
|
|
1990
2069
|
case 2:
|
|
1991
2070
|
case "end":
|
|
1992
|
-
return
|
|
2071
|
+
return _context27.stop();
|
|
1993
2072
|
}
|
|
1994
|
-
},
|
|
2073
|
+
}, _callee27);
|
|
1995
2074
|
})));
|
|
1996
|
-
it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2075
|
+
it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
|
|
1997
2076
|
var mockMetaData, mockError, logSpy, _t3;
|
|
1998
|
-
return _regenerator.default.wrap(function (
|
|
1999
|
-
while (1) switch (
|
|
2077
|
+
return _regenerator.default.wrap(function (_context28) {
|
|
2078
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2000
2079
|
case 0:
|
|
2001
2080
|
mockMetaData = {
|
|
2002
2081
|
correlationId: 'test-correlation'
|
|
@@ -2004,17 +2083,17 @@ describe('uploadLogs', function () {
|
|
|
2004
2083
|
mockError = new Error('Upload failed'); // Mock the submitLogs to fail
|
|
2005
2084
|
submitLogsMock.mockRejectedValueOnce(mockError);
|
|
2006
2085
|
logSpy = jest.spyOn(_Logger.default, 'error');
|
|
2007
|
-
|
|
2008
|
-
|
|
2086
|
+
_context28.prev = 1;
|
|
2087
|
+
_context28.next = 2;
|
|
2009
2088
|
return (0, _Utils.uploadLogs)(mockMetaData, true);
|
|
2010
2089
|
case 2:
|
|
2011
2090
|
// If we get here, the test should fail since we expected an exception
|
|
2012
2091
|
expect(true).toBe(false); // This will fail the test if no exception is thrown
|
|
2013
|
-
|
|
2092
|
+
_context28.next = 4;
|
|
2014
2093
|
break;
|
|
2015
2094
|
case 3:
|
|
2016
|
-
|
|
2017
|
-
_t3 =
|
|
2095
|
+
_context28.prev = 3;
|
|
2096
|
+
_t3 = _context28["catch"](1);
|
|
2018
2097
|
expect(_t3).toBe(mockError);
|
|
2019
2098
|
expect(logSpy).toHaveBeenCalledWith("Failed to upload Logs ".concat((0, _stringify.default)(_t3)), {
|
|
2020
2099
|
file: _constants.UTILS_FILE,
|
|
@@ -2041,14 +2120,14 @@ describe('uploadLogs', function () {
|
|
|
2041
2120
|
});
|
|
2042
2121
|
case 4:
|
|
2043
2122
|
case "end":
|
|
2044
|
-
return
|
|
2123
|
+
return _context28.stop();
|
|
2045
2124
|
}
|
|
2046
|
-
},
|
|
2125
|
+
}, _callee28, null, [[1, 3]]);
|
|
2047
2126
|
})));
|
|
2048
|
-
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
|
|
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 _callee29() {
|
|
2049
2128
|
var mockMetaData, mockError, logSpy, result;
|
|
2050
|
-
return _regenerator.default.wrap(function (
|
|
2051
|
-
while (1) switch (
|
|
2129
|
+
return _regenerator.default.wrap(function (_context29) {
|
|
2130
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2052
2131
|
case 0:
|
|
2053
2132
|
mockMetaData = {
|
|
2054
2133
|
correlationId: 'test-correlation',
|
|
@@ -2057,10 +2136,10 @@ describe('uploadLogs', function () {
|
|
|
2057
2136
|
mockError = new Error('Upload failed'); // Mock the submitLogs to fail
|
|
2058
2137
|
submitLogsMock.mockRejectedValueOnce(mockError);
|
|
2059
2138
|
logSpy = jest.spyOn(_Logger.default, 'error');
|
|
2060
|
-
|
|
2139
|
+
_context29.next = 1;
|
|
2061
2140
|
return (0, _Utils.uploadLogs)(mockMetaData, false);
|
|
2062
2141
|
case 1:
|
|
2063
|
-
result =
|
|
2142
|
+
result = _context29.sent;
|
|
2064
2143
|
expect(result).toBeUndefined();
|
|
2065
2144
|
expect(logSpy).toHaveBeenCalledWith("Failed to upload Logs ".concat((0, _stringify.default)(mockError)), {
|
|
2066
2145
|
file: _constants.UTILS_FILE,
|
|
@@ -2087,9 +2166,9 @@ describe('uploadLogs', function () {
|
|
|
2087
2166
|
});
|
|
2088
2167
|
case 2:
|
|
2089
2168
|
case "end":
|
|
2090
|
-
return
|
|
2169
|
+
return _context29.stop();
|
|
2091
2170
|
}
|
|
2092
|
-
},
|
|
2171
|
+
}, _callee29);
|
|
2093
2172
|
})));
|
|
2094
2173
|
});
|
|
2095
2174
|
describe('resolveCallingBackend', function () {
|