@webex/plugin-meetings 3.12.0-next.139 → 3.12.0-next.140
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/aiEnableRequest/index.js +1 -1
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +1 -1
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/locus-info/index.js +200 -71
- package/dist/locus-info/index.js.map +1 -1
- package/dist/meetings/index.js +20 -8
- package/dist/meetings/index.js.map +1 -1
- package/dist/types/locus-info/index.d.ts +39 -1
- package/dist/types/meetings/index.d.ts +2 -1
- package/dist/webinar/index.js +1 -1
- package/package.json +1 -1
- package/src/locus-info/index.ts +135 -35
- package/src/meetings/index.ts +32 -15
- package/test/unit/spec/locus-info/index.js +290 -0
- package/test/unit/spec/meetings/index.js +71 -24
|
@@ -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: {
|
|
@@ -1479,7 +1480,7 @@ describe('plugin-meetings', () => {
|
|
|
1479
1480
|
it('should have #syncMeetings', () => {
|
|
1480
1481
|
assert.exists(webex.meetings.syncMeetings);
|
|
1481
1482
|
});
|
|
1482
|
-
it('should skip getActiveMeetings but still
|
|
1483
|
+
it('should skip getActiveMeetings but still sync each meeting with canSyncClassicLocus enabled if unverified guest', async () => {
|
|
1483
1484
|
webex.meetings.request.getActiveMeetings = sinon.stub().returns(
|
|
1484
1485
|
Promise.resolve({
|
|
1485
1486
|
loci: [
|
|
@@ -1493,10 +1494,11 @@ describe('plugin-meetings', () => {
|
|
|
1493
1494
|
LoggerProxy.logger.info = sinon.stub();
|
|
1494
1495
|
|
|
1495
1496
|
const mockLocusInfo = {
|
|
1496
|
-
|
|
1497
|
+
sync: sinon.stub().resolves(),
|
|
1497
1498
|
};
|
|
1499
|
+
const meeting1 = {locusInfo: mockLocusInfo};
|
|
1498
1500
|
webex.meetings.meetingCollection.getAll = sinon.stub().returns({
|
|
1499
|
-
meeting1
|
|
1501
|
+
meeting1,
|
|
1500
1502
|
meeting2: {locusInfo: undefined},
|
|
1501
1503
|
meeting3: {},
|
|
1502
1504
|
});
|
|
@@ -1508,7 +1510,10 @@ describe('plugin-meetings', () => {
|
|
|
1508
1510
|
LoggerProxy.logger.info,
|
|
1509
1511
|
'Meetings:index#syncMeetings --> user is unverified guest, skipping calling Locus for meeting sync'
|
|
1510
1512
|
);
|
|
1511
|
-
assert.
|
|
1513
|
+
assert.calledOnceWithExactly(mockLocusInfo.sync, meeting1, {
|
|
1514
|
+
canSyncClassicLocus: true,
|
|
1515
|
+
canSyncHashTree: true,
|
|
1516
|
+
});
|
|
1512
1517
|
});
|
|
1513
1518
|
describe('succesful requests', () => {
|
|
1514
1519
|
beforeEach(() => {
|
|
@@ -1537,7 +1542,11 @@ describe('plugin-meetings', () => {
|
|
|
1537
1542
|
assert.calledOnce(webex.meetings.meetingCollection.getByKey);
|
|
1538
1543
|
assert.calledOnce(locusInfo.parse);
|
|
1539
1544
|
assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
|
|
1540
|
-
assert.
|
|
1545
|
+
assert.calledOnceWithExactly(
|
|
1546
|
+
locusInfo.sync,
|
|
1547
|
+
{locusInfo, locusUrl: url1},
|
|
1548
|
+
{canSyncClassicLocus: false, canSyncHashTree: true}
|
|
1549
|
+
);
|
|
1541
1550
|
});
|
|
1542
1551
|
});
|
|
1543
1552
|
describe('when meeting is not returned', () => {
|
|
@@ -1674,7 +1683,7 @@ describe('plugin-meetings', () => {
|
|
|
1674
1683
|
locusUrl: 'breakout-url',
|
|
1675
1684
|
locusInfo: {
|
|
1676
1685
|
info: {globalMeetingId: 'gmid-123'},
|
|
1677
|
-
|
|
1686
|
+
sync: sinon.stub().resolves(),
|
|
1678
1687
|
},
|
|
1679
1688
|
sendCallAnalyzerMetrics: sinon.stub(),
|
|
1680
1689
|
},
|
|
@@ -1698,7 +1707,7 @@ describe('plugin-meetings', () => {
|
|
|
1698
1707
|
locusUrl: 'breakout-url',
|
|
1699
1708
|
locusInfo: {
|
|
1700
1709
|
info: {globalMeetingId: 'gmid-other'},
|
|
1701
|
-
|
|
1710
|
+
sync: sinon.stub().resolves(),
|
|
1702
1711
|
},
|
|
1703
1712
|
sendCallAnalyzerMetrics: sinon.stub(),
|
|
1704
1713
|
},
|
|
@@ -1719,46 +1728,54 @@ describe('plugin-meetings', () => {
|
|
|
1719
1728
|
});
|
|
1720
1729
|
|
|
1721
1730
|
describe('skipHashTreeSync parameter', () => {
|
|
1722
|
-
it('should
|
|
1731
|
+
it('should pass canSyncHashTree:false to locusInfo.sync when skipHashTreeSync is true', async () => {
|
|
1723
1732
|
const mockLocusInfo = {
|
|
1724
|
-
|
|
1733
|
+
sync: sinon.stub().resolves(),
|
|
1725
1734
|
};
|
|
1735
|
+
const meeting1 = {locusInfo: mockLocusInfo};
|
|
1726
1736
|
|
|
1727
1737
|
webex.meetings.request.getActiveMeetings = sinon.stub().resolves({loci: []});
|
|
1728
1738
|
webex.meetings.meetingCollection.getAll = sinon.stub().returns({
|
|
1729
|
-
meeting1
|
|
1739
|
+
meeting1,
|
|
1730
1740
|
});
|
|
1731
1741
|
|
|
1732
1742
|
await webex.meetings.syncMeetings({keepOnlyLocusMeetings: false, skipHashTreeSync: true});
|
|
1733
1743
|
|
|
1734
1744
|
assert.calledOnce(webex.meetings.request.getActiveMeetings);
|
|
1735
|
-
assert.
|
|
1745
|
+
assert.calledOnceWithExactly(mockLocusInfo.sync, meeting1, {
|
|
1746
|
+
canSyncClassicLocus: false,
|
|
1747
|
+
canSyncHashTree: false,
|
|
1748
|
+
});
|
|
1736
1749
|
});
|
|
1737
1750
|
|
|
1738
|
-
it('should
|
|
1751
|
+
it('should pass canSyncHashTree:true to locusInfo.sync when skipHashTreeSync is false (default)', async () => {
|
|
1739
1752
|
const mockLocusInfo = {
|
|
1740
|
-
|
|
1753
|
+
sync: sinon.stub().resolves(),
|
|
1741
1754
|
};
|
|
1755
|
+
const meeting1 = {locusInfo: mockLocusInfo};
|
|
1742
1756
|
|
|
1743
1757
|
webex.meetings.request.getActiveMeetings = sinon.stub().resolves({loci: []});
|
|
1744
1758
|
webex.meetings.meetingCollection.getAll = sinon.stub().returns({
|
|
1745
|
-
meeting1
|
|
1759
|
+
meeting1,
|
|
1746
1760
|
});
|
|
1747
1761
|
|
|
1748
1762
|
await webex.meetings.syncMeetings({keepOnlyLocusMeetings: false, skipHashTreeSync: false});
|
|
1749
1763
|
|
|
1750
1764
|
assert.calledOnce(webex.meetings.request.getActiveMeetings);
|
|
1751
|
-
assert.
|
|
1765
|
+
assert.calledOnceWithExactly(mockLocusInfo.sync, meeting1, {
|
|
1766
|
+
canSyncClassicLocus: false,
|
|
1767
|
+
canSyncHashTree: true,
|
|
1768
|
+
});
|
|
1752
1769
|
});
|
|
1753
1770
|
});
|
|
1754
1771
|
|
|
1755
|
-
describe('
|
|
1756
|
-
it('should call
|
|
1772
|
+
describe('per-meeting sync in syncMeetings', () => {
|
|
1773
|
+
it('should call locusInfo.sync for multiple meetings, skipping those without locusInfo', async () => {
|
|
1757
1774
|
const mockLocusInfo1 = {
|
|
1758
|
-
|
|
1775
|
+
sync: sinon.stub().resolves(),
|
|
1759
1776
|
};
|
|
1760
1777
|
const mockLocusInfo2 = {
|
|
1761
|
-
|
|
1778
|
+
sync: sinon.stub().resolves(),
|
|
1762
1779
|
};
|
|
1763
1780
|
|
|
1764
1781
|
webex.meetings.request.getActiveMeetings = sinon.stub().resolves({loci: []});
|
|
@@ -1771,13 +1788,21 @@ describe('plugin-meetings', () => {
|
|
|
1771
1788
|
|
|
1772
1789
|
await webex.meetings.syncMeetings({keepOnlyLocusMeetings: false});
|
|
1773
1790
|
|
|
1774
|
-
assert.
|
|
1775
|
-
|
|
1791
|
+
assert.calledOnceWithExactly(
|
|
1792
|
+
mockLocusInfo1.sync,
|
|
1793
|
+
{locusInfo: mockLocusInfo1},
|
|
1794
|
+
{canSyncClassicLocus: false, canSyncHashTree: true}
|
|
1795
|
+
);
|
|
1796
|
+
assert.calledOnceWithExactly(
|
|
1797
|
+
mockLocusInfo2.sync,
|
|
1798
|
+
{locusInfo: mockLocusInfo2},
|
|
1799
|
+
{canSyncClassicLocus: false, canSyncHashTree: true}
|
|
1800
|
+
);
|
|
1776
1801
|
});
|
|
1777
1802
|
|
|
1778
|
-
it('should not call
|
|
1803
|
+
it('should not call locusInfo.sync when getActiveMeetings throws an error', async () => {
|
|
1779
1804
|
const mockLocusInfo = {
|
|
1780
|
-
|
|
1805
|
+
sync: sinon.stub().resolves(),
|
|
1781
1806
|
};
|
|
1782
1807
|
|
|
1783
1808
|
webex.meetings.request.getActiveMeetings = sinon.stub().rejects(new Error('network error'));
|
|
@@ -1792,7 +1817,7 @@ describe('plugin-meetings', () => {
|
|
|
1792
1817
|
assert.equal(err.message, 'network error');
|
|
1793
1818
|
}
|
|
1794
1819
|
|
|
1795
|
-
assert.notCalled(mockLocusInfo.
|
|
1820
|
+
assert.notCalled(mockLocusInfo.sync);
|
|
1796
1821
|
});
|
|
1797
1822
|
});
|
|
1798
1823
|
});
|
|
@@ -2256,6 +2281,28 @@ describe('plugin-meetings', () => {
|
|
|
2256
2281
|
assert.calledWith(webex.internal.mercury.on, OFFLINE);
|
|
2257
2282
|
assert.callCount(webex.internal.mercury.on, 4);
|
|
2258
2283
|
});
|
|
2284
|
+
|
|
2285
|
+
it('handles a rejected syncMeetings when the ONLINE event fires so it does not become an unhandled rejection', async () => {
|
|
2286
|
+
const syncError = new Error('sync failed');
|
|
2287
|
+
sinon.stub(webex.meetings, 'syncMeetings').rejects(syncError);
|
|
2288
|
+
const loggerWarnStub = sinon.stub(LoggerProxy.logger, 'warn');
|
|
2289
|
+
|
|
2290
|
+
webex.meetings.listenForEvents();
|
|
2291
|
+
|
|
2292
|
+
const onlineCallback = webex.internal.mercury.on
|
|
2293
|
+
.getCalls()
|
|
2294
|
+
.find((call) => call.args[0] === ONLINE).args[1];
|
|
2295
|
+
|
|
2296
|
+
// invoking the listener must not throw synchronously nor leave a rejection unhandled
|
|
2297
|
+
onlineCallback();
|
|
2298
|
+
|
|
2299
|
+
assert.calledOnceWithExactly(webex.meetings.syncMeetings, {keepOnlyLocusMeetings: false});
|
|
2300
|
+
|
|
2301
|
+
await testUtils.flushPromises();
|
|
2302
|
+
|
|
2303
|
+
assert.calledOnce(loggerWarnStub);
|
|
2304
|
+
assert.include(loggerWarnStub.firstCall.args[0], 'syncMeetings after ONLINE event failed');
|
|
2305
|
+
});
|
|
2259
2306
|
});
|
|
2260
2307
|
describe('#handleLocusMercury', () => {
|
|
2261
2308
|
beforeEach(() => {
|