@webex/calling 3.12.0-next.93 → 3.12.0-next.94

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.
@@ -33,7 +33,7 @@ var _types4 = require("../line/types");
33
33
  var _LineError = require("../../Errors/catalog/LineError");
34
34
  var _types5 = require("../../Metrics/types");
35
35
  var _request = require("../utils/request");
36
- function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
36
+ function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
37
37
  function ownKeys(e, r) { var t = _Object$keys2(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; }
38
38
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } /* eslint-disable @typescript-eslint/no-shadow */
39
39
  jest.mock('../../mobius-socket', function () {
@@ -2172,22 +2172,308 @@ describe('Registration Tests', function () {
2172
2172
  return _ref52.apply(this, arguments);
2173
2173
  };
2174
2174
  }());
2175
+ it('stays terminal when the network recovers after a superseded session', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46() {
2176
+ var retry;
2177
+ return _regenerator.default.wrap(function (_context46) {
2178
+ while (1) switch (_context46.prev = _context46.next) {
2179
+ case 0:
2180
+ _context46.next = 1;
2181
+ return beforeEachSetupForKeepalive();
2182
+ case 1:
2183
+ lineEmitter.mockClear();
2184
+ _context46.next = 2;
2185
+ return sendKeepaliveFailure(conflictError, 1);
2186
+ case 2:
2187
+ expect(reg.sessionSuperseded).toStrictEqual(true);
2188
+ restoreSpy.mockClear();
2189
+ restartSpy.mockClear();
2190
+ postRegistrationSpy.mockClear();
2191
+ failoverSpy.mockClear();
2192
+ _context46.next = 3;
2193
+ return reg.handleConnectionRestoration(true);
2194
+ case 3:
2195
+ retry = _context46.sent;
2196
+ /* The restoration runs, but every registration attempt it makes is refused at the
2197
+ * choke point, so nothing reaches Mobius and no failover is rescheduled. */
2198
+ expect(retry).toStrictEqual(false);
2199
+ expect(warnSpy).toHaveBeenCalledWith("Session superseded, skipping registration attempt - caller: ".concat(_constants.METHODS.HANDLE_CONNECTION_RESTORATION), {
2200
+ file: _constants.REGISTRATION_FILE,
2201
+ method: _constants.METHODS.HANDLE_CONNECTION_RESTORATION
2202
+ });
2203
+ expect(postRegistrationSpy).not.toHaveBeenCalled();
2204
+ expect(restartSpy).not.toHaveBeenCalled();
2205
+ expect(failoverSpy).not.toHaveBeenCalled();
2206
+ expect(reg.getStatus()).toEqual(_types.RegistrationStatus.INACTIVE);
2207
+ case 4:
2208
+ case "end":
2209
+ return _context46.stop();
2210
+ }
2211
+ }, _callee46);
2212
+ })));
2213
+ it('abandons a restoration that was already queued when the session was superseded', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47() {
2214
+ var release, restoration, _t;
2215
+ return _regenerator.default.wrap(function (_context47) {
2216
+ while (1) switch (_context47.prev = _context47.next) {
2217
+ case 0:
2218
+ _context47.next = 1;
2219
+ return beforeEachSetupForKeepalive();
2220
+ case 1:
2221
+ lineEmitter.mockClear();
2222
+ postRegistrationSpy.mockClear();
2223
+ restartSpy.mockClear();
2224
+ failoverSpy.mockClear();
2225
+
2226
+ /* Something else holds the mutex, so the restoration queues behind it having
2227
+ * begun while the session was still valid. */
2228
+ _context47.next = 2;
2229
+ return reg.mutex.acquire();
2230
+ case 2:
2231
+ release = _context47.sent;
2232
+ restoration = reg.handleConnectionRestoration(true);
2233
+ _context47.next = 3;
2234
+ return flushPromises();
2235
+ case 3:
2236
+ /* The 409 cleanup latches without the mutex, so the flip lands mid-wait. */
2237
+ reg.sessionSuperseded = true;
2238
+ release();
2239
+ _t = expect;
2240
+ _context47.next = 4;
2241
+ return restoration;
2242
+ case 4:
2243
+ _t(_context47.sent).toStrictEqual(false);
2244
+ /* The latch flipped after this restoration had already started, so the choke
2245
+ * point is what stops it: no device is registered for the dead session. */
2246
+ expect(warnSpy).toHaveBeenCalledWith("Session superseded, skipping registration attempt - caller: ".concat(_constants.METHODS.HANDLE_CONNECTION_RESTORATION), {
2247
+ file: _constants.REGISTRATION_FILE,
2248
+ method: _constants.METHODS.HANDLE_CONNECTION_RESTORATION
2249
+ });
2250
+ expect(postRegistrationSpy).not.toHaveBeenCalled();
2251
+ expect(restartSpy).not.toHaveBeenCalled();
2252
+ expect(failoverSpy).not.toHaveBeenCalled();
2253
+ case 5:
2254
+ case "end":
2255
+ return _context47.stop();
2256
+ }
2257
+ }, _callee47);
2258
+ })));
2259
+ it('stays terminal when all calls are cleared after a superseded session', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee48() {
2260
+ return _regenerator.default.wrap(function (_context48) {
2261
+ while (1) switch (_context48.prev = _context48.next) {
2262
+ case 0:
2263
+ _context48.next = 1;
2264
+ return beforeEachSetupForKeepalive();
2265
+ case 1:
2266
+ lineEmitter.mockClear();
2267
+ _context48.next = 2;
2268
+ return sendKeepaliveFailure(conflictError, 1);
2269
+ case 2:
2270
+ postRegistrationSpy.mockClear();
2271
+ restartSpy.mockClear();
2272
+ failoverSpy.mockClear();
2273
+ _context48.next = 3;
2274
+ return reg.reconnectOnFailure(_constants.CALLS_CLEARED_HANDLER_UTIL);
2275
+ case 3:
2276
+ expect(warnSpy).toHaveBeenCalledWith("Session superseded, skipping registration attempt - caller: ".concat(_constants.CALLS_CLEARED_HANDLER_UTIL), {
2277
+ file: _constants.REGISTRATION_FILE,
2278
+ method: _constants.CALLS_CLEARED_HANDLER_UTIL
2279
+ });
2280
+ expect(postRegistrationSpy).not.toHaveBeenCalled();
2281
+ expect(restartSpy).not.toHaveBeenCalled();
2282
+ expect(failoverSpy).not.toHaveBeenCalled();
2283
+ expect(reg.getStatus()).toEqual(_types.RegistrationStatus.INACTIVE);
2284
+ case 4:
2285
+ case "end":
2286
+ return _context48.stop();
2287
+ }
2288
+ }, _callee48);
2289
+ })));
2290
+ it('lets an explicit registration by the consumer clear the superseded state', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49() {
2291
+ return _regenerator.default.wrap(function (_context49) {
2292
+ while (1) switch (_context49.prev = _context49.next) {
2293
+ case 0:
2294
+ _context49.next = 1;
2295
+ return beforeEachSetupForKeepalive();
2296
+ case 1:
2297
+ lineEmitter.mockClear();
2298
+ _context49.next = 2;
2299
+ return sendKeepaliveFailure(conflictError, 1);
2300
+ case 2:
2301
+ expect(reg.sessionSuperseded).toStrictEqual(true);
2302
+ postRegistrationSpy.mockResolvedValueOnce(successPayload);
2303
+ _context49.next = 3;
2304
+ return reg.triggerRegistration();
2305
+ case 3:
2306
+ expect(reg.sessionSuperseded).toStrictEqual(false);
2307
+ expect(reg.getStatus()).toBe(_types.RegistrationStatus.ACTIVE);
2308
+ case 4:
2309
+ case "end":
2310
+ return _context49.stop();
2311
+ }
2312
+ }, _callee49);
2313
+ })));
2314
+ it('latches the superseded state before waiting on the shared mutex', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee50() {
2315
+ var worker, release, inFlight, abort;
2316
+ return _regenerator.default.wrap(function (_context50) {
2317
+ while (1) switch (_context50.prev = _context50.next) {
2318
+ case 0:
2319
+ _context50.next = 1;
2320
+ return beforeEachSetupForKeepalive();
2321
+ case 1:
2322
+ worker = reg.webWorker;
2323
+ lineEmitter.mockClear();
2324
+ postRegistrationSpy.mockClear();
2325
+
2326
+ /* A recovery already holds the mutex, so the 409 cleanup queues behind it. */
2327
+ _context50.next = 2;
2328
+ return reg.mutex.acquire();
2329
+ case 2:
2330
+ release = _context50.sent;
2331
+ inFlight = worker.onmessage({
2332
+ data: {
2333
+ type: _types.WorkerMessageType.KEEPALIVE_FAILURE,
2334
+ err: conflictError,
2335
+ keepAliveRetryCount: 1
2336
+ }
2337
+ });
2338
+ _context50.next = 3;
2339
+ return flushPromises();
2340
+ case 3:
2341
+ /* The latch and the worker teardown are visible before cleanup has run. */
2342
+ expect(reg.sessionSuperseded).toStrictEqual(true);
2343
+ expect(reg.webWorker).toBeUndefined();
2344
+ expect(lineEmitter).not.toHaveBeenCalledWith(_types4.LINE_EVENTS.UNREGISTERED, undefined, expect.anything());
2345
+
2346
+ /* A registration path starting now aborts instead of racing the queued cleanup. */
2347
+ _context50.next = 4;
2348
+ return reg.attemptRegistrationWithServers(_constants.FAILOVER_UTIL);
2349
+ case 4:
2350
+ abort = _context50.sent;
2351
+ expect(abort).toStrictEqual(true);
2352
+ expect(postRegistrationSpy).not.toHaveBeenCalled();
2353
+ expect(warnSpy).toHaveBeenCalledWith("Session superseded, skipping registration attempt - caller: ".concat(_constants.FAILOVER_UTIL), {
2354
+ file: _constants.REGISTRATION_FILE,
2355
+ method: _constants.FAILOVER_UTIL
2356
+ });
2357
+ release();
2358
+ _context50.next = 5;
2359
+ return inFlight;
2360
+ case 5:
2361
+ _context50.next = 6;
2362
+ return flushPromises();
2363
+ case 6:
2364
+ expect(reg.getStatus()).toEqual(_types.RegistrationStatus.INACTIVE);
2365
+ case 7:
2366
+ case "end":
2367
+ return _context50.stop();
2368
+ }
2369
+ }, _callee50);
2370
+ })));
2371
+ it('discards a 409 delivered by a keepalive worker that has been replaced', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee51() {
2372
+ var staleWorker, staleWorkerPostSpy, handle409Spy, failKeepalive, inFlight, currentWorker;
2373
+ return _regenerator.default.wrap(function (_context51) {
2374
+ while (1) switch (_context51.prev = _context51.next) {
2375
+ case 0:
2376
+ _context51.next = 1;
2377
+ return beforeEachSetupForKeepalive();
2378
+ case 1:
2379
+ staleWorker = reg.webWorker;
2380
+ staleWorkerPostSpy = jest.spyOn(staleWorker, 'postMessage');
2381
+ handle409Spy = jest.spyOn(reg, 'handle409KeepaliveFailure');
2382
+ jest.spyOn(reg, 'postKeepAlive').mockReturnValue(new _promise.default(function (_, reject) {
2383
+ failKeepalive = reject;
2384
+ }));
2385
+ lineEmitter.mockClear();
2386
+ inFlight = staleWorker.onmessage({
2387
+ data: {
2388
+ type: _types.WorkerMessageType.SEND_KEEPALIVE
2389
+ }
2390
+ });
2391
+ /* A re-registration (failback, connection restoration) swaps the worker while the
2392
+ * keepalive of the previous registration is still in flight. */
2393
+ currentWorker = {
2394
+ postMessage: jest.fn(),
2395
+ terminate: jest.fn(),
2396
+ onmessage: null
2397
+ };
2398
+ reg.webWorker = currentWorker;
2399
+ failKeepalive(conflictError);
2400
+ _context51.next = 2;
2401
+ return inFlight;
2402
+ case 2:
2403
+ _context51.next = 3;
2404
+ return flushPromises();
2405
+ case 3:
2406
+ expect(staleWorkerPostSpy).not.toHaveBeenCalledWith(expect.objectContaining({
2407
+ type: _types.WorkerMessageType.KEEPALIVE_RESULT
2408
+ }));
2409
+ expect(currentWorker.postMessage).not.toHaveBeenCalled();
2410
+ expect(handle409Spy).not.toHaveBeenCalled();
2411
+ expect(lineEmitter).not.toHaveBeenCalledWith(_types4.LINE_EVENTS.UNREGISTERED, undefined, expect.anything());
2412
+ case 4:
2413
+ case "end":
2414
+ return _context51.stop();
2415
+ }
2416
+ }, _callee51);
2417
+ })));
2175
2418
  });
2176
2419
  });
2420
+ describe('409 Conflict outside the keepalive flow', function () {
2421
+ /* The registration flow passes no sessionSupersededCb, so a 409 there is logged and
2422
+ * ignored: no consumer event, no registration-error metric, and non-final so the
2423
+ * server loop and failover proceed as they would for any non-fatal status. */
2424
+ it('ignores a 409 during registration without notifying the consumer', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee52() {
2425
+ var conflictPayload;
2426
+ return _regenerator.default.wrap(function (_context52) {
2427
+ while (1) switch (_context52.prev = _context52.next) {
2428
+ case 0:
2429
+ jest.useFakeTimers();
2430
+ conflictPayload = {
2431
+ statusCode: 409,
2432
+ headers: {
2433
+ trackingid: 'tid-reg-409'
2434
+ }
2435
+ };
2436
+ webex.request.mockRejectedValue(conflictPayload);
2437
+ lineEmitter.mockClear();
2438
+ metricSpy.mockClear();
2439
+ _context52.next = 1;
2440
+ return reg.triggerRegistration();
2441
+ case 1:
2442
+ expect(warnSpy).toHaveBeenCalledWith('409 Conflict: ignored, caller does not handle a superseded session', {
2443
+ file: _constants.REGISTRATION_FILE,
2444
+ method: _constants.REGISTRATION_UTIL
2445
+ });
2446
+
2447
+ /* No consumer notification and no registration-error metric on this path. */
2448
+ expect(lineEmitter).not.toHaveBeenCalledWith(_types4.LINE_EVENTS.UNREGISTERED);
2449
+ expect(lineEmitter).not.toHaveBeenCalledWith(_types4.LINE_EVENTS.ERROR, undefined, expect.anything());
2450
+ expect(metricSpy).not.toHaveBeenCalledWith(_types5.METRIC_EVENT.REGISTRATION_ERROR, _types5.REG_ACTION.REGISTER, _types5.METRIC_TYPE.BEHAVIORAL, expect.anything(), expect.anything(), expect.anything(), expect.anything(), expect.anything());
2451
+
2452
+ /* Non-final: every server was tried and failover was scheduled. */
2453
+ expect(reg.getStatus()).toEqual(_types.RegistrationStatus.INACTIVE);
2454
+ expect(reg.sessionSuperseded).toStrictEqual(false);
2455
+ expect(failoverSpy).toHaveBeenCalled();
2456
+ case 2:
2457
+ case "end":
2458
+ return _context52.stop();
2459
+ }
2460
+ }, _callee52);
2461
+ })));
2462
+ });
2177
2463
  describe('Primary server status checks', function () {
2178
- it('success: primary server status to be up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee46() {
2464
+ it('success: primary server status to be up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53() {
2179
2465
  var pingSuccessPayload, status;
2180
- return _regenerator.default.wrap(function (_context46) {
2181
- while (1) switch (_context46.prev = _context46.next) {
2466
+ return _regenerator.default.wrap(function (_context53) {
2467
+ while (1) switch (_context53.prev = _context53.next) {
2182
2468
  case 0:
2183
2469
  pingSuccessPayload = {
2184
2470
  statusCode: 200
2185
2471
  };
2186
2472
  webex.request.mockResolvedValue(pingSuccessPayload);
2187
- _context46.next = 1;
2473
+ _context53.next = 1;
2188
2474
  return reg.isPrimaryActive();
2189
2475
  case 1:
2190
- status = _context46.sent;
2476
+ status = _context53.sent;
2191
2477
  expect(webex.request).toBeCalledWith(_objectSpread({
2192
2478
  method: 'GET',
2193
2479
  uri: "https://mobius-dfw.webex.com/api/v1/ping"
@@ -2195,23 +2481,23 @@ describe('Registration Tests', function () {
2195
2481
  expect(status).toEqual(true);
2196
2482
  case 2:
2197
2483
  case "end":
2198
- return _context46.stop();
2484
+ return _context53.stop();
2199
2485
  }
2200
- }, _callee46);
2486
+ }, _callee53);
2201
2487
  })));
2202
- it('failed: primary server status to be down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee47() {
2488
+ it('failed: primary server status to be down', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee54() {
2203
2489
  var pingFailurePayload, status;
2204
- return _regenerator.default.wrap(function (_context47) {
2205
- while (1) switch (_context47.prev = _context47.next) {
2490
+ return _regenerator.default.wrap(function (_context54) {
2491
+ while (1) switch (_context54.prev = _context54.next) {
2206
2492
  case 0:
2207
2493
  pingFailurePayload = {
2208
2494
  statusCode: 500
2209
2495
  };
2210
2496
  webex.request.mockResolvedValue(pingFailurePayload);
2211
- _context47.next = 1;
2497
+ _context54.next = 1;
2212
2498
  return reg.isPrimaryActive();
2213
2499
  case 1:
2214
- status = _context47.sent;
2500
+ status = _context54.sent;
2215
2501
  expect(webex.request).toBeCalledWith(_objectSpread({
2216
2502
  method: 'GET',
2217
2503
  uri: "https://mobius-dfw.webex.com/api/v1/ping"
@@ -2219,9 +2505,9 @@ describe('Registration Tests', function () {
2219
2505
  expect(status).toEqual(false);
2220
2506
  case 2:
2221
2507
  case "end":
2222
- return _context47.stop();
2508
+ return _context54.stop();
2223
2509
  }
2224
- }, _callee47);
2510
+ }, _callee54);
2225
2511
  })));
2226
2512
  });
2227
2513
  describe('handleRegistrationDownEvent tests', function () {
@@ -2241,20 +2527,20 @@ describe('Registration Tests', function () {
2241
2527
  }
2242
2528
  }
2243
2529
  };
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) {
2530
+ beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee55() {
2531
+ return _regenerator.default.wrap(function (_context55) {
2532
+ while (1) switch (_context55.prev = _context55.next) {
2247
2533
  case 0:
2248
2534
  postRegistrationSpy.mockResolvedValueOnce(successPayload);
2249
- _context48.next = 1;
2535
+ _context55.next = 1;
2250
2536
  return reg.triggerRegistration();
2251
2537
  case 1:
2252
2538
  expect(reg.getStatus()).toBe(_types.RegistrationStatus.ACTIVE);
2253
2539
  case 2:
2254
2540
  case "end":
2255
- return _context48.stop();
2541
+ return _context55.stop();
2256
2542
  }
2257
- }, _callee48);
2543
+ }, _callee55);
2258
2544
  })));
2259
2545
  afterEach(function () {
2260
2546
  var calls = (0, _values.default)(reg.callManager.getActiveCalls());
@@ -2263,10 +2549,10 @@ describe('Registration Tests', function () {
2263
2549
  });
2264
2550
  reg.callManager.callCollection = {};
2265
2551
  });
2266
- it('runs cleanup immediately when no active calls are present (socket disabled)', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee49() {
2552
+ it('runs cleanup immediately when no active calls are present (socket disabled)', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee56() {
2267
2553
  var clearKeepaliveSpy, setStatusSpy, disconnectSocketSpy;
2268
- return _regenerator.default.wrap(function (_context49) {
2269
- while (1) switch (_context49.prev = _context49.next) {
2554
+ return _regenerator.default.wrap(function (_context56) {
2555
+ while (1) switch (_context56.prev = _context56.next) {
2270
2556
  case 0:
2271
2557
  clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
2272
2558
  setStatusSpy = jest.spyOn(reg, 'setStatus');
@@ -2275,7 +2561,7 @@ describe('Registration Tests', function () {
2275
2561
  }), 'disconnectFromMobiusSocket');
2276
2562
  lineEmitter.mockClear();
2277
2563
  expect((0, _keys.default)(reg.callManager.getActiveCalls()).length).toBe(0);
2278
- _context49.next = 1;
2564
+ _context56.next = 1;
2279
2565
  return reg.handleRegistrationDownEvent(registrationDownEvent);
2280
2566
  case 1:
2281
2567
  expect(clearKeepaliveSpy).toHaveBeenCalled();
@@ -2291,14 +2577,14 @@ describe('Registration Tests', function () {
2291
2577
  expect(lineEmitter).toHaveBeenCalledWith(_types4.LINE_EVENTS.UNREGISTERED, undefined, undefined);
2292
2578
  case 2:
2293
2579
  case "end":
2294
- return _context49.stop();
2580
+ return _context56.stop();
2295
2581
  }
2296
- }, _callee49);
2582
+ }, _callee56);
2297
2583
  })));
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() {
2584
+ it('ends the active call and still runs cleanup when an active call is present', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee57() {
2299
2585
  var clearKeepaliveSpy, setStatusSpy, activeCall, endSpy;
2300
- return _regenerator.default.wrap(function (_context50) {
2301
- while (1) switch (_context50.prev = _context50.next) {
2586
+ return _regenerator.default.wrap(function (_context57) {
2587
+ while (1) switch (_context57.prev = _context57.next) {
2302
2588
  case 0:
2303
2589
  clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
2304
2590
  setStatusSpy = jest.spyOn(reg, 'setStatus');
@@ -2306,7 +2592,7 @@ describe('Registration Tests', function () {
2306
2592
  endSpy = jest.spyOn(activeCall, 'end');
2307
2593
  expect((0, _keys.default)(reg.callManager.getActiveCalls()).length).toBe(1);
2308
2594
  lineEmitter.mockClear();
2309
- _context50.next = 1;
2595
+ _context57.next = 1;
2310
2596
  return reg.handleRegistrationDownEvent(registrationDownEvent);
2311
2597
  case 1:
2312
2598
  expect(endSpy).toHaveBeenCalledTimes(1);
@@ -2316,18 +2602,18 @@ describe('Registration Tests', function () {
2316
2602
  expect(lineEmitter).toHaveBeenCalledWith(_types4.LINE_EVENTS.UNREGISTERED, undefined, undefined);
2317
2603
  case 2:
2318
2604
  case "end":
2319
- return _context50.stop();
2605
+ return _context57.stop();
2320
2606
  }
2321
- }, _callee50);
2607
+ }, _callee57);
2322
2608
  })));
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() {
2609
+ it('runs cleanup without calling end when no active call is present on re-invocation', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee58() {
2324
2610
  var clearKeepaliveSpy, setStatusSpy;
2325
- return _regenerator.default.wrap(function (_context51) {
2326
- while (1) switch (_context51.prev = _context51.next) {
2611
+ return _regenerator.default.wrap(function (_context58) {
2612
+ while (1) switch (_context58.prev = _context58.next) {
2327
2613
  case 0:
2328
2614
  clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
2329
2615
  setStatusSpy = jest.spyOn(reg, 'setStatus');
2330
- _context51.next = 1;
2616
+ _context58.next = 1;
2331
2617
  return reg.handleRegistrationDownEvent(registrationDownEvent);
2332
2618
  case 1:
2333
2619
  expect(reg.getStatus()).toBe(_types.RegistrationStatus.INACTIVE);
@@ -2335,7 +2621,7 @@ describe('Registration Tests', function () {
2335
2621
  setStatusSpy.mockClear();
2336
2622
  lineEmitter.mockClear();
2337
2623
  expect((0, _keys.default)(reg.callManager.getActiveCalls()).length).toBe(0);
2338
- _context51.next = 2;
2624
+ _context58.next = 2;
2339
2625
  return reg.handleRegistrationDownEvent(registrationDownEvent);
2340
2626
  case 2:
2341
2627
  expect(clearKeepaliveSpy).toHaveBeenCalled();
@@ -2344,14 +2630,14 @@ describe('Registration Tests', function () {
2344
2630
  expect(lineEmitter).toHaveBeenCalledWith(_types4.LINE_EVENTS.UNREGISTERED, undefined, undefined);
2345
2631
  case 3:
2346
2632
  case "end":
2347
- return _context51.stop();
2633
+ return _context58.stop();
2348
2634
  }
2349
- }, _callee51);
2635
+ }, _callee58);
2350
2636
  })));
2351
- it('disconnects the Mobius WebSocket when socket is enabled', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee52() {
2637
+ it('disconnects the Mobius WebSocket when socket is enabled', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee59() {
2352
2638
  var apiRequest, disconnectSocketSpy;
2353
- return _regenerator.default.wrap(function (_context52) {
2354
- while (1) switch (_context52.prev = _context52.next) {
2639
+ return _regenerator.default.wrap(function (_context59) {
2640
+ while (1) switch (_context59.prev = _context59.next) {
2355
2641
  case 0:
2356
2642
  apiRequest = _request.APIRequest.getInstance({
2357
2643
  webex: webex
@@ -2360,7 +2646,7 @@ describe('Registration Tests', function () {
2360
2646
  disconnectSocketSpy = jest.spyOn(apiRequest, 'disconnectFromMobiusSocket').mockResolvedValue();
2361
2647
  lineEmitter.mockClear();
2362
2648
  expect((0, _keys.default)(reg.callManager.getActiveCalls()).length).toBe(0);
2363
- _context52.next = 1;
2649
+ _context59.next = 1;
2364
2650
  return reg.handleRegistrationDownEvent(registrationDownEvent);
2365
2651
  case 1:
2366
2652
  expect(disconnectSocketSpy).toHaveBeenCalledWith({
@@ -2371,14 +2657,14 @@ describe('Registration Tests', function () {
2371
2657
  expect(lineEmitter).toHaveBeenCalledWith(_types4.LINE_EVENTS.UNREGISTERED, undefined, undefined);
2372
2658
  case 2:
2373
2659
  case "end":
2374
- return _context52.stop();
2660
+ return _context59.stop();
2375
2661
  }
2376
- }, _callee52);
2662
+ }, _callee59);
2377
2663
  })));
2378
- it('still emits UNREGISTERED when socket disconnect fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee53() {
2664
+ it('still emits UNREGISTERED when socket disconnect fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee60() {
2379
2665
  var apiRequest, disconnectSocketSpy;
2380
- return _regenerator.default.wrap(function (_context53) {
2381
- while (1) switch (_context53.prev = _context53.next) {
2666
+ return _regenerator.default.wrap(function (_context60) {
2667
+ while (1) switch (_context60.prev = _context60.next) {
2382
2668
  case 0:
2383
2669
  apiRequest = _request.APIRequest.getInstance({
2384
2670
  webex: webex
@@ -2386,7 +2672,7 @@ describe('Registration Tests', function () {
2386
2672
  jest.spyOn(apiRequest, 'isSocketEnabled').mockReturnValue(true);
2387
2673
  disconnectSocketSpy = jest.spyOn(apiRequest, 'disconnectFromMobiusSocket').mockRejectedValue(new Error('socket teardown failed'));
2388
2674
  lineEmitter.mockClear();
2389
- _context53.next = 1;
2675
+ _context60.next = 1;
2390
2676
  return reg.handleRegistrationDownEvent(registrationDownEvent);
2391
2677
  case 1:
2392
2678
  expect(disconnectSocketSpy).toHaveBeenCalled();
@@ -2398,9 +2684,9 @@ describe('Registration Tests', function () {
2398
2684
  expect(lineEmitter).toHaveBeenCalledWith(_types4.LINE_EVENTS.UNREGISTERED, undefined, undefined);
2399
2685
  case 2:
2400
2686
  case "end":
2401
- return _context53.stop();
2687
+ return _context60.stop();
2402
2688
  }
2403
- }, _callee53);
2689
+ }, _callee60);
2404
2690
  })));
2405
2691
  });
2406
2692
  describe('attemptRegistrationWithServers transport alignment', function () {
@@ -2415,61 +2701,61 @@ describe('Registration Tests', function () {
2415
2701
  setSocketEnabledSpy = jest.spyOn(apiRequest, 'setSocketEnabled').mockImplementation(function () {});
2416
2702
  webex.request.mockResolvedValue(successPayload);
2417
2703
  });
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) {
2704
+ it('enables the WebSocket transport when the server group uses the wss:// scheme', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee61() {
2705
+ return _regenerator.default.wrap(function (_context61) {
2706
+ while (1) switch (_context61.prev = _context61.next) {
2421
2707
  case 0:
2422
- _context54.next = 1;
2708
+ _context61.next = 1;
2423
2709
  return reg.attemptRegistrationWithServers(_constants.REGISTRATION_UTIL, ['wss://mobius.example.com/api/v1/calling/web/']);
2424
2710
  case 1:
2425
2711
  expect(setSocketEnabledSpy).toHaveBeenCalledWith(true);
2426
2712
  case 2:
2427
2713
  case "end":
2428
- return _context54.stop();
2714
+ return _context61.stop();
2429
2715
  }
2430
- }, _callee54);
2716
+ }, _callee61);
2431
2717
  })));
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) {
2718
+ it('falls back to the HTTP transport when the server group uses the https:// scheme', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee62() {
2719
+ return _regenerator.default.wrap(function (_context62) {
2720
+ while (1) switch (_context62.prev = _context62.next) {
2435
2721
  case 0:
2436
- _context55.next = 1;
2722
+ _context62.next = 1;
2437
2723
  return reg.attemptRegistrationWithServers(_constants.REGISTRATION_UTIL, ['https://mobius.example.com/api/v1/calling/web/']);
2438
2724
  case 1:
2439
2725
  expect(setSocketEnabledSpy).toHaveBeenCalledWith(false);
2440
2726
  case 2:
2441
2727
  case "end":
2442
- return _context55.stop();
2728
+ return _context62.stop();
2443
2729
  }
2444
- }, _callee55);
2730
+ }, _callee62);
2445
2731
  })));
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) {
2732
+ it('does not change the transport when the server group is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee63() {
2733
+ return _regenerator.default.wrap(function (_context63) {
2734
+ while (1) switch (_context63.prev = _context63.next) {
2449
2735
  case 0:
2450
- _context56.next = 1;
2736
+ _context63.next = 1;
2451
2737
  return reg.attemptRegistrationWithServers(_constants.REGISTRATION_UTIL, []);
2452
2738
  case 1:
2453
2739
  expect(setSocketEnabledSpy).not.toHaveBeenCalled();
2454
2740
  case 2:
2455
2741
  case "end":
2456
- return _context56.stop();
2742
+ return _context63.stop();
2457
2743
  }
2458
- }, _callee56);
2744
+ }, _callee63);
2459
2745
  })));
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) {
2746
+ it('derives the transport from the first server in the group', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee64() {
2747
+ return _regenerator.default.wrap(function (_context64) {
2748
+ while (1) switch (_context64.prev = _context64.next) {
2463
2749
  case 0:
2464
- _context57.next = 1;
2750
+ _context64.next = 1;
2465
2751
  return reg.attemptRegistrationWithServers(_constants.REGISTRATION_UTIL, ['wss://primary.example.com/api/v1/calling/web/', 'https://backup.example.com/api/v1/calling/web/']);
2466
2752
  case 1:
2467
2753
  expect(setSocketEnabledSpy).toHaveBeenCalledWith(true);
2468
2754
  case 2:
2469
2755
  case "end":
2470
- return _context57.stop();
2756
+ return _context64.stop();
2471
2757
  }
2472
- }, _callee57);
2758
+ }, _callee64);
2473
2759
  })));
2474
2760
  });
2475
2761
  });