@webex/plugin-meetings 3.0.0-beta.180 → 3.0.0-beta.182

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.
@@ -1648,12 +1648,39 @@ describe('plugin-meetings', () => {
1648
1648
  sandbox.stub(locusInfo, 'updateParticipants');
1649
1649
  sandbox.stub(locusInfo, 'isMeetingActive');
1650
1650
  sandbox.stub(locusInfo, 'handleOneOnOneEvent');
1651
+ sandbox.stub(locusParser, 'isNewFullLocus').returns(true);
1651
1652
 
1652
1653
  locusInfo.onFullLocus(fakeLocus, eventType);
1653
1654
 
1654
1655
  assert.equal(fakeLocus, locusParser.workingCopy);
1655
1656
  });
1656
1657
 
1658
+ it('onFullLocus() does not do anything if the incoming full locus DTO is old', () => {
1659
+ const eventType = 'fakeEvent';
1660
+
1661
+ locusParser.workingCopy = {};
1662
+
1663
+ const oldWorkingCopy = locusParser.workingCopy;
1664
+
1665
+ const spies = [
1666
+ sandbox.stub(locusInfo, 'updateParticipantDeltas'),
1667
+ sandbox.stub(locusInfo, 'updateLocusInfo'),
1668
+ sandbox.stub(locusInfo, 'updateParticipants'),
1669
+ sandbox.stub(locusInfo, 'isMeetingActive'),
1670
+ sandbox.stub(locusInfo, 'handleOneOnOneEvent'),
1671
+ ];
1672
+
1673
+ sandbox.stub(locusParser, 'isNewFullLocus').returns(false);
1674
+
1675
+ locusInfo.onFullLocus(fakeLocus, eventType);
1676
+
1677
+ spies.forEach((spy) => {
1678
+ assert.notCalled(spy);
1679
+ })
1680
+
1681
+ assert.equal(oldWorkingCopy, locusParser.workingCopy);
1682
+ });
1683
+
1657
1684
  it('onDeltaAction applies locus delta data to meeting', () => {
1658
1685
  const action = 'fake action';
1659
1686
  const parsedLoci = 'fake loci';
@@ -238,6 +238,68 @@ describe('locus-info/parser', () => {
238
238
  });
239
239
  });
240
240
 
241
+ describe('Full Locus handling', () => {
242
+ describe('isNewFullLocus', () => {
243
+ let parser;
244
+
245
+ beforeEach(() => {
246
+ parser = new LocusDeltaParser();
247
+ })
248
+ it('returns false if incoming Locus is not valid', () => {
249
+ const fakeInvalidIncomingLocus = {};
250
+
251
+ parser.workingCopy = { sequence: {rangeStart: 0, rangeEnd: 0, entries: [1]}};
252
+
253
+ assert.isFalse(parser.isNewFullLocus(fakeInvalidIncomingLocus));
254
+ });
255
+
256
+ const runCheck = (incomingSequence, currentSequence, expectedResult) => {
257
+ parser.workingCopy = { sequence: {rangeStart: 0, rangeEnd: 0, entries: [1, 2, currentSequence]}};
258
+
259
+ const fakeIncomingLocus = { sequence: {rangeStart: 0, rangeEnd: 0, entries: [1, 10, incomingSequence]}};
260
+
261
+ assert.strictEqual(parser.isNewFullLocus(fakeIncomingLocus), expectedResult);
262
+ }
263
+ it('returns true if there is no working copy', () => {
264
+ const fakeIncomingLocus = { sequence: {rangeStart: 0, rangeEnd: 0, entries: [10]}};
265
+
266
+ // sanity check that we initially have no working copy
267
+ assert.isNull(parser.workingCopy);
268
+
269
+ assert.isTrue(parser.isNewFullLocus(fakeIncomingLocus));
270
+ });
271
+
272
+ it('returns true if new sequence is higher than existing one', () => {
273
+ runCheck(101, 100, true);
274
+ });
275
+
276
+ it('returns false if new sequence is same than existing one', () => {
277
+ runCheck(100, 100, false);
278
+ });
279
+
280
+ it('returns false if new sequence is older than existing one', () => {
281
+ runCheck(99, 100, false);
282
+ });
283
+
284
+ it('returns true if incoming Locus has empty sequence', () => {
285
+ parser.workingCopy = { sequence: {rangeStart: 0, rangeEnd: 0, entries: [1, 2, 3]}};
286
+
287
+ const fakeIncomingLocus = { sequence: {rangeStart: 0, rangeEnd: 0, entries: []}};
288
+
289
+ assert.isTrue(parser.isNewFullLocus(fakeIncomingLocus));
290
+ });
291
+
292
+ it('returns true if working copy has empty sequence', () => {
293
+ parser.workingCopy = { sequence: {rangeStart: 0, rangeEnd: 0, entries: []}};
294
+
295
+ const fakeIncomingLocus = { sequence: {rangeStart: 0, rangeEnd: 0, entries: [1,2,3]}};
296
+
297
+ assert.isTrue(parser.isNewFullLocus(fakeIncomingLocus));
298
+ });
299
+
300
+ })
301
+ });
302
+
241
303
  describe('Invalid Locus objects', () => {
242
304
  let sandbox = null;
243
305
  let parser;
@@ -26,6 +26,7 @@ import {
26
26
  LOCUSINFO,
27
27
  PC_BAIL_TIMEOUT,
28
28
  DISPLAY_HINTS,
29
+ SELF_POLICY,
29
30
  } from '@webex/plugin-meetings/src/constants';
30
31
  import * as InternalMediaCoreModule from '@webex/internal-media-core';
31
32
  import {
@@ -5664,10 +5665,99 @@ describe('plugin-meetings', () => {
5664
5665
  waitingForOthersToJoinSpy.restore();
5665
5666
  });
5666
5667
 
5668
+ forEach(
5669
+ [
5670
+ {
5671
+ actionName: 'canShareFile',
5672
+ requiredDisplayHints: [DISPLAY_HINTS.SHARE_FILE],
5673
+ requiredPolicies: [SELF_POLICY.SUPPORT_FILE_SHARE],
5674
+ },
5675
+ {
5676
+ actionName: 'canShareApplication',
5677
+ requiredDisplayHints: [DISPLAY_HINTS.SHARE_APPLICATION],
5678
+ requiredPolicies: [SELF_POLICY.SUPPORT_APP_SHARE],
5679
+ },
5680
+ {
5681
+ actionName: 'canShareCamera',
5682
+ requiredDisplayHints: [DISPLAY_HINTS.SHARE_CAMERA],
5683
+ requiredPolicies: [SELF_POLICY.SUPPORT_CAMERA_SHARE],
5684
+ },
5685
+ {
5686
+ actionName: 'canShareDesktop',
5687
+ requiredDisplayHints: [DISPLAY_HINTS.SHARE_DESKTOP],
5688
+ requiredPolicies: [SELF_POLICY.SUPPORT_DESKTOP_SHARE],
5689
+ },
5690
+ ],
5691
+ ({actionName, requiredDisplayHints, requiredPolicies}) => {
5692
+ it(`${actionName} is enabled when the conditions are met`, () => {
5693
+ meeting.selfUserPolicies = {};
5694
+
5695
+ forEach(requiredPolicies, (policy) => {
5696
+ meeting.selfUserPolicies[policy] = true;
5697
+ });
5698
+
5699
+ meeting.setUpLocusInfoMeetingInfoListener();
5700
+
5701
+ const callback = locusInfoOnSpy.thirdCall.args[1];
5702
+
5703
+ const payload = {
5704
+ info: {
5705
+ userDisplayHints: requiredDisplayHints,
5706
+ },
5707
+ };
5708
+
5709
+ callback(payload);
5710
+
5711
+ assert.isTrue(meeting.inMeetingActions.get()[actionName]);
5712
+ });
5713
+
5714
+ it(`${actionName} is disabled when the required display hints are missing`, () => {
5715
+ meeting.selfUserPolicies = {};
5716
+
5717
+ forEach(requiredPolicies, (policy) => {
5718
+ meeting.selfUserPolicies[policy] = true;
5719
+ });
5720
+
5721
+ meeting.setUpLocusInfoMeetingInfoListener();
5722
+
5723
+ const callback = locusInfoOnSpy.thirdCall.args[1];
5724
+
5725
+ const payload = {
5726
+ info: {
5727
+ userDisplayHints: [],
5728
+ },
5729
+ };
5730
+
5731
+ callback(payload);
5732
+
5733
+ assert.isFalse(meeting.inMeetingActions.get()[actionName]);
5734
+ });
5735
+
5736
+ it(`${actionName} is disabled when the required policies are missing`, () => {
5737
+ meeting.selfUserPolicies = {};
5738
+
5739
+ meeting.setUpLocusInfoMeetingInfoListener();
5740
+
5741
+ const callback = locusInfoOnSpy.thirdCall.args[1];
5742
+
5743
+ const payload = {
5744
+ info: {
5745
+ userDisplayHints: requiredDisplayHints,
5746
+ },
5747
+ };
5748
+
5749
+ callback(payload);
5750
+
5751
+ assert.isFalse(meeting.inMeetingActions.get()[actionName]);
5752
+ });
5753
+ }
5754
+ );
5755
+
5667
5756
  it('registers the correct MEETING_INFO_UPDATED event', () => {
5668
5757
  // Due to import tree issues, hasHints must be stubed within the scope of the `it`.
5669
5758
  const restorableHasHints = ControlsOptionsUtil.hasHints;
5670
5759
  ControlsOptionsUtil.hasHints = sinon.stub().returns(true);
5760
+ ControlsOptionsUtil.hasPolicies = sinon.stub().returns(true);
5671
5761
 
5672
5762
  const setUserPolicySpy = sinon.spy(meeting.recordingController, 'setUserPolicy');
5673
5763
  meeting.selfUserPolicies = {a: true};
@@ -5766,18 +5856,34 @@ describe('plugin-meetings', () => {
5766
5856
  requiredHints: [DISPLAY_HINTS.SHARE_FILE],
5767
5857
  displayHints: payload.info.userDisplayHints,
5768
5858
  });
5859
+ assert.calledWith(ControlsOptionsUtil.hasPolicies, {
5860
+ requiredPolicies: [SELF_POLICY.SUPPORT_FILE_SHARE],
5861
+ policies: {a: true},
5862
+ });
5769
5863
  assert.calledWith(ControlsOptionsUtil.hasHints, {
5770
5864
  requiredHints: [DISPLAY_HINTS.SHARE_APPLICATION],
5771
5865
  displayHints: payload.info.userDisplayHints,
5772
5866
  });
5867
+ assert.calledWith(ControlsOptionsUtil.hasPolicies, {
5868
+ requiredPolicies: [SELF_POLICY.SUPPORT_APP_SHARE],
5869
+ policies: {a: true},
5870
+ });
5773
5871
  assert.calledWith(ControlsOptionsUtil.hasHints, {
5774
5872
  requiredHints: [DISPLAY_HINTS.SHARE_CAMERA],
5775
5873
  displayHints: payload.info.userDisplayHints,
5776
5874
  });
5875
+ assert.calledWith(ControlsOptionsUtil.hasPolicies, {
5876
+ requiredPolicies: [SELF_POLICY.SUPPORT_CAMERA_SHARE],
5877
+ policies: {a: true},
5878
+ });
5777
5879
  assert.calledWith(ControlsOptionsUtil.hasHints, {
5778
5880
  requiredHints: [DISPLAY_HINTS.SHARE_DESKTOP],
5779
5881
  displayHints: payload.info.userDisplayHints,
5780
5882
  });
5883
+ assert.calledWith(ControlsOptionsUtil.hasPolicies, {
5884
+ requiredPolicies: [SELF_POLICY.SUPPORT_DESKTOP_SHARE],
5885
+ policies: {a: true},
5886
+ });
5781
5887
  assert.calledWith(ControlsOptionsUtil.hasHints, {
5782
5888
  requiredHints: [DISPLAY_HINTS.SHARE_CONTENT],
5783
5889
  displayHints: payload.info.userDisplayHints,