@webex/calling 3.12.0-next.63 → 3.12.0-next.65
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.
|
@@ -23,6 +23,7 @@ var _types2 = require("../Errors/types");
|
|
|
23
23
|
var _Utils = require("./Utils");
|
|
24
24
|
var _voicemailFixture = require("../Voicemail/voicemailFixture");
|
|
25
25
|
var _constants2 = require("./constants");
|
|
26
|
+
var _testFixtures = require("../CallSettings/testFixtures");
|
|
26
27
|
var _types3 = require("../Events/types");
|
|
27
28
|
var _SDKConnector = _interopRequireDefault(require("../SDKConnector"));
|
|
28
29
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -1689,10 +1690,91 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1689
1690
|
file: 'testFile',
|
|
1690
1691
|
method: 'testMethod'
|
|
1691
1692
|
};
|
|
1692
|
-
|
|
1693
|
-
|
|
1693
|
+
var expectedXsiEndpoint = 'https://api-proxy-si.broadcloudpbx.net/com.broadsoft.xsi-actions';
|
|
1694
|
+
beforeEach(function () {
|
|
1695
|
+
mockWebex.request.mockClear();
|
|
1696
|
+
});
|
|
1697
|
+
it('should return xsiEndpoint for WXC backend using _serviceUrls.hydra', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
1698
|
+
var hydraEndpoint, wxcWebex, result;
|
|
1694
1699
|
return _regenerator.default.wrap(function (_context18) {
|
|
1695
1700
|
while (1) switch (_context18.prev = _context18.next) {
|
|
1701
|
+
case 0:
|
|
1702
|
+
hydraEndpoint = 'https://hydra-a.wbx2.com/v1/';
|
|
1703
|
+
wxcWebex = {
|
|
1704
|
+
request: jest.fn().mockResolvedValue({
|
|
1705
|
+
statusCode: 200,
|
|
1706
|
+
body: _testFixtures.xsiEndpointUrlResponse
|
|
1707
|
+
}),
|
|
1708
|
+
internal: {
|
|
1709
|
+
services: {
|
|
1710
|
+
_serviceUrls: {
|
|
1711
|
+
hydra: hydraEndpoint
|
|
1712
|
+
},
|
|
1713
|
+
_activeServices: {
|
|
1714
|
+
hydra: 'urn:TEAM:us-east-2_a:hydra'
|
|
1715
|
+
},
|
|
1716
|
+
get: jest.fn()
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
};
|
|
1720
|
+
_context18.next = 1;
|
|
1721
|
+
return (0, _Utils.getXsiActionEndpoint)(wxcWebex, loggerContext, _types.CALLING_BACKEND.WXC);
|
|
1722
|
+
case 1:
|
|
1723
|
+
result = _context18.sent;
|
|
1724
|
+
expect(wxcWebex.request).toBeCalledOnceWith({
|
|
1725
|
+
method: _types.HTTP_METHODS.GET,
|
|
1726
|
+
uri: "".concat(hydraEndpoint, "/").concat(_constants2.XSI_ACTION_ENDPOINT_ORG_URL_PARAM)
|
|
1727
|
+
});
|
|
1728
|
+
expect(result).toBe(expectedXsiEndpoint);
|
|
1729
|
+
expect(wxcWebex.internal.services.get).not.toHaveBeenCalled();
|
|
1730
|
+
case 2:
|
|
1731
|
+
case "end":
|
|
1732
|
+
return _context18.stop();
|
|
1733
|
+
}
|
|
1734
|
+
}, _callee18);
|
|
1735
|
+
})));
|
|
1736
|
+
it('should return xsiEndpoint for WXC backend using services.get when _serviceUrls is undefined', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
1737
|
+
var hydraEndpoint, activeHydraCluster, wxcWebex, result;
|
|
1738
|
+
return _regenerator.default.wrap(function (_context19) {
|
|
1739
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1740
|
+
case 0:
|
|
1741
|
+
hydraEndpoint = 'https://hydra-a.wbx2.com/v1/';
|
|
1742
|
+
activeHydraCluster = 'urn:TEAM:us-east-2_a:hydra';
|
|
1743
|
+
wxcWebex = {
|
|
1744
|
+
request: jest.fn().mockResolvedValue({
|
|
1745
|
+
statusCode: 200,
|
|
1746
|
+
body: _testFixtures.xsiEndpointUrlResponse
|
|
1747
|
+
}),
|
|
1748
|
+
internal: {
|
|
1749
|
+
services: {
|
|
1750
|
+
_serviceUrls: undefined,
|
|
1751
|
+
_activeServices: {
|
|
1752
|
+
hydra: activeHydraCluster
|
|
1753
|
+
},
|
|
1754
|
+
get: jest.fn().mockReturnValue(hydraEndpoint)
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
};
|
|
1758
|
+
_context19.next = 1;
|
|
1759
|
+
return (0, _Utils.getXsiActionEndpoint)(wxcWebex, loggerContext, _types.CALLING_BACKEND.WXC);
|
|
1760
|
+
case 1:
|
|
1761
|
+
result = _context19.sent;
|
|
1762
|
+
expect(wxcWebex.internal.services.get).toBeCalledOnceWith(activeHydraCluster);
|
|
1763
|
+
expect(wxcWebex.request).toBeCalledOnceWith({
|
|
1764
|
+
method: _types.HTTP_METHODS.GET,
|
|
1765
|
+
uri: "".concat(hydraEndpoint, "/").concat(_constants2.XSI_ACTION_ENDPOINT_ORG_URL_PARAM)
|
|
1766
|
+
});
|
|
1767
|
+
expect(result).toBe(expectedXsiEndpoint);
|
|
1768
|
+
case 2:
|
|
1769
|
+
case "end":
|
|
1770
|
+
return _context19.stop();
|
|
1771
|
+
}
|
|
1772
|
+
}, _callee19);
|
|
1773
|
+
})));
|
|
1774
|
+
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
1775
|
+
var mockResponse, xsiEndpoint;
|
|
1776
|
+
return _regenerator.default.wrap(function (_context20) {
|
|
1777
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1696
1778
|
case 0:
|
|
1697
1779
|
mockResponse = {
|
|
1698
1780
|
body: {
|
|
@@ -1704,22 +1786,22 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1704
1786
|
}
|
|
1705
1787
|
};
|
|
1706
1788
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1707
|
-
|
|
1789
|
+
_context20.next = 1;
|
|
1708
1790
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1709
1791
|
case 1:
|
|
1710
|
-
xsiEndpoint =
|
|
1792
|
+
xsiEndpoint = _context20.sent;
|
|
1711
1793
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1712
1794
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1713
1795
|
case 2:
|
|
1714
1796
|
case "end":
|
|
1715
|
-
return
|
|
1797
|
+
return _context20.stop();
|
|
1716
1798
|
}
|
|
1717
|
-
},
|
|
1799
|
+
}, _callee20);
|
|
1718
1800
|
})));
|
|
1719
|
-
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1801
|
+
it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
1720
1802
|
var mockResponse, xsiEndpoint;
|
|
1721
|
-
return _regenerator.default.wrap(function (
|
|
1722
|
-
while (1) switch (
|
|
1803
|
+
return _regenerator.default.wrap(function (_context21) {
|
|
1804
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1723
1805
|
case 0:
|
|
1724
1806
|
mockResponse = {
|
|
1725
1807
|
body: {
|
|
@@ -1731,22 +1813,22 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1731
1813
|
}
|
|
1732
1814
|
};
|
|
1733
1815
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1734
|
-
|
|
1816
|
+
_context21.next = 1;
|
|
1735
1817
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1736
1818
|
case 1:
|
|
1737
|
-
xsiEndpoint =
|
|
1819
|
+
xsiEndpoint = _context21.sent;
|
|
1738
1820
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1739
1821
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1740
1822
|
case 2:
|
|
1741
1823
|
case "end":
|
|
1742
|
-
return
|
|
1824
|
+
return _context21.stop();
|
|
1743
1825
|
}
|
|
1744
|
-
},
|
|
1826
|
+
}, _callee21);
|
|
1745
1827
|
})));
|
|
1746
|
-
it('should return xsiEndpoint for BWRKS backend when URL does not end with any version', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
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 _callee22() {
|
|
1747
1829
|
var mockResponse, xsiEndpoint;
|
|
1748
|
-
return _regenerator.default.wrap(function (
|
|
1749
|
-
while (1) switch (
|
|
1830
|
+
return _regenerator.default.wrap(function (_context22) {
|
|
1831
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1750
1832
|
case 0:
|
|
1751
1833
|
mockResponse = {
|
|
1752
1834
|
body: {
|
|
@@ -1758,17 +1840,17 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1758
1840
|
}
|
|
1759
1841
|
};
|
|
1760
1842
|
mockWebex.request.mockResolvedValue(mockResponse);
|
|
1761
|
-
|
|
1843
|
+
_context22.next = 1;
|
|
1762
1844
|
return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
|
|
1763
1845
|
case 1:
|
|
1764
|
-
xsiEndpoint =
|
|
1846
|
+
xsiEndpoint = _context22.sent;
|
|
1765
1847
|
expect(mockWebex.request).toHaveBeenCalledTimes(1);
|
|
1766
1848
|
expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
|
|
1767
1849
|
case 2:
|
|
1768
1850
|
case "end":
|
|
1769
|
-
return
|
|
1851
|
+
return _context22.stop();
|
|
1770
1852
|
}
|
|
1771
|
-
},
|
|
1853
|
+
}, _callee22);
|
|
1772
1854
|
})));
|
|
1773
1855
|
});
|
|
1774
1856
|
describe('modifySdpForIPv4', function () {
|
|
@@ -1838,19 +1920,19 @@ describe('uploadLogs', function () {
|
|
|
1838
1920
|
afterEach(function () {
|
|
1839
1921
|
jest.clearAllMocks();
|
|
1840
1922
|
});
|
|
1841
|
-
it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1923
|
+
it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
1842
1924
|
var mockMetaData, logSpy, result;
|
|
1843
|
-
return _regenerator.default.wrap(function (
|
|
1844
|
-
while (1) switch (
|
|
1925
|
+
return _regenerator.default.wrap(function (_context23) {
|
|
1926
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1845
1927
|
case 0:
|
|
1846
1928
|
mockMetaData = {
|
|
1847
1929
|
correlationId: 'test-correlation'
|
|
1848
1930
|
};
|
|
1849
1931
|
logSpy = jest.spyOn(_Logger.default, 'info');
|
|
1850
|
-
|
|
1932
|
+
_context23.next = 1;
|
|
1851
1933
|
return (0, _Utils.uploadLogs)(mockMetaData, true);
|
|
1852
1934
|
case 1:
|
|
1853
|
-
result =
|
|
1935
|
+
result = _context23.sent;
|
|
1854
1936
|
expect(result).toEqual({
|
|
1855
1937
|
trackingid: '1234',
|
|
1856
1938
|
feedbackId: 'mocked-uuid-12345'
|
|
@@ -1883,14 +1965,14 @@ describe('uploadLogs', function () {
|
|
|
1883
1965
|
});
|
|
1884
1966
|
case 2:
|
|
1885
1967
|
case "end":
|
|
1886
|
-
return
|
|
1968
|
+
return _context23.stop();
|
|
1887
1969
|
}
|
|
1888
|
-
},
|
|
1970
|
+
}, _callee23);
|
|
1889
1971
|
})));
|
|
1890
|
-
it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1972
|
+
it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
1891
1973
|
var mockMetaData, mockError, logSpy, _t3;
|
|
1892
|
-
return _regenerator.default.wrap(function (
|
|
1893
|
-
while (1) switch (
|
|
1974
|
+
return _regenerator.default.wrap(function (_context24) {
|
|
1975
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1894
1976
|
case 0:
|
|
1895
1977
|
mockMetaData = {
|
|
1896
1978
|
correlationId: 'test-correlation'
|
|
@@ -1898,17 +1980,17 @@ describe('uploadLogs', function () {
|
|
|
1898
1980
|
mockError = new Error('Upload failed'); // Mock the submitLogs to fail
|
|
1899
1981
|
submitLogsMock.mockRejectedValueOnce(mockError);
|
|
1900
1982
|
logSpy = jest.spyOn(_Logger.default, 'error');
|
|
1901
|
-
|
|
1902
|
-
|
|
1983
|
+
_context24.prev = 1;
|
|
1984
|
+
_context24.next = 2;
|
|
1903
1985
|
return (0, _Utils.uploadLogs)(mockMetaData, true);
|
|
1904
1986
|
case 2:
|
|
1905
1987
|
// If we get here, the test should fail since we expected an exception
|
|
1906
1988
|
expect(true).toBe(false); // This will fail the test if no exception is thrown
|
|
1907
|
-
|
|
1989
|
+
_context24.next = 4;
|
|
1908
1990
|
break;
|
|
1909
1991
|
case 3:
|
|
1910
|
-
|
|
1911
|
-
_t3 =
|
|
1992
|
+
_context24.prev = 3;
|
|
1993
|
+
_t3 = _context24["catch"](1);
|
|
1912
1994
|
expect(_t3).toBe(mockError);
|
|
1913
1995
|
expect(logSpy).toHaveBeenCalledWith("Failed to upload Logs ".concat((0, _stringify.default)(_t3)), {
|
|
1914
1996
|
file: _constants.UTILS_FILE,
|
|
@@ -1935,14 +2017,14 @@ describe('uploadLogs', function () {
|
|
|
1935
2017
|
});
|
|
1936
2018
|
case 4:
|
|
1937
2019
|
case "end":
|
|
1938
|
-
return
|
|
2020
|
+
return _context24.stop();
|
|
1939
2021
|
}
|
|
1940
|
-
},
|
|
2022
|
+
}, _callee24, null, [[1, 3]]);
|
|
1941
2023
|
})));
|
|
1942
|
-
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
|
|
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 _callee25() {
|
|
1943
2025
|
var mockMetaData, mockError, logSpy, result;
|
|
1944
|
-
return _regenerator.default.wrap(function (
|
|
1945
|
-
while (1) switch (
|
|
2026
|
+
return _regenerator.default.wrap(function (_context25) {
|
|
2027
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1946
2028
|
case 0:
|
|
1947
2029
|
mockMetaData = {
|
|
1948
2030
|
correlationId: 'test-correlation',
|
|
@@ -1951,10 +2033,10 @@ describe('uploadLogs', function () {
|
|
|
1951
2033
|
mockError = new Error('Upload failed'); // Mock the submitLogs to fail
|
|
1952
2034
|
submitLogsMock.mockRejectedValueOnce(mockError);
|
|
1953
2035
|
logSpy = jest.spyOn(_Logger.default, 'error');
|
|
1954
|
-
|
|
2036
|
+
_context25.next = 1;
|
|
1955
2037
|
return (0, _Utils.uploadLogs)(mockMetaData, false);
|
|
1956
2038
|
case 1:
|
|
1957
|
-
result =
|
|
2039
|
+
result = _context25.sent;
|
|
1958
2040
|
expect(result).toBeUndefined();
|
|
1959
2041
|
expect(logSpy).toHaveBeenCalledWith("Failed to upload Logs ".concat((0, _stringify.default)(mockError)), {
|
|
1960
2042
|
file: _constants.UTILS_FILE,
|
|
@@ -1981,9 +2063,9 @@ describe('uploadLogs', function () {
|
|
|
1981
2063
|
});
|
|
1982
2064
|
case 2:
|
|
1983
2065
|
case "end":
|
|
1984
|
-
return
|
|
2066
|
+
return _context25.stop();
|
|
1985
2067
|
}
|
|
1986
|
-
},
|
|
2068
|
+
}, _callee25);
|
|
1987
2069
|
})));
|
|
1988
2070
|
});
|
|
1989
2071
|
describe('resolveCallingBackend', function () {
|