@webex/plugin-meetings 3.12.0-llmrefactor.11 → 3.12.0-llmrefactor.13

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.
@@ -4341,6 +4341,296 @@ describe('plugin-meetings', () => {
4341
4341
  assert.calledOnceWithExactly(meeting.meetingRequest.getLocusDTO, {url: fakeLocus.url});
4342
4342
  });
4343
4343
 
4344
+ describe('#sync', () => {
4345
+ it('pauses the parser and awaits the Locus sync for classic meetings when canSyncClassicLocus is true', async () => {
4346
+ const fakeFullLocusDto = {id: 'fake full locus dto'};
4347
+ const meeting = {
4348
+ meetingRequest: {
4349
+ getLocusDTO: sandbox.stub().resolves({body: fakeFullLocusDto}),
4350
+ },
4351
+ locusInfo: {
4352
+ onFullLocus: sandbox.stub(),
4353
+ },
4354
+ locusUrl: 'someLocusUrl',
4355
+ };
4356
+
4357
+ locusInfo.locusParser.workingCopy = {}; // no syncUrl -> full sync
4358
+ sandbox.stub(locusInfo.locusParser, 'pause');
4359
+ sandbox.stub(locusInfo.locusParser, 'resume');
4360
+
4361
+ await locusInfo.sync(meeting, {canSyncClassicLocus: true, canSyncHashTree: true});
4362
+
4363
+ assert.calledOnce(locusInfo.locusParser.pause);
4364
+ assert.calledOnceWithExactly(meeting.meetingRequest.getLocusDTO, {url: 'someLocusUrl'});
4365
+ // sync() must not resolve until the fetched DTO has been applied
4366
+ assert.calledOnceWithExactly(
4367
+ meeting.locusInfo.onFullLocus,
4368
+ 'classic Locus sync',
4369
+ fakeFullLocusDto
4370
+ );
4371
+ assert.calledOnce(locusInfo.locusParser.resume);
4372
+ });
4373
+
4374
+ it('does nothing for classic meetings when the meeting has no Locus URL', async () => {
4375
+ const meeting = {
4376
+ meetingRequest: {
4377
+ getLocusDTO: sandbox.stub().resolves({body: {}}),
4378
+ },
4379
+ locusUrl: undefined,
4380
+ };
4381
+
4382
+ locusInfo.locusParser.workingCopy = {};
4383
+ sandbox.stub(locusInfo.locusParser, 'pause');
4384
+
4385
+ await locusInfo.sync(meeting, {canSyncClassicLocus: true, canSyncHashTree: true});
4386
+
4387
+ assert.notCalled(locusInfo.locusParser.pause);
4388
+ assert.notCalled(meeting.meetingRequest.getLocusDTO);
4389
+ });
4390
+
4391
+ it('does nothing for classic meetings when canSyncClassicLocus is false', async () => {
4392
+ const meeting = {
4393
+ meetingRequest: {
4394
+ getLocusDTO: sandbox.stub().resolves({body: {}}),
4395
+ },
4396
+ locusUrl: 'someLocusUrl',
4397
+ };
4398
+
4399
+ locusInfo.locusParser.workingCopy = {};
4400
+ sandbox.stub(locusInfo.locusParser, 'pause');
4401
+
4402
+ await locusInfo.sync(meeting, {canSyncClassicLocus: false, canSyncHashTree: true});
4403
+
4404
+ assert.notCalled(locusInfo.locusParser.pause);
4405
+ assert.notCalled(meeting.meetingRequest.getLocusDTO);
4406
+ });
4407
+
4408
+ it('syncs hash tree datasets and never does a classic Locus sync for hash tree based meetings', async () => {
4409
+ const parser = {syncAllDatasets: sandbox.stub().resolves()};
4410
+ const meeting = {
4411
+ meetingRequest: {
4412
+ getLocusDTO: sandbox.stub().resolves({body: {}}),
4413
+ },
4414
+ };
4415
+
4416
+ locusInfo.hashTreeParsers.set('someLocusUrl', {parser});
4417
+ sandbox.stub(locusInfo.locusParser, 'pause');
4418
+
4419
+ await locusInfo.sync(meeting, {canSyncClassicLocus: true, canSyncHashTree: true});
4420
+
4421
+ assert.calledOnce(parser.syncAllDatasets);
4422
+ assert.notCalled(locusInfo.locusParser.pause);
4423
+ assert.notCalled(meeting.meetingRequest.getLocusDTO);
4424
+ });
4425
+
4426
+ it('does not sync hash tree datasets when canSyncHashTree is false', async () => {
4427
+ const parser = {syncAllDatasets: sandbox.stub().resolves()};
4428
+ const meeting = {
4429
+ meetingRequest: {
4430
+ getLocusDTO: sandbox.stub().resolves({body: {}}),
4431
+ },
4432
+ };
4433
+
4434
+ locusInfo.hashTreeParsers.set('someLocusUrl', {parser});
4435
+ sandbox.stub(locusInfo.locusParser, 'pause');
4436
+
4437
+ await locusInfo.sync(meeting, {canSyncClassicLocus: true, canSyncHashTree: false});
4438
+
4439
+ assert.notCalled(parser.syncAllDatasets);
4440
+ assert.notCalled(locusInfo.locusParser.pause);
4441
+ assert.notCalled(meeting.meetingRequest.getLocusDTO);
4442
+ });
4443
+
4444
+ it('preserves the meeting and rejects when the classic sync fails, so the caller can retry', async () => {
4445
+ const fetchError = new Error('transient failure');
4446
+ const meeting = {
4447
+ meetingRequest: {
4448
+ getLocusDTO: sandbox.stub().rejects(fetchError),
4449
+ },
4450
+ locusInfo: {
4451
+ onFullLocus: sandbox.stub(),
4452
+ },
4453
+ locusUrl: 'someLocusUrl',
4454
+ };
4455
+
4456
+ locusInfo.locusParser.workingCopy = {}; // no syncUrl -> full sync
4457
+ sandbox.stub(locusInfo.locusParser, 'pause');
4458
+ sandbox.stub(locusInfo.locusParser, 'resume');
4459
+ sandbox.stub(webex.meetings, 'destroy');
4460
+
4461
+ await assert.isRejected(
4462
+ locusInfo.sync(meeting, {canSyncClassicLocus: true, canSyncHashTree: true}),
4463
+ fetchError
4464
+ );
4465
+
4466
+ // the meeting must not be torn down on a transient reconnection sync failure
4467
+ assert.notCalled(webex.meetings.destroy);
4468
+ // the parser must still be resumed so it isn't left paused
4469
+ assert.calledOnce(locusInfo.locusParser.resume);
4470
+ });
4471
+
4472
+ it('destroys the meeting and resolves when the classic sync gets a terminal 403, so the caller does not retry', async () => {
4473
+ const fake403Error = new Error('meeting ended');
4474
+ fake403Error.statusCode = 403;
4475
+ const meeting = {
4476
+ correlationId: 'correlationId',
4477
+ meetingRequest: {
4478
+ getLocusDTO: sandbox.stub().rejects(fake403Error),
4479
+ },
4480
+ locusInfo: {
4481
+ onFullLocus: sandbox.stub(),
4482
+ },
4483
+ locusUrl: 'someLocusUrl',
4484
+ };
4485
+
4486
+ locusInfo.locusParser.workingCopy = {syncUrl: 'deltaSyncUrl'}; // delta sync -> 403 is terminal
4487
+ sandbox.stub(locusInfo.locusParser, 'pause');
4488
+ sandbox.stub(locusInfo.locusParser, 'resume');
4489
+ sandbox.stub(webex.meetings, 'destroy');
4490
+
4491
+ // a terminal 403 means the meeting has ended, so the sync must resolve (not reject),
4492
+ // otherwise the reconnection flow would retry indefinitely
4493
+ await locusInfo.sync(meeting, {canSyncClassicLocus: true, canSyncHashTree: true});
4494
+
4495
+ assert.calledOnceWithExactly(webex.meetings.destroy, meeting, 'LOCUS_DTO_SYNC_FAILED');
4496
+ // meeting was destroyed, so the parser is not resumed
4497
+ assert.notCalled(locusInfo.locusParser.resume);
4498
+ });
4499
+
4500
+ it('destroys the meeting and resolves when the fallback full sync gets a terminal 403, so the caller does not retry', async () => {
4501
+ const fakeDeltaError = new Error('delta failed');
4502
+ fakeDeltaError.statusCode = 500;
4503
+ const fake403Error = new Error('meeting ended');
4504
+ fake403Error.statusCode = 403;
4505
+ const getLocusDTO = sandbox.stub();
4506
+ getLocusDTO.onCall(0).rejects(fakeDeltaError); // delta sync fails with non-403
4507
+ getLocusDTO.onCall(1).rejects(fake403Error); // fallback full sync fails with 403
4508
+ const meeting = {
4509
+ correlationId: 'correlationId',
4510
+ meetingRequest: {
4511
+ getLocusDTO,
4512
+ },
4513
+ locusInfo: {
4514
+ onFullLocus: sandbox.stub(),
4515
+ },
4516
+ locusUrl: 'someLocusUrl',
4517
+ };
4518
+
4519
+ locusInfo.locusParser.workingCopy = {syncUrl: 'deltaSyncUrl'}; // delta sync -> fallback to full sync
4520
+ sandbox.stub(locusInfo.locusParser, 'pause');
4521
+ sandbox.stub(locusInfo.locusParser, 'resume');
4522
+ sandbox.stub(webex.meetings, 'destroy');
4523
+
4524
+ // a terminal 403 from the fallback full sync means the meeting has ended, so the sync must
4525
+ // resolve (not reject), otherwise the reconnection flow would retry indefinitely
4526
+ await locusInfo.sync(meeting, {canSyncClassicLocus: true, canSyncHashTree: true});
4527
+
4528
+ assert.calledTwice(getLocusDTO);
4529
+ assert.deepEqual(getLocusDTO.getCalls()[0].args, [{url: 'deltaSyncUrl'}]);
4530
+ assert.deepEqual(getLocusDTO.getCalls()[1].args, [{url: 'someLocusUrl'}]);
4531
+ assert.calledOnceWithExactly(webex.meetings.destroy, meeting, 'LOCUS_DTO_SYNC_FAILED');
4532
+ // meeting was destroyed, so the parser is not resumed
4533
+ assert.notCalled(locusInfo.locusParser.resume);
4534
+ });
4535
+
4536
+ it('destroys the meeting and resolves when the direct full sync (no delta syncUrl) gets a terminal 403, so the caller does not retry', async () => {
4537
+ const fake403Error = new Error('meeting ended');
4538
+ fake403Error.statusCode = 403;
4539
+ const meeting = {
4540
+ correlationId: 'correlationId',
4541
+ meetingRequest: {
4542
+ getLocusDTO: sandbox.stub().rejects(fake403Error),
4543
+ },
4544
+ locusInfo: {
4545
+ onFullLocus: sandbox.stub(),
4546
+ },
4547
+ locusUrl: 'someLocusUrl',
4548
+ };
4549
+
4550
+ locusInfo.locusParser.workingCopy = {}; // no syncUrl -> direct full sync, 403 is terminal
4551
+ sandbox.stub(locusInfo.locusParser, 'pause');
4552
+ sandbox.stub(locusInfo.locusParser, 'resume');
4553
+ sandbox.stub(webex.meetings, 'destroy');
4554
+
4555
+ // a terminal 403 from the direct full sync means the meeting has ended, so the sync must
4556
+ // resolve (not reject), otherwise the reconnection flow would retry indefinitely
4557
+ await locusInfo.sync(meeting, {canSyncClassicLocus: true, canSyncHashTree: true});
4558
+
4559
+ assert.calledOnceWithExactly(meeting.meetingRequest.getLocusDTO, {url: 'someLocusUrl'});
4560
+ assert.calledOnceWithExactly(webex.meetings.destroy, meeting, 'LOCUS_DTO_SYNC_FAILED');
4561
+ // meeting was destroyed, so the parser is not resumed
4562
+ assert.notCalled(locusInfo.locusParser.resume);
4563
+ });
4564
+ });
4565
+
4566
+ describe('#doLocusSync', () => {
4567
+ it('resolves without destroying the meeting when the DTO is fetched but applying it fails and destroyOnTransientFailure is true', async () => {
4568
+ const fakeFullLocusDto = {id: 'fake full locus dto'};
4569
+ const applyError = new Error('failed to apply DTO');
4570
+ const meeting = {
4571
+ correlationId: 'correlationId',
4572
+ meetingRequest: {
4573
+ getLocusDTO: sandbox.stub().resolves({body: fakeFullLocusDto}),
4574
+ },
4575
+ locusInfo: {
4576
+ onFullLocus: sandbox.stub().throws(applyError),
4577
+ },
4578
+ locusUrl: 'someLocusUrl',
4579
+ };
4580
+
4581
+ locusInfo.locusParser.workingCopy = {}; // no syncUrl -> full sync
4582
+ sandbox.stub(locusInfo.locusParser, 'resume');
4583
+ sandbox.stub(webex.meetings, 'destroy');
4584
+
4585
+ // destroyOnTransientFailure defaults to true: a successfully fetched DTO that then fails to
4586
+ // apply must not reject or destroy the meeting - doLocusSync just resumes the parser and
4587
+ // resolves (the returned promise must not reject)
4588
+ await locusInfo.doLocusSync(meeting, false, undefined);
4589
+
4590
+ assert.calledOnceWithExactly(
4591
+ meeting.locusInfo.onFullLocus,
4592
+ 'classic Locus sync',
4593
+ fakeFullLocusDto
4594
+ );
4595
+ assert.notCalled(webex.meetings.destroy);
4596
+ assert.calledOnce(locusInfo.locusParser.resume);
4597
+ });
4598
+
4599
+ it('resolves (does not reject) when the DTO is fetched but applying it fails even when destroyOnTransientFailure is false, so the sync is not retried indefinitely', async () => {
4600
+ const fakeFullLocusDto = {id: 'fake full locus dto'};
4601
+ const applyError = new Error('failed to apply DTO');
4602
+ const meeting = {
4603
+ correlationId: 'correlationId',
4604
+ meetingRequest: {
4605
+ getLocusDTO: sandbox.stub().resolves({body: fakeFullLocusDto}),
4606
+ },
4607
+ locusInfo: {
4608
+ onFullLocus: sandbox.stub().throws(applyError),
4609
+ },
4610
+ locusUrl: 'someLocusUrl',
4611
+ };
4612
+
4613
+ locusInfo.locusParser.workingCopy = {}; // no syncUrl -> full sync
4614
+ sandbox.stub(locusInfo.locusParser, 'resume');
4615
+ sandbox.stub(webex.meetings, 'destroy');
4616
+
4617
+ // Even on the caller-driven (reconnection) path (destroyOnTransientFailure: false), an
4618
+ // application failure must not reject: retrying would re-fetch and re-apply the same
4619
+ // unprocessable DTO, so doLocusSync just resumes the parser and resolves.
4620
+ await locusInfo.doLocusSync(meeting, false, undefined, {
4621
+ destroyOnTransientFailure: false,
4622
+ });
4623
+
4624
+ assert.calledOnceWithExactly(
4625
+ meeting.locusInfo.onFullLocus,
4626
+ 'classic Locus sync',
4627
+ fakeFullLocusDto
4628
+ );
4629
+ assert.notCalled(webex.meetings.destroy);
4630
+ assert.calledOnce(locusInfo.locusParser.resume);
4631
+ });
4632
+ });
4633
+
4344
4634
  describe('edge cases for sync failing', () => {
4345
4635
  const {DESYNC} = LocusDeltaParser.loci;
4346
4636
  const fakeFullLocusDto = {id: 'fake full locus dto'};
@@ -95,6 +95,7 @@ describe('plugin-meetings', () => {
95
95
  parse: sinon.stub().returns(true),
96
96
  updateMainSessionLocusCache: sinon.stub(),
97
97
  syncAllHashTreeDatasets: sinon.stub(),
98
+ sync: sinon.stub().resolves(),
98
99
  };
99
100
  webex = new MockWebex({
100
101
  children: {
@@ -1484,7 +1485,7 @@ describe('plugin-meetings', () => {
1484
1485
  it('should have #syncMeetings', () => {
1485
1486
  assert.exists(webex.meetings.syncMeetings);
1486
1487
  });
1487
- it('should skip getActiveMeetings but still call syncAllHashTreeDatasets if unverified guest', async () => {
1488
+ it('should skip getActiveMeetings but still sync each meeting with canSyncClassicLocus enabled if unverified guest', async () => {
1488
1489
  webex.meetings.request.getActiveMeetings = sinon.stub().returns(
1489
1490
  Promise.resolve({
1490
1491
  loci: [
@@ -1498,10 +1499,11 @@ describe('plugin-meetings', () => {
1498
1499
  LoggerProxy.logger.info = sinon.stub();
1499
1500
 
1500
1501
  const mockLocusInfo = {
1501
- syncAllHashTreeDatasets: sinon.stub().resolves(),
1502
+ sync: sinon.stub().resolves(),
1502
1503
  };
1504
+ const meeting1 = {locusInfo: mockLocusInfo};
1503
1505
  webex.meetings.meetingCollection.getAll = sinon.stub().returns({
1504
- meeting1: {locusInfo: mockLocusInfo},
1506
+ meeting1,
1505
1507
  meeting2: {locusInfo: undefined},
1506
1508
  meeting3: {},
1507
1509
  });
@@ -1513,7 +1515,10 @@ describe('plugin-meetings', () => {
1513
1515
  LoggerProxy.logger.info,
1514
1516
  'Meetings:index#syncMeetings --> user is unverified guest, skipping calling Locus for meeting sync'
1515
1517
  );
1516
- assert.calledOnce(mockLocusInfo.syncAllHashTreeDatasets);
1518
+ assert.calledOnceWithExactly(mockLocusInfo.sync, meeting1, {
1519
+ canSyncClassicLocus: true,
1520
+ canSyncHashTree: true,
1521
+ });
1517
1522
  });
1518
1523
  describe('succesful requests', () => {
1519
1524
  beforeEach(() => {
@@ -1542,7 +1547,11 @@ describe('plugin-meetings', () => {
1542
1547
  assert.calledOnce(webex.meetings.meetingCollection.getByKey);
1543
1548
  assert.calledOnce(locusInfo.parse);
1544
1549
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
1545
- assert.calledOnce(locusInfo.syncAllHashTreeDatasets);
1550
+ assert.calledOnceWithExactly(
1551
+ locusInfo.sync,
1552
+ {locusInfo, locusUrl: url1},
1553
+ {canSyncClassicLocus: false, canSyncHashTree: true}
1554
+ );
1546
1555
  });
1547
1556
  });
1548
1557
  describe('when meeting is not returned', () => {
@@ -1679,7 +1688,7 @@ describe('plugin-meetings', () => {
1679
1688
  locusUrl: 'breakout-url',
1680
1689
  locusInfo: {
1681
1690
  info: {globalMeetingId: 'gmid-123'},
1682
- syncAllHashTreeDatasets: sinon.stub().resolves(),
1691
+ sync: sinon.stub().resolves(),
1683
1692
  },
1684
1693
  sendCallAnalyzerMetrics: sinon.stub(),
1685
1694
  },
@@ -1703,7 +1712,7 @@ describe('plugin-meetings', () => {
1703
1712
  locusUrl: 'breakout-url',
1704
1713
  locusInfo: {
1705
1714
  info: {globalMeetingId: 'gmid-other'},
1706
- syncAllHashTreeDatasets: sinon.stub().resolves(),
1715
+ sync: sinon.stub().resolves(),
1707
1716
  },
1708
1717
  sendCallAnalyzerMetrics: sinon.stub(),
1709
1718
  },
@@ -1724,46 +1733,54 @@ describe('plugin-meetings', () => {
1724
1733
  });
1725
1734
 
1726
1735
  describe('skipHashTreeSync parameter', () => {
1727
- it('should skip syncAllHashTreeDatasets when skipHashTreeSync is true', async () => {
1736
+ it('should pass canSyncHashTree:false to locusInfo.sync when skipHashTreeSync is true', async () => {
1728
1737
  const mockLocusInfo = {
1729
- syncAllHashTreeDatasets: sinon.stub().resolves(),
1738
+ sync: sinon.stub().resolves(),
1730
1739
  };
1740
+ const meeting1 = {locusInfo: mockLocusInfo};
1731
1741
 
1732
1742
  webex.meetings.request.getActiveMeetings = sinon.stub().resolves({loci: []});
1733
1743
  webex.meetings.meetingCollection.getAll = sinon.stub().returns({
1734
- meeting1: {locusInfo: mockLocusInfo},
1744
+ meeting1,
1735
1745
  });
1736
1746
 
1737
1747
  await webex.meetings.syncMeetings({keepOnlyLocusMeetings: false, skipHashTreeSync: true});
1738
1748
 
1739
1749
  assert.calledOnce(webex.meetings.request.getActiveMeetings);
1740
- assert.notCalled(mockLocusInfo.syncAllHashTreeDatasets);
1750
+ assert.calledOnceWithExactly(mockLocusInfo.sync, meeting1, {
1751
+ canSyncClassicLocus: false,
1752
+ canSyncHashTree: false,
1753
+ });
1741
1754
  });
1742
1755
 
1743
- it('should call syncAllHashTreeDatasets when skipHashTreeSync is false (default)', async () => {
1756
+ it('should pass canSyncHashTree:true to locusInfo.sync when skipHashTreeSync is false (default)', async () => {
1744
1757
  const mockLocusInfo = {
1745
- syncAllHashTreeDatasets: sinon.stub().resolves(),
1758
+ sync: sinon.stub().resolves(),
1746
1759
  };
1760
+ const meeting1 = {locusInfo: mockLocusInfo};
1747
1761
 
1748
1762
  webex.meetings.request.getActiveMeetings = sinon.stub().resolves({loci: []});
1749
1763
  webex.meetings.meetingCollection.getAll = sinon.stub().returns({
1750
- meeting1: {locusInfo: mockLocusInfo},
1764
+ meeting1,
1751
1765
  });
1752
1766
 
1753
1767
  await webex.meetings.syncMeetings({keepOnlyLocusMeetings: false, skipHashTreeSync: false});
1754
1768
 
1755
1769
  assert.calledOnce(webex.meetings.request.getActiveMeetings);
1756
- assert.calledOnce(mockLocusInfo.syncAllHashTreeDatasets);
1770
+ assert.calledOnceWithExactly(mockLocusInfo.sync, meeting1, {
1771
+ canSyncClassicLocus: false,
1772
+ canSyncHashTree: true,
1773
+ });
1757
1774
  });
1758
1775
  });
1759
1776
 
1760
- describe('syncAllHashTreeDatasets in syncMeetings', () => {
1761
- it('should call syncAllHashTreeDatasets for multiple meetings, skipping those without locusInfo', async () => {
1777
+ describe('per-meeting sync in syncMeetings', () => {
1778
+ it('should call locusInfo.sync for multiple meetings, skipping those without locusInfo', async () => {
1762
1779
  const mockLocusInfo1 = {
1763
- syncAllHashTreeDatasets: sinon.stub().resolves(),
1780
+ sync: sinon.stub().resolves(),
1764
1781
  };
1765
1782
  const mockLocusInfo2 = {
1766
- syncAllHashTreeDatasets: sinon.stub().resolves(),
1783
+ sync: sinon.stub().resolves(),
1767
1784
  };
1768
1785
 
1769
1786
  webex.meetings.request.getActiveMeetings = sinon.stub().resolves({loci: []});
@@ -1776,13 +1793,21 @@ describe('plugin-meetings', () => {
1776
1793
 
1777
1794
  await webex.meetings.syncMeetings({keepOnlyLocusMeetings: false});
1778
1795
 
1779
- assert.calledOnce(mockLocusInfo1.syncAllHashTreeDatasets);
1780
- assert.calledOnce(mockLocusInfo2.syncAllHashTreeDatasets);
1796
+ assert.calledOnceWithExactly(
1797
+ mockLocusInfo1.sync,
1798
+ {locusInfo: mockLocusInfo1},
1799
+ {canSyncClassicLocus: false, canSyncHashTree: true}
1800
+ );
1801
+ assert.calledOnceWithExactly(
1802
+ mockLocusInfo2.sync,
1803
+ {locusInfo: mockLocusInfo2},
1804
+ {canSyncClassicLocus: false, canSyncHashTree: true}
1805
+ );
1781
1806
  });
1782
1807
 
1783
- it('should not call syncAllHashTreeDatasets when getActiveMeetings throws an error', async () => {
1808
+ it('should not call locusInfo.sync when getActiveMeetings throws an error', async () => {
1784
1809
  const mockLocusInfo = {
1785
- syncAllHashTreeDatasets: sinon.stub().resolves(),
1810
+ sync: sinon.stub().resolves(),
1786
1811
  };
1787
1812
 
1788
1813
  webex.meetings.request.getActiveMeetings = sinon.stub().rejects(new Error('network error'));
@@ -1797,7 +1822,7 @@ describe('plugin-meetings', () => {
1797
1822
  assert.equal(err.message, 'network error');
1798
1823
  }
1799
1824
 
1800
- assert.notCalled(mockLocusInfo.syncAllHashTreeDatasets);
1825
+ assert.notCalled(mockLocusInfo.sync);
1801
1826
  });
1802
1827
  });
1803
1828
  });
@@ -2261,6 +2286,28 @@ describe('plugin-meetings', () => {
2261
2286
  assert.calledWith(webex.internal.mercury.on, OFFLINE);
2262
2287
  assert.callCount(webex.internal.mercury.on, 4);
2263
2288
  });
2289
+
2290
+ it('handles a rejected syncMeetings when the ONLINE event fires so it does not become an unhandled rejection', async () => {
2291
+ const syncError = new Error('sync failed');
2292
+ sinon.stub(webex.meetings, 'syncMeetings').rejects(syncError);
2293
+ const loggerWarnStub = sinon.stub(LoggerProxy.logger, 'warn');
2294
+
2295
+ webex.meetings.listenForEvents();
2296
+
2297
+ const onlineCallback = webex.internal.mercury.on
2298
+ .getCalls()
2299
+ .find((call) => call.args[0] === ONLINE).args[1];
2300
+
2301
+ // invoking the listener must not throw synchronously nor leave a rejection unhandled
2302
+ onlineCallback();
2303
+
2304
+ assert.calledOnceWithExactly(webex.meetings.syncMeetings, {keepOnlyLocusMeetings: false});
2305
+
2306
+ await testUtils.flushPromises();
2307
+
2308
+ assert.calledOnce(loggerWarnStub);
2309
+ assert.include(loggerWarnStub.firstCall.args[0], 'syncMeetings after ONLINE event failed');
2310
+ });
2264
2311
  });
2265
2312
  describe('#handleLocusMercury', () => {
2266
2313
  beforeEach(() => {