@webex/calling 3.12.0-next.47 → 3.12.0-next.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CallingClient/CallingClient.js +48 -23
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +91 -25
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/constants.js +2 -0
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/types.js.map +1 -1
- package/dist/CallingClient/utils/constants.js +13 -1
- package/dist/CallingClient/utils/constants.js.map +1 -1
- package/dist/CallingClient/utils/request.js +61 -0
- package/dist/CallingClient/utils/request.js.map +1 -1
- package/dist/CallingClient/utils/request.test.js +87 -0
- package/dist/CallingClient/utils/request.test.js.map +1 -1
- package/dist/CallingClient/utils/types.js.map +1 -1
- package/dist/Events/types.js +11 -1
- package/dist/Events/types.js.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/mobius-socket/mobius-socket.js +9 -1
- package/dist/mobius-socket/mobius-socket.js.map +1 -1
- package/dist/mobius-socket/mobius-socket.test.js +57 -4
- package/dist/mobius-socket/mobius-socket.test.js.map +1 -1
- package/dist/module/CallingClient/CallingClient.js +7 -0
- package/dist/module/CallingClient/constants.js +2 -0
- package/dist/module/CallingClient/utils/constants.js +6 -0
- package/dist/module/CallingClient/utils/request.js +40 -1
- package/dist/module/Events/types.js +4 -0
- package/dist/module/index.js +1 -1
- package/dist/module/mobius-socket/mobius-socket.js +4 -0
- package/dist/types/CallingClient/CallingClient.d.ts +1 -0
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +2 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/types.d.ts +1 -0
- package/dist/types/CallingClient/types.d.ts.map +1 -1
- package/dist/types/CallingClient/utils/constants.d.ts +5 -0
- package/dist/types/CallingClient/utils/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/utils/request.d.ts +4 -1
- package/dist/types/CallingClient/utils/request.d.ts.map +1 -1
- package/dist/types/CallingClient/utils/types.d.ts +5 -0
- package/dist/types/CallingClient/utils/types.d.ts.map +1 -1
- package/dist/types/Events/types.d.ts +10 -2
- package/dist/types/Events/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/mobius-socket/mobius-socket.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -45,6 +45,7 @@ jest.mock('../mobius-socket', function () {
|
|
|
45
45
|
getMobiusSocketInstance: jest.fn().mockReturnValue({
|
|
46
46
|
sendWssRequest: jest.fn(),
|
|
47
47
|
connect: jest.fn(),
|
|
48
|
+
isConnected: jest.fn().mockReturnValue(false),
|
|
48
49
|
on: jest.fn(),
|
|
49
50
|
off: jest.fn()
|
|
50
51
|
})
|
|
@@ -1154,14 +1155,30 @@ describe('CallingClient Tests', function () {
|
|
|
1154
1155
|
}, _callee31);
|
|
1155
1156
|
})));
|
|
1156
1157
|
});
|
|
1157
|
-
describe('
|
|
1158
|
+
describe('Mobius socket connection events', function () {
|
|
1158
1159
|
var callingClient;
|
|
1159
|
-
var
|
|
1160
|
-
var
|
|
1160
|
+
var mobiusSocketMock;
|
|
1161
|
+
var getSocketHandlerFor = function getSocketHandlerFor(eventName) {
|
|
1162
|
+
var onCall = mobiusSocketMock.on.mock.calls.find(function (call) {
|
|
1163
|
+
return call[0] === eventName;
|
|
1164
|
+
});
|
|
1165
|
+
return onCall[1];
|
|
1166
|
+
};
|
|
1161
1167
|
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
|
|
1162
1168
|
return _regenerator.default.wrap(function (_context32) {
|
|
1163
1169
|
while (1) switch (_context32.prev = _context32.next) {
|
|
1164
1170
|
case 0:
|
|
1171
|
+
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1172
|
+
value: true
|
|
1173
|
+
});
|
|
1174
|
+
_request.APIRequest.resetInstance();
|
|
1175
|
+
_request.APIRequest.getInstance({
|
|
1176
|
+
webex: webex
|
|
1177
|
+
});
|
|
1178
|
+
mobiusSocketMock = jest.requireMock('../mobius-socket').getMobiusSocketInstance(webex);
|
|
1179
|
+
mobiusSocketMock.on.mockClear();
|
|
1180
|
+
mobiusSocketMock.off.mockClear();
|
|
1181
|
+
mobiusSocketMock.isConnected.mockReturnValue(false);
|
|
1165
1182
|
_context32.next = 1;
|
|
1166
1183
|
return (0, _CallingClient.createClient)(webex, {
|
|
1167
1184
|
logger: {
|
|
@@ -1170,9 +1187,6 @@ describe('CallingClient Tests', function () {
|
|
|
1170
1187
|
});
|
|
1171
1188
|
case 1:
|
|
1172
1189
|
callingClient = _context32.sent;
|
|
1173
|
-
callingClient.primaryMobiusUris = [primaryMobius];
|
|
1174
|
-
callingClient.backupMobiusUris = [backupMobius];
|
|
1175
|
-
webex.request.mockClear();
|
|
1176
1190
|
case 2:
|
|
1177
1191
|
case "end":
|
|
1178
1192
|
return _context32.stop();
|
|
@@ -1181,11 +1195,63 @@ describe('CallingClient Tests', function () {
|
|
|
1181
1195
|
})));
|
|
1182
1196
|
afterEach(function () {
|
|
1183
1197
|
callingClient.removeAllListeners();
|
|
1198
|
+
callManager.removeAllListeners();
|
|
1199
|
+
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1200
|
+
value: false
|
|
1201
|
+
});
|
|
1184
1202
|
});
|
|
1185
|
-
it('
|
|
1186
|
-
var
|
|
1203
|
+
it('emits MOBIUS_SOCKET_CONNECTED when the socket comes online', function () {
|
|
1204
|
+
var listener = jest.fn();
|
|
1205
|
+
callingClient.on(_types3.CALLING_CLIENT_EVENT_KEYS.MOBIUS_SOCKET_CONNECTED, listener);
|
|
1206
|
+
getSocketHandlerFor('online')();
|
|
1207
|
+
expect(listener).toHaveBeenCalledTimes(1);
|
|
1208
|
+
});
|
|
1209
|
+
it.each([['offline.permanent', _types3.MOBIUS_SOCKET_DISCONNECT_REASON.PERMANENT], ['offline.transient', _types3.MOBIUS_SOCKET_DISCONNECT_REASON.TRANSIENT], ['offline.replaced', _types3.MOBIUS_SOCKET_DISCONNECT_REASON.REPLACED]])('emits MOBIUS_SOCKET_DISCONNECTED with the matching reason when %s fires', function (eventName, reason) {
|
|
1210
|
+
var listener = jest.fn();
|
|
1211
|
+
callingClient.on(_types3.CALLING_CLIENT_EVENT_KEYS.MOBIUS_SOCKET_DISCONNECTED, listener);
|
|
1212
|
+
getSocketHandlerFor(eventName)();
|
|
1213
|
+
expect(listener).toHaveBeenCalledTimes(1);
|
|
1214
|
+
expect(listener).toHaveBeenCalledWith({
|
|
1215
|
+
reason: reason
|
|
1216
|
+
});
|
|
1217
|
+
});
|
|
1218
|
+
it.each([true, false])('isMobiusSocketConnected() reflects the underlying socket state (%s) when WSS is enabled', function (connected) {
|
|
1219
|
+
mobiusSocketMock.isConnected.mockReturnValue(connected);
|
|
1220
|
+
expect(callingClient.isMobiusSocketConnected()).toBe(connected);
|
|
1221
|
+
});
|
|
1222
|
+
});
|
|
1223
|
+
describe('getDevices', function () {
|
|
1224
|
+
var callingClient;
|
|
1225
|
+
var primaryMobius = 'https://mobius.primary/api/v1/calling/web/';
|
|
1226
|
+
var backupMobius = 'https://mobius.backup/api/v1/calling/web/';
|
|
1227
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
|
|
1187
1228
|
return _regenerator.default.wrap(function (_context33) {
|
|
1188
1229
|
while (1) switch (_context33.prev = _context33.next) {
|
|
1230
|
+
case 0:
|
|
1231
|
+
_context33.next = 1;
|
|
1232
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
1233
|
+
logger: {
|
|
1234
|
+
level: _types.LOGGER.INFO
|
|
1235
|
+
}
|
|
1236
|
+
});
|
|
1237
|
+
case 1:
|
|
1238
|
+
callingClient = _context33.sent;
|
|
1239
|
+
callingClient.primaryMobiusUris = [primaryMobius];
|
|
1240
|
+
callingClient.backupMobiusUris = [backupMobius];
|
|
1241
|
+
webex.request.mockClear();
|
|
1242
|
+
case 2:
|
|
1243
|
+
case "end":
|
|
1244
|
+
return _context33.stop();
|
|
1245
|
+
}
|
|
1246
|
+
}, _callee33);
|
|
1247
|
+
})));
|
|
1248
|
+
afterEach(function () {
|
|
1249
|
+
callingClient.removeAllListeners();
|
|
1250
|
+
});
|
|
1251
|
+
it('fetches devices for the provided userId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
|
|
1252
|
+
var devices, responsePayload, response;
|
|
1253
|
+
return _regenerator.default.wrap(function (_context34) {
|
|
1254
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
1189
1255
|
case 0:
|
|
1190
1256
|
devices = [{
|
|
1191
1257
|
deviceId: 'device-1',
|
|
@@ -1203,10 +1269,10 @@ describe('CallingClient Tests', function () {
|
|
|
1203
1269
|
}
|
|
1204
1270
|
};
|
|
1205
1271
|
webex.request.mockResolvedValue(responsePayload);
|
|
1206
|
-
|
|
1272
|
+
_context34.next = 1;
|
|
1207
1273
|
return callingClient.getDevices('user-123');
|
|
1208
1274
|
case 1:
|
|
1209
|
-
response =
|
|
1275
|
+
response = _context34.sent;
|
|
1210
1276
|
expect(webex.request).toHaveBeenCalledWith({
|
|
1211
1277
|
uri: 'https://mobius.primary/api/v1/calling/web/devices?userid=user-123',
|
|
1212
1278
|
method: _types2.HTTP_METHODS.GET,
|
|
@@ -1216,14 +1282,14 @@ describe('CallingClient Tests', function () {
|
|
|
1216
1282
|
expect(response).toEqual(devices);
|
|
1217
1283
|
case 2:
|
|
1218
1284
|
case "end":
|
|
1219
|
-
return
|
|
1285
|
+
return _context34.stop();
|
|
1220
1286
|
}
|
|
1221
|
-
},
|
|
1287
|
+
}, _callee34);
|
|
1222
1288
|
})));
|
|
1223
|
-
it('falls back to backup Mobius when primary fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1289
|
+
it('falls back to backup Mobius when primary fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
|
|
1224
1290
|
var devices, failurePayload, responsePayload, response, requestCalls;
|
|
1225
|
-
return _regenerator.default.wrap(function (
|
|
1226
|
-
while (1) switch (
|
|
1291
|
+
return _regenerator.default.wrap(function (_context35) {
|
|
1292
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1227
1293
|
case 0:
|
|
1228
1294
|
devices = [{
|
|
1229
1295
|
deviceId: 'device-2',
|
|
@@ -1244,10 +1310,10 @@ describe('CallingClient Tests', function () {
|
|
|
1244
1310
|
}
|
|
1245
1311
|
};
|
|
1246
1312
|
webex.request.mockRejectedValueOnce(failurePayload).mockResolvedValueOnce(responsePayload);
|
|
1247
|
-
|
|
1313
|
+
_context35.next = 1;
|
|
1248
1314
|
return callingClient.getDevices('user-123');
|
|
1249
1315
|
case 1:
|
|
1250
|
-
response =
|
|
1316
|
+
response = _context35.sent;
|
|
1251
1317
|
requestCalls = webex.request.mock.calls;
|
|
1252
1318
|
expect(requestCalls[0][0]).toEqual({
|
|
1253
1319
|
uri: 'https://mobius.primary/api/v1/calling/web/devices?userid=user-123',
|
|
@@ -1264,9 +1330,9 @@ describe('CallingClient Tests', function () {
|
|
|
1264
1330
|
expect(response).toEqual(devices);
|
|
1265
1331
|
case 2:
|
|
1266
1332
|
case "end":
|
|
1267
|
-
return
|
|
1333
|
+
return _context35.stop();
|
|
1268
1334
|
}
|
|
1269
|
-
},
|
|
1335
|
+
}, _callee35);
|
|
1270
1336
|
})));
|
|
1271
1337
|
});
|
|
1272
1338
|
describe('windowsChromiumIceWarmup', function () {
|
|
@@ -1342,17 +1408,17 @@ describe('CallingClient Tests', function () {
|
|
|
1342
1408
|
afterAll(function () {
|
|
1343
1409
|
global.RTCPeerConnection = origRTCPeerConnection;
|
|
1344
1410
|
});
|
|
1345
|
-
it('should complete without throwing', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1346
|
-
return _regenerator.default.wrap(function (
|
|
1347
|
-
while (1) switch (
|
|
1411
|
+
it('should complete without throwing', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
|
|
1412
|
+
return _regenerator.default.wrap(function (_context36) {
|
|
1413
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1348
1414
|
case 0:
|
|
1349
|
-
|
|
1415
|
+
_context36.next = 1;
|
|
1350
1416
|
return expect((0, _windowsChromiumIceWarmupUtils.default)({})).resolves.not.toThrow();
|
|
1351
1417
|
case 1:
|
|
1352
1418
|
case "end":
|
|
1353
|
-
return
|
|
1419
|
+
return _context36.stop();
|
|
1354
1420
|
}
|
|
1355
|
-
},
|
|
1421
|
+
}, _callee36);
|
|
1356
1422
|
})));
|
|
1357
1423
|
});
|
|
1358
1424
|
});
|