@webex/calling 3.12.0-llmrefactor.1 → 3.12.0-llmrefactor.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CallingClient/constants.js +4 -2
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +4 -0
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +47 -10
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +466 -390
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +349 -80
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js +26 -0
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/Errors/types.js +2 -0
- package/dist/Errors/types.js.map +1 -1
- package/dist/Events/types.js.map +1 -1
- package/dist/common/Utils.js +85 -50
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +270 -195
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/module/CallingClient/constants.js +2 -0
- package/dist/module/CallingClient/line/index.js +2 -0
- package/dist/module/CallingClient/registration/register.js +36 -10
- package/dist/module/CallingClient/registration/types.js +5 -1
- package/dist/module/Errors/types.js +2 -0
- package/dist/module/common/Utils.js +26 -8
- package/dist/types/CallingClient/constants.d.ts +2 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +2 -1
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +23 -0
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/Errors/types.d.ts +2 -0
- package/dist/types/Errors/types.d.ts.map +1 -1
- package/dist/types/Events/types.d.ts +1 -1
- package/dist/types/Events/types.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +2 -5
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/package.json +10 -10
|
@@ -1905,21 +1905,289 @@ describe('Registration Tests', function () {
|
|
|
1905
1905
|
}
|
|
1906
1906
|
}, _callee38);
|
|
1907
1907
|
})));
|
|
1908
|
+
describe('409 Conflict on keepalive (session superseded)', function () {
|
|
1909
|
+
var conflictError = {
|
|
1910
|
+
statusCode: 409,
|
|
1911
|
+
headers: {
|
|
1912
|
+
trackingid: 'tid-409'
|
|
1913
|
+
}
|
|
1914
|
+
};
|
|
1915
|
+
var sendKeepaliveFailure = /*#__PURE__*/function () {
|
|
1916
|
+
var _ref40 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39(err, keepAliveRetryCount) {
|
|
1917
|
+
return _regenerator.default.wrap(function (_context39) {
|
|
1918
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
1919
|
+
case 0:
|
|
1920
|
+
reg.webWorker.onmessage({
|
|
1921
|
+
data: {
|
|
1922
|
+
type: _types.WorkerMessageType.KEEPALIVE_FAILURE,
|
|
1923
|
+
err: err,
|
|
1924
|
+
keepAliveRetryCount: keepAliveRetryCount
|
|
1925
|
+
}
|
|
1926
|
+
});
|
|
1927
|
+
_context39.next = 1;
|
|
1928
|
+
return flushPromises();
|
|
1929
|
+
case 1:
|
|
1930
|
+
case "end":
|
|
1931
|
+
return _context39.stop();
|
|
1932
|
+
}
|
|
1933
|
+
}, _callee39);
|
|
1934
|
+
}));
|
|
1935
|
+
return function sendKeepaliveFailure(_x2, _x3) {
|
|
1936
|
+
return _ref40.apply(this, arguments);
|
|
1937
|
+
};
|
|
1938
|
+
}();
|
|
1939
|
+
var getSupersededError = function getSupersededError() {
|
|
1940
|
+
var unregisteredCall = lineEmitter.mock.calls.find(function (_ref41) {
|
|
1941
|
+
var _ref42 = (0, _slicedToArray2.default)(_ref41, 1),
|
|
1942
|
+
event = _ref42[0];
|
|
1943
|
+
return event === _types4.LINE_EVENTS.UNREGISTERED;
|
|
1944
|
+
});
|
|
1945
|
+
return unregisteredCall === null || unregisteredCall === void 0 ? void 0 : unregisteredCall[2];
|
|
1946
|
+
};
|
|
1947
|
+
it.each([{
|
|
1948
|
+
description: 'on the very first keepalive failure',
|
|
1949
|
+
keepAliveRetryCount: 1
|
|
1950
|
+
}, {
|
|
1951
|
+
description: 'when the retry count already reached the threshold',
|
|
1952
|
+
keepAliveRetryCount: 5
|
|
1953
|
+
}])('stops keepalive without re-registration $description', /*#__PURE__*/function () {
|
|
1954
|
+
var _ref44 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40(_ref43) {
|
|
1955
|
+
var keepAliveRetryCount, clearTimerSpy, reconnectSpy, registerSpy, handle404Spy;
|
|
1956
|
+
return _regenerator.default.wrap(function (_context40) {
|
|
1957
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
1958
|
+
case 0:
|
|
1959
|
+
keepAliveRetryCount = _ref43.keepAliveRetryCount;
|
|
1960
|
+
_context40.next = 1;
|
|
1961
|
+
return beforeEachSetupForKeepalive();
|
|
1962
|
+
case 1:
|
|
1963
|
+
clearTimerSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
1964
|
+
reconnectSpy = jest.spyOn(reg, 'reconnectOnFailure');
|
|
1965
|
+
registerSpy = jest.spyOn(reg, 'attemptRegistrationWithServers');
|
|
1966
|
+
handle404Spy = jest.spyOn(reg, 'handle404KeepaliveFailure');
|
|
1967
|
+
lineEmitter.mockClear();
|
|
1968
|
+
_context40.next = 2;
|
|
1969
|
+
return sendKeepaliveFailure(conflictError, keepAliveRetryCount);
|
|
1970
|
+
case 2:
|
|
1971
|
+
// The 409 is classified by the common registration error handler.
|
|
1972
|
+
expect(handleErrorSpy).toHaveBeenCalledWith(conflictError, expect.anything(), {
|
|
1973
|
+
file: _constants.REGISTRATION_FILE,
|
|
1974
|
+
method: _constants.KEEPALIVE_UTIL
|
|
1975
|
+
}, expect.objectContaining({
|
|
1976
|
+
sessionSupersededCb: expect.any(Function)
|
|
1977
|
+
}));
|
|
1978
|
+
expect(warnSpy).toBeCalledWith('409 Conflict: session superseded by another device for this user', {
|
|
1979
|
+
file: _constants.REGISTRATION_FILE,
|
|
1980
|
+
method: _constants.KEEPALIVE_UTIL
|
|
1981
|
+
});
|
|
1982
|
+
expect(warnSpy).toBeCalledWith("Stopping keepalive without re-registration, session superseded by another device for this user - keepaliveRetryCount: ".concat(keepAliveRetryCount), {
|
|
1983
|
+
file: _constants.REGISTRATION_FILE,
|
|
1984
|
+
method: _constants.METHODS.HANDLE_409_KEEPALIVE_FAILURE
|
|
1985
|
+
});
|
|
1986
|
+
|
|
1987
|
+
// Keepalive is stopped and no further keepalive can be sent.
|
|
1988
|
+
expect(clearTimerSpy).toHaveBeenCalled();
|
|
1989
|
+
expect(reg.webWorker).toBeUndefined();
|
|
1990
|
+
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.INACTIVE);
|
|
1991
|
+
expect(reg.failbackTimer).toStrictEqual(undefined);
|
|
1992
|
+
|
|
1993
|
+
// No re-registration of any kind is attempted.
|
|
1994
|
+
expect(reconnectSpy).not.toHaveBeenCalled();
|
|
1995
|
+
expect(restoreSpy).not.toHaveBeenCalled();
|
|
1996
|
+
expect(restartSpy).not.toHaveBeenCalled();
|
|
1997
|
+
expect(failoverSpy).not.toHaveBeenCalled();
|
|
1998
|
+
expect(registerSpy).not.toHaveBeenCalled();
|
|
1999
|
+
expect(handle404Spy).not.toHaveBeenCalled();
|
|
2000
|
+
expect(reg.reconnectPending).toStrictEqual(false);
|
|
2001
|
+
case 3:
|
|
2002
|
+
case "end":
|
|
2003
|
+
return _context40.stop();
|
|
2004
|
+
}
|
|
2005
|
+
}, _callee40);
|
|
2006
|
+
}));
|
|
2007
|
+
return function (_x4) {
|
|
2008
|
+
return _ref44.apply(this, arguments);
|
|
2009
|
+
};
|
|
2010
|
+
}());
|
|
2011
|
+
it('notifies the consumer with a single UNREGISTERED carrying the superseded reason', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
|
|
2012
|
+
var supersededError;
|
|
2013
|
+
return _regenerator.default.wrap(function (_context41) {
|
|
2014
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
2015
|
+
case 0:
|
|
2016
|
+
_context41.next = 1;
|
|
2017
|
+
return beforeEachSetupForKeepalive();
|
|
2018
|
+
case 1:
|
|
2019
|
+
lineEmitter.mockClear();
|
|
2020
|
+
_context41.next = 2;
|
|
2021
|
+
return sendKeepaliveFailure(conflictError, 1);
|
|
2022
|
+
case 2:
|
|
2023
|
+
expect(lineEmitter.mock.calls.filter(function (_ref46) {
|
|
2024
|
+
var _ref47 = (0, _slicedToArray2.default)(_ref46, 1),
|
|
2025
|
+
event = _ref47[0];
|
|
2026
|
+
return event === _types4.LINE_EVENTS.UNREGISTERED;
|
|
2027
|
+
})).toHaveLength(1);
|
|
2028
|
+
expect(lineEmitter).not.toHaveBeenCalledWith(_types4.LINE_EVENTS.RECONNECTING);
|
|
2029
|
+
expect(lineEmitter).toHaveBeenLastCalledWith(_types4.LINE_EVENTS.UNREGISTERED, undefined, expect.any(_LineError.LineError));
|
|
2030
|
+
supersededError = getSupersededError();
|
|
2031
|
+
expect(supersededError.getError()).toStrictEqual({
|
|
2032
|
+
message: _constants.SESSION_SUPERSEDED_MESSAGE,
|
|
2033
|
+
type: _types3.ERROR_TYPE.SESSION_SUPERSEDED,
|
|
2034
|
+
status: _types.RegistrationStatus.INACTIVE,
|
|
2035
|
+
context: {
|
|
2036
|
+
file: _constants.REGISTRATION_FILE,
|
|
2037
|
+
method: _constants.KEEPALIVE_UTIL
|
|
2038
|
+
}
|
|
2039
|
+
});
|
|
2040
|
+
case 3:
|
|
2041
|
+
case "end":
|
|
2042
|
+
return _context41.stop();
|
|
2043
|
+
}
|
|
2044
|
+
}, _callee41);
|
|
2045
|
+
})));
|
|
2046
|
+
it('submits the keepalive failure metric and uploads logs', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42() {
|
|
2047
|
+
var uploadLogsSpy;
|
|
2048
|
+
return _regenerator.default.wrap(function (_context42) {
|
|
2049
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
2050
|
+
case 0:
|
|
2051
|
+
_context42.next = 1;
|
|
2052
|
+
return beforeEachSetupForKeepalive();
|
|
2053
|
+
case 1:
|
|
2054
|
+
uploadLogsSpy = jest.spyOn(utils, 'uploadLogs');
|
|
2055
|
+
lineEmitter.mockClear();
|
|
2056
|
+
metricSpy.mockClear();
|
|
2057
|
+
_context42.next = 2;
|
|
2058
|
+
return sendKeepaliveFailure(conflictError, 2);
|
|
2059
|
+
case 2:
|
|
2060
|
+
expect(metricSpy).toBeCalledOnceWith(_types5.METRIC_EVENT.KEEPALIVE_ERROR, _types5.REG_ACTION.KEEPALIVE_FAILURE, _types5.METRIC_TYPE.BEHAVIORAL, _constants.METHODS.HANDLE_409_KEEPALIVE_FAILURE, 'PRIMARY', conflictError.headers.trackingid, 2, getSupersededError());
|
|
2061
|
+
expect(uploadLogsSpy).toHaveBeenCalled();
|
|
2062
|
+
case 3:
|
|
2063
|
+
case "end":
|
|
2064
|
+
return _context42.stop();
|
|
2065
|
+
}
|
|
2066
|
+
}, _callee42);
|
|
2067
|
+
})));
|
|
2068
|
+
it('closes the Mobius WebSocket when the socket transport is enabled', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee43() {
|
|
2069
|
+
var apiRequest, disconnectSocketSpy;
|
|
2070
|
+
return _regenerator.default.wrap(function (_context43) {
|
|
2071
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
2072
|
+
case 0:
|
|
2073
|
+
_context43.next = 1;
|
|
2074
|
+
return beforeEachSetupForKeepalive();
|
|
2075
|
+
case 1:
|
|
2076
|
+
apiRequest = _request.APIRequest.getInstance({
|
|
2077
|
+
webex: webex
|
|
2078
|
+
});
|
|
2079
|
+
jest.spyOn(apiRequest, 'isSocketEnabled').mockReturnValue(true);
|
|
2080
|
+
disconnectSocketSpy = jest.spyOn(apiRequest, 'disconnectFromMobiusSocket').mockResolvedValue();
|
|
2081
|
+
lineEmitter.mockClear();
|
|
2082
|
+
_context43.next = 2;
|
|
2083
|
+
return sendKeepaliveFailure(conflictError, 1);
|
|
2084
|
+
case 2:
|
|
2085
|
+
expect(disconnectSocketSpy).toBeCalledOnceWith({
|
|
2086
|
+
code: 3050,
|
|
2087
|
+
reason: 'done (permanent)'
|
|
2088
|
+
});
|
|
2089
|
+
expect(lineEmitter).toHaveBeenLastCalledWith(_types4.LINE_EVENTS.UNREGISTERED, undefined, expect.any(_LineError.LineError));
|
|
2090
|
+
case 3:
|
|
2091
|
+
case "end":
|
|
2092
|
+
return _context43.stop();
|
|
2093
|
+
}
|
|
2094
|
+
}, _callee43);
|
|
2095
|
+
})));
|
|
2096
|
+
it('still notifies the consumer when the Mobius WebSocket teardown fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee44() {
|
|
2097
|
+
var apiRequest;
|
|
2098
|
+
return _regenerator.default.wrap(function (_context44) {
|
|
2099
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
2100
|
+
case 0:
|
|
2101
|
+
_context44.next = 1;
|
|
2102
|
+
return beforeEachSetupForKeepalive();
|
|
2103
|
+
case 1:
|
|
2104
|
+
apiRequest = _request.APIRequest.getInstance({
|
|
2105
|
+
webex: webex
|
|
2106
|
+
});
|
|
2107
|
+
jest.spyOn(apiRequest, 'isSocketEnabled').mockReturnValue(true);
|
|
2108
|
+
jest.spyOn(apiRequest, 'disconnectFromMobiusSocket').mockRejectedValue(new Error('socket teardown failed'));
|
|
2109
|
+
lineEmitter.mockClear();
|
|
2110
|
+
_context44.next = 2;
|
|
2111
|
+
return sendKeepaliveFailure(conflictError, 1);
|
|
2112
|
+
case 2:
|
|
2113
|
+
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Mobius socket disconnect failed after session-superseded'), {
|
|
2114
|
+
file: _constants.REGISTRATION_FILE,
|
|
2115
|
+
method: _constants.METHODS.HANDLE_409_KEEPALIVE_FAILURE
|
|
2116
|
+
});
|
|
2117
|
+
expect(reg.getStatus()).toEqual(_types.RegistrationStatus.INACTIVE);
|
|
2118
|
+
expect(lineEmitter).toHaveBeenLastCalledWith(_types4.LINE_EVENTS.UNREGISTERED, undefined, expect.any(_LineError.LineError));
|
|
2119
|
+
case 3:
|
|
2120
|
+
case "end":
|
|
2121
|
+
return _context44.stop();
|
|
2122
|
+
}
|
|
2123
|
+
}, _callee44);
|
|
2124
|
+
})));
|
|
2125
|
+
it.each([{
|
|
2126
|
+
description: '404 device not found',
|
|
2127
|
+
err: {
|
|
2128
|
+
statusCode: 404
|
|
2129
|
+
}
|
|
2130
|
+
}, {
|
|
2131
|
+
description: '429 too many requests',
|
|
2132
|
+
err: {
|
|
2133
|
+
statusCode: 429,
|
|
2134
|
+
headers: {
|
|
2135
|
+
'retry-after': 5
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
}, {
|
|
2139
|
+
description: '503 service unavailable',
|
|
2140
|
+
err: {
|
|
2141
|
+
statusCode: 503
|
|
2142
|
+
}
|
|
2143
|
+
}])('leaves the existing handling of $description untouched', /*#__PURE__*/function () {
|
|
2144
|
+
var _ref52 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee45(_ref51) {
|
|
2145
|
+
var err, handle409Spy;
|
|
2146
|
+
return _regenerator.default.wrap(function (_context45) {
|
|
2147
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
2148
|
+
case 0:
|
|
2149
|
+
err = _ref51.err;
|
|
2150
|
+
_context45.next = 1;
|
|
2151
|
+
return beforeEachSetupForKeepalive();
|
|
2152
|
+
case 1:
|
|
2153
|
+
handle409Spy = jest.spyOn(reg, 'handle409KeepaliveFailure');
|
|
2154
|
+
lineEmitter.mockClear();
|
|
2155
|
+
handleErrorSpy.mockClear();
|
|
2156
|
+
_context45.next = 2;
|
|
2157
|
+
return sendKeepaliveFailure(err, 1);
|
|
2158
|
+
case 2:
|
|
2159
|
+
expect(handle409Spy).not.toHaveBeenCalled();
|
|
2160
|
+
expect(handleErrorSpy).toHaveBeenCalledWith(err, expect.anything(), {
|
|
2161
|
+
file: _constants.REGISTRATION_FILE,
|
|
2162
|
+
method: _constants.KEEPALIVE_UTIL
|
|
2163
|
+
}, expect.anything());
|
|
2164
|
+
expect(lineEmitter).not.toHaveBeenCalledWith(_types4.LINE_EVENTS.UNREGISTERED, undefined, expect.anything());
|
|
2165
|
+
case 3:
|
|
2166
|
+
case "end":
|
|
2167
|
+
return _context45.stop();
|
|
2168
|
+
}
|
|
2169
|
+
}, _callee45);
|
|
2170
|
+
}));
|
|
2171
|
+
return function (_x5) {
|
|
2172
|
+
return _ref52.apply(this, arguments);
|
|
2173
|
+
};
|
|
2174
|
+
}());
|
|
2175
|
+
});
|
|
1908
2176
|
});
|
|
1909
2177
|
describe('Primary server status checks', function () {
|
|
1910
|
-
it('success: primary server status to be up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2178
|
+
it('success: primary server status to be up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46() {
|
|
1911
2179
|
var pingSuccessPayload, status;
|
|
1912
|
-
return _regenerator.default.wrap(function (
|
|
1913
|
-
while (1) switch (
|
|
2180
|
+
return _regenerator.default.wrap(function (_context46) {
|
|
2181
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
1914
2182
|
case 0:
|
|
1915
2183
|
pingSuccessPayload = {
|
|
1916
2184
|
statusCode: 200
|
|
1917
2185
|
};
|
|
1918
2186
|
webex.request.mockResolvedValue(pingSuccessPayload);
|
|
1919
|
-
|
|
2187
|
+
_context46.next = 1;
|
|
1920
2188
|
return reg.isPrimaryActive();
|
|
1921
2189
|
case 1:
|
|
1922
|
-
status =
|
|
2190
|
+
status = _context46.sent;
|
|
1923
2191
|
expect(webex.request).toBeCalledWith(_objectSpread({
|
|
1924
2192
|
method: 'GET',
|
|
1925
2193
|
uri: "https://mobius-dfw.webex.com/api/v1/ping"
|
|
@@ -1927,23 +2195,23 @@ describe('Registration Tests', function () {
|
|
|
1927
2195
|
expect(status).toEqual(true);
|
|
1928
2196
|
case 2:
|
|
1929
2197
|
case "end":
|
|
1930
|
-
return
|
|
2198
|
+
return _context46.stop();
|
|
1931
2199
|
}
|
|
1932
|
-
},
|
|
2200
|
+
}, _callee46);
|
|
1933
2201
|
})));
|
|
1934
|
-
it('failed: primary server status to be down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2202
|
+
it('failed: primary server status to be down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47() {
|
|
1935
2203
|
var pingFailurePayload, status;
|
|
1936
|
-
return _regenerator.default.wrap(function (
|
|
1937
|
-
while (1) switch (
|
|
2204
|
+
return _regenerator.default.wrap(function (_context47) {
|
|
2205
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
1938
2206
|
case 0:
|
|
1939
2207
|
pingFailurePayload = {
|
|
1940
2208
|
statusCode: 500
|
|
1941
2209
|
};
|
|
1942
2210
|
webex.request.mockResolvedValue(pingFailurePayload);
|
|
1943
|
-
|
|
2211
|
+
_context47.next = 1;
|
|
1944
2212
|
return reg.isPrimaryActive();
|
|
1945
2213
|
case 1:
|
|
1946
|
-
status =
|
|
2214
|
+
status = _context47.sent;
|
|
1947
2215
|
expect(webex.request).toBeCalledWith(_objectSpread({
|
|
1948
2216
|
method: 'GET',
|
|
1949
2217
|
uri: "https://mobius-dfw.webex.com/api/v1/ping"
|
|
@@ -1951,9 +2219,9 @@ describe('Registration Tests', function () {
|
|
|
1951
2219
|
expect(status).toEqual(false);
|
|
1952
2220
|
case 2:
|
|
1953
2221
|
case "end":
|
|
1954
|
-
return
|
|
2222
|
+
return _context47.stop();
|
|
1955
2223
|
}
|
|
1956
|
-
},
|
|
2224
|
+
}, _callee47);
|
|
1957
2225
|
})));
|
|
1958
2226
|
});
|
|
1959
2227
|
describe('handleRegistrationDownEvent tests', function () {
|
|
@@ -1973,20 +2241,20 @@ describe('Registration Tests', function () {
|
|
|
1973
2241
|
}
|
|
1974
2242
|
}
|
|
1975
2243
|
};
|
|
1976
|
-
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1977
|
-
return _regenerator.default.wrap(function (
|
|
1978
|
-
while (1) switch (
|
|
2244
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee48() {
|
|
2245
|
+
return _regenerator.default.wrap(function (_context48) {
|
|
2246
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
1979
2247
|
case 0:
|
|
1980
2248
|
postRegistrationSpy.mockResolvedValueOnce(successPayload);
|
|
1981
|
-
|
|
2249
|
+
_context48.next = 1;
|
|
1982
2250
|
return reg.triggerRegistration();
|
|
1983
2251
|
case 1:
|
|
1984
2252
|
expect(reg.getStatus()).toBe(_types.RegistrationStatus.ACTIVE);
|
|
1985
2253
|
case 2:
|
|
1986
2254
|
case "end":
|
|
1987
|
-
return
|
|
2255
|
+
return _context48.stop();
|
|
1988
2256
|
}
|
|
1989
|
-
},
|
|
2257
|
+
}, _callee48);
|
|
1990
2258
|
})));
|
|
1991
2259
|
afterEach(function () {
|
|
1992
2260
|
var calls = (0, _values.default)(reg.callManager.getActiveCalls());
|
|
@@ -1995,10 +2263,10 @@ describe('Registration Tests', function () {
|
|
|
1995
2263
|
});
|
|
1996
2264
|
reg.callManager.callCollection = {};
|
|
1997
2265
|
});
|
|
1998
|
-
it('runs cleanup immediately when no active calls are present (socket disabled)', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2266
|
+
it('runs cleanup immediately when no active calls are present (socket disabled)', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49() {
|
|
1999
2267
|
var clearKeepaliveSpy, setStatusSpy, disconnectSocketSpy;
|
|
2000
|
-
return _regenerator.default.wrap(function (
|
|
2001
|
-
while (1) switch (
|
|
2268
|
+
return _regenerator.default.wrap(function (_context49) {
|
|
2269
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
2002
2270
|
case 0:
|
|
2003
2271
|
clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
2004
2272
|
setStatusSpy = jest.spyOn(reg, 'setStatus');
|
|
@@ -2007,7 +2275,7 @@ describe('Registration Tests', function () {
|
|
|
2007
2275
|
}), 'disconnectFromMobiusSocket');
|
|
2008
2276
|
lineEmitter.mockClear();
|
|
2009
2277
|
expect((0, _keys.default)(reg.callManager.getActiveCalls()).length).toBe(0);
|
|
2010
|
-
|
|
2278
|
+
_context49.next = 1;
|
|
2011
2279
|
return reg.handleRegistrationDownEvent(registrationDownEvent);
|
|
2012
2280
|
case 1:
|
|
2013
2281
|
expect(clearKeepaliveSpy).toHaveBeenCalled();
|
|
@@ -2019,17 +2287,18 @@ describe('Registration Tests', function () {
|
|
|
2019
2287
|
expect(reg.retryAfter).toBeUndefined();
|
|
2020
2288
|
expect(reg.registerRetry).toBe(false);
|
|
2021
2289
|
expect(disconnectSocketSpy).not.toHaveBeenCalled();
|
|
2022
|
-
|
|
2290
|
+
/* A registration-down stop has no reason to report to the consumer. */
|
|
2291
|
+
expect(lineEmitter).toHaveBeenCalledWith(_types4.LINE_EVENTS.UNREGISTERED, undefined, undefined);
|
|
2023
2292
|
case 2:
|
|
2024
2293
|
case "end":
|
|
2025
|
-
return
|
|
2294
|
+
return _context49.stop();
|
|
2026
2295
|
}
|
|
2027
|
-
},
|
|
2296
|
+
}, _callee49);
|
|
2028
2297
|
})));
|
|
2029
|
-
it('ends the active call and still runs cleanup when an active call is present', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2298
|
+
it('ends the active call and still runs cleanup when an active call is present', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee50() {
|
|
2030
2299
|
var clearKeepaliveSpy, setStatusSpy, activeCall, endSpy;
|
|
2031
|
-
return _regenerator.default.wrap(function (
|
|
2032
|
-
while (1) switch (
|
|
2300
|
+
return _regenerator.default.wrap(function (_context50) {
|
|
2301
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
2033
2302
|
case 0:
|
|
2034
2303
|
clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
2035
2304
|
setStatusSpy = jest.spyOn(reg, 'setStatus');
|
|
@@ -2037,28 +2306,28 @@ describe('Registration Tests', function () {
|
|
|
2037
2306
|
endSpy = jest.spyOn(activeCall, 'end');
|
|
2038
2307
|
expect((0, _keys.default)(reg.callManager.getActiveCalls()).length).toBe(1);
|
|
2039
2308
|
lineEmitter.mockClear();
|
|
2040
|
-
|
|
2309
|
+
_context50.next = 1;
|
|
2041
2310
|
return reg.handleRegistrationDownEvent(registrationDownEvent);
|
|
2042
2311
|
case 1:
|
|
2043
2312
|
expect(endSpy).toHaveBeenCalledTimes(1);
|
|
2044
2313
|
expect(clearKeepaliveSpy).toHaveBeenCalled();
|
|
2045
2314
|
expect(setStatusSpy).toHaveBeenCalledWith(_types.RegistrationStatus.INACTIVE);
|
|
2046
2315
|
expect(reg.getStatus()).toBe(_types.RegistrationStatus.INACTIVE);
|
|
2047
|
-
expect(lineEmitter).toHaveBeenCalledWith(_types4.LINE_EVENTS.UNREGISTERED);
|
|
2316
|
+
expect(lineEmitter).toHaveBeenCalledWith(_types4.LINE_EVENTS.UNREGISTERED, undefined, undefined);
|
|
2048
2317
|
case 2:
|
|
2049
2318
|
case "end":
|
|
2050
|
-
return
|
|
2319
|
+
return _context50.stop();
|
|
2051
2320
|
}
|
|
2052
|
-
},
|
|
2321
|
+
}, _callee50);
|
|
2053
2322
|
})));
|
|
2054
|
-
it('runs cleanup without calling end when no active call is present on re-invocation', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2323
|
+
it('runs cleanup without calling end when no active call is present on re-invocation', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee51() {
|
|
2055
2324
|
var clearKeepaliveSpy, setStatusSpy;
|
|
2056
|
-
return _regenerator.default.wrap(function (
|
|
2057
|
-
while (1) switch (
|
|
2325
|
+
return _regenerator.default.wrap(function (_context51) {
|
|
2326
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
2058
2327
|
case 0:
|
|
2059
2328
|
clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
2060
2329
|
setStatusSpy = jest.spyOn(reg, 'setStatus');
|
|
2061
|
-
|
|
2330
|
+
_context51.next = 1;
|
|
2062
2331
|
return reg.handleRegistrationDownEvent(registrationDownEvent);
|
|
2063
2332
|
case 1:
|
|
2064
2333
|
expect(reg.getStatus()).toBe(_types.RegistrationStatus.INACTIVE);
|
|
@@ -2066,23 +2335,23 @@ describe('Registration Tests', function () {
|
|
|
2066
2335
|
setStatusSpy.mockClear();
|
|
2067
2336
|
lineEmitter.mockClear();
|
|
2068
2337
|
expect((0, _keys.default)(reg.callManager.getActiveCalls()).length).toBe(0);
|
|
2069
|
-
|
|
2338
|
+
_context51.next = 2;
|
|
2070
2339
|
return reg.handleRegistrationDownEvent(registrationDownEvent);
|
|
2071
2340
|
case 2:
|
|
2072
2341
|
expect(clearKeepaliveSpy).toHaveBeenCalled();
|
|
2073
2342
|
expect(setStatusSpy).toHaveBeenCalledWith(_types.RegistrationStatus.INACTIVE);
|
|
2074
2343
|
expect(reg.getStatus()).toBe(_types.RegistrationStatus.INACTIVE);
|
|
2075
|
-
expect(lineEmitter).toHaveBeenCalledWith(_types4.LINE_EVENTS.UNREGISTERED);
|
|
2344
|
+
expect(lineEmitter).toHaveBeenCalledWith(_types4.LINE_EVENTS.UNREGISTERED, undefined, undefined);
|
|
2076
2345
|
case 3:
|
|
2077
2346
|
case "end":
|
|
2078
|
-
return
|
|
2347
|
+
return _context51.stop();
|
|
2079
2348
|
}
|
|
2080
|
-
},
|
|
2349
|
+
}, _callee51);
|
|
2081
2350
|
})));
|
|
2082
|
-
it('disconnects the Mobius WebSocket when socket is enabled', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2351
|
+
it('disconnects the Mobius WebSocket when socket is enabled', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee52() {
|
|
2083
2352
|
var apiRequest, disconnectSocketSpy;
|
|
2084
|
-
return _regenerator.default.wrap(function (
|
|
2085
|
-
while (1) switch (
|
|
2353
|
+
return _regenerator.default.wrap(function (_context52) {
|
|
2354
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
2086
2355
|
case 0:
|
|
2087
2356
|
apiRequest = _request.APIRequest.getInstance({
|
|
2088
2357
|
webex: webex
|
|
@@ -2091,7 +2360,7 @@ describe('Registration Tests', function () {
|
|
|
2091
2360
|
disconnectSocketSpy = jest.spyOn(apiRequest, 'disconnectFromMobiusSocket').mockResolvedValue();
|
|
2092
2361
|
lineEmitter.mockClear();
|
|
2093
2362
|
expect((0, _keys.default)(reg.callManager.getActiveCalls()).length).toBe(0);
|
|
2094
|
-
|
|
2363
|
+
_context52.next = 1;
|
|
2095
2364
|
return reg.handleRegistrationDownEvent(registrationDownEvent);
|
|
2096
2365
|
case 1:
|
|
2097
2366
|
expect(disconnectSocketSpy).toHaveBeenCalledWith({
|
|
@@ -2099,17 +2368,17 @@ describe('Registration Tests', function () {
|
|
|
2099
2368
|
reason: 'done (permanent)'
|
|
2100
2369
|
});
|
|
2101
2370
|
expect(reg.getStatus()).toBe(_types.RegistrationStatus.INACTIVE);
|
|
2102
|
-
expect(lineEmitter).toHaveBeenCalledWith(_types4.LINE_EVENTS.UNREGISTERED);
|
|
2371
|
+
expect(lineEmitter).toHaveBeenCalledWith(_types4.LINE_EVENTS.UNREGISTERED, undefined, undefined);
|
|
2103
2372
|
case 2:
|
|
2104
2373
|
case "end":
|
|
2105
|
-
return
|
|
2374
|
+
return _context52.stop();
|
|
2106
2375
|
}
|
|
2107
|
-
},
|
|
2376
|
+
}, _callee52);
|
|
2108
2377
|
})));
|
|
2109
|
-
it('still emits UNREGISTERED when socket disconnect fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2378
|
+
it('still emits UNREGISTERED when socket disconnect fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53() {
|
|
2110
2379
|
var apiRequest, disconnectSocketSpy;
|
|
2111
|
-
return _regenerator.default.wrap(function (
|
|
2112
|
-
while (1) switch (
|
|
2380
|
+
return _regenerator.default.wrap(function (_context53) {
|
|
2381
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
2113
2382
|
case 0:
|
|
2114
2383
|
apiRequest = _request.APIRequest.getInstance({
|
|
2115
2384
|
webex: webex
|
|
@@ -2117,7 +2386,7 @@ describe('Registration Tests', function () {
|
|
|
2117
2386
|
jest.spyOn(apiRequest, 'isSocketEnabled').mockReturnValue(true);
|
|
2118
2387
|
disconnectSocketSpy = jest.spyOn(apiRequest, 'disconnectFromMobiusSocket').mockRejectedValue(new Error('socket teardown failed'));
|
|
2119
2388
|
lineEmitter.mockClear();
|
|
2120
|
-
|
|
2389
|
+
_context53.next = 1;
|
|
2121
2390
|
return reg.handleRegistrationDownEvent(registrationDownEvent);
|
|
2122
2391
|
case 1:
|
|
2123
2392
|
expect(disconnectSocketSpy).toHaveBeenCalled();
|
|
@@ -2126,12 +2395,12 @@ describe('Registration Tests', function () {
|
|
|
2126
2395
|
method: _constants.METHODS.HANDLE_REGISTRATION_DOWN_EVENT
|
|
2127
2396
|
});
|
|
2128
2397
|
expect(reg.getStatus()).toBe(_types.RegistrationStatus.INACTIVE);
|
|
2129
|
-
expect(lineEmitter).toHaveBeenCalledWith(_types4.LINE_EVENTS.UNREGISTERED);
|
|
2398
|
+
expect(lineEmitter).toHaveBeenCalledWith(_types4.LINE_EVENTS.UNREGISTERED, undefined, undefined);
|
|
2130
2399
|
case 2:
|
|
2131
2400
|
case "end":
|
|
2132
|
-
return
|
|
2401
|
+
return _context53.stop();
|
|
2133
2402
|
}
|
|
2134
|
-
},
|
|
2403
|
+
}, _callee53);
|
|
2135
2404
|
})));
|
|
2136
2405
|
});
|
|
2137
2406
|
describe('attemptRegistrationWithServers transport alignment', function () {
|
|
@@ -2146,61 +2415,61 @@ describe('Registration Tests', function () {
|
|
|
2146
2415
|
setSocketEnabledSpy = jest.spyOn(apiRequest, 'setSocketEnabled').mockImplementation(function () {});
|
|
2147
2416
|
webex.request.mockResolvedValue(successPayload);
|
|
2148
2417
|
});
|
|
2149
|
-
it('enables the WebSocket transport when the server group uses the wss:// scheme', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2150
|
-
return _regenerator.default.wrap(function (
|
|
2151
|
-
while (1) switch (
|
|
2418
|
+
it('enables the WebSocket transport when the server group uses the wss:// scheme', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee54() {
|
|
2419
|
+
return _regenerator.default.wrap(function (_context54) {
|
|
2420
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
2152
2421
|
case 0:
|
|
2153
|
-
|
|
2422
|
+
_context54.next = 1;
|
|
2154
2423
|
return reg.attemptRegistrationWithServers(_constants.REGISTRATION_UTIL, ['wss://mobius.example.com/api/v1/calling/web/']);
|
|
2155
2424
|
case 1:
|
|
2156
2425
|
expect(setSocketEnabledSpy).toHaveBeenCalledWith(true);
|
|
2157
2426
|
case 2:
|
|
2158
2427
|
case "end":
|
|
2159
|
-
return
|
|
2428
|
+
return _context54.stop();
|
|
2160
2429
|
}
|
|
2161
|
-
},
|
|
2430
|
+
}, _callee54);
|
|
2162
2431
|
})));
|
|
2163
|
-
it('falls back to the HTTP transport when the server group uses the https:// scheme', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2164
|
-
return _regenerator.default.wrap(function (
|
|
2165
|
-
while (1) switch (
|
|
2432
|
+
it('falls back to the HTTP transport when the server group uses the https:// scheme', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee55() {
|
|
2433
|
+
return _regenerator.default.wrap(function (_context55) {
|
|
2434
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
2166
2435
|
case 0:
|
|
2167
|
-
|
|
2436
|
+
_context55.next = 1;
|
|
2168
2437
|
return reg.attemptRegistrationWithServers(_constants.REGISTRATION_UTIL, ['https://mobius.example.com/api/v1/calling/web/']);
|
|
2169
2438
|
case 1:
|
|
2170
2439
|
expect(setSocketEnabledSpy).toHaveBeenCalledWith(false);
|
|
2171
2440
|
case 2:
|
|
2172
2441
|
case "end":
|
|
2173
|
-
return
|
|
2442
|
+
return _context55.stop();
|
|
2174
2443
|
}
|
|
2175
|
-
},
|
|
2444
|
+
}, _callee55);
|
|
2176
2445
|
})));
|
|
2177
|
-
it('does not change the transport when the server group is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2178
|
-
return _regenerator.default.wrap(function (
|
|
2179
|
-
while (1) switch (
|
|
2446
|
+
it('does not change the transport when the server group is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee56() {
|
|
2447
|
+
return _regenerator.default.wrap(function (_context56) {
|
|
2448
|
+
while (1) switch (_context56.prev = _context56.next) {
|
|
2180
2449
|
case 0:
|
|
2181
|
-
|
|
2450
|
+
_context56.next = 1;
|
|
2182
2451
|
return reg.attemptRegistrationWithServers(_constants.REGISTRATION_UTIL, []);
|
|
2183
2452
|
case 1:
|
|
2184
2453
|
expect(setSocketEnabledSpy).not.toHaveBeenCalled();
|
|
2185
2454
|
case 2:
|
|
2186
2455
|
case "end":
|
|
2187
|
-
return
|
|
2456
|
+
return _context56.stop();
|
|
2188
2457
|
}
|
|
2189
|
-
},
|
|
2458
|
+
}, _callee56);
|
|
2190
2459
|
})));
|
|
2191
|
-
it('derives the transport from the first server in the group', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
2192
|
-
return _regenerator.default.wrap(function (
|
|
2193
|
-
while (1) switch (
|
|
2460
|
+
it('derives the transport from the first server in the group', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee57() {
|
|
2461
|
+
return _regenerator.default.wrap(function (_context57) {
|
|
2462
|
+
while (1) switch (_context57.prev = _context57.next) {
|
|
2194
2463
|
case 0:
|
|
2195
|
-
|
|
2464
|
+
_context57.next = 1;
|
|
2196
2465
|
return reg.attemptRegistrationWithServers(_constants.REGISTRATION_UTIL, ['wss://primary.example.com/api/v1/calling/web/', 'https://backup.example.com/api/v1/calling/web/']);
|
|
2197
2466
|
case 1:
|
|
2198
2467
|
expect(setSocketEnabledSpy).toHaveBeenCalledWith(true);
|
|
2199
2468
|
case 2:
|
|
2200
2469
|
case "end":
|
|
2201
|
-
return
|
|
2470
|
+
return _context57.stop();
|
|
2202
2471
|
}
|
|
2203
|
-
},
|
|
2472
|
+
}, _callee57);
|
|
2204
2473
|
})));
|
|
2205
2474
|
});
|
|
2206
2475
|
});
|