@webex/plugin-meetings 3.0.0-beta.184 → 3.0.0-beta.186

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.
@@ -1547,6 +1547,7 @@ describe('plugin-meetings', () => {
1547
1547
  meeting: true,
1548
1548
  participants: true,
1549
1549
  url: 'newLocusUrl',
1550
+ syncUrl: 'newSyncUrl',
1550
1551
  };
1551
1552
  });
1552
1553
 
@@ -1707,39 +1708,83 @@ describe('plugin-meetings', () => {
1707
1708
  assert.calledWith(meeting.locusInfo.onDeltaLocus, fakeLocus);
1708
1709
  });
1709
1710
 
1710
- it('applyLocusDeltaData gets full locus on DESYNC action', () => {
1711
+ it('applyLocusDeltaData gets delta locus on DESYNC action if we have a syncUrl', () => {
1711
1712
  const {DESYNC} = LocusDeltaParser.loci;
1713
+ const fakeDeltaLocus = {id: 'fake delta locus'};
1712
1714
  const meeting = {
1713
1715
  meetingRequest: {
1714
- getFullLocus: sandbox.stub().resolves(true),
1716
+ getLocusDTO: sandbox.stub().resolves({body: fakeDeltaLocus}),
1715
1717
  },
1716
1718
  locusInfo: {
1719
+ onDeltaLocus: sandbox.stub(),
1720
+ },
1721
+ locusUrl: 'oldLocusUrl',
1722
+ };
1723
+
1724
+ locusInfo.locusParser.workingCopy = {
1725
+ syncUrl: 'oldSyncUrl',
1726
+ };
1727
+
1728
+ // Since we have a promise inside a function we want to test that's not returned,
1729
+ // we will wait and stub it's last function to resolve this waiting promise.
1730
+ // Also ensures .onDeltaLocus() is called before .resume()
1731
+ return new Promise((resolve) => {
1732
+ locusInfo.locusParser.resume = sandbox.stub().callsFake(() => resolve());
1733
+ locusInfo.applyLocusDeltaData(DESYNC, fakeLocus, meeting);
1734
+ }).then(() => {
1735
+ assert.calledOnceWithExactly(meeting.meetingRequest.getLocusDTO, { url: 'oldSyncUrl' });
1736
+
1737
+ assert.calledOnceWithExactly(meeting.locusInfo.onDeltaLocus, fakeDeltaLocus);
1738
+ assert.calledOnce(locusInfo.locusParser.resume);
1739
+ });
1740
+ });
1741
+
1742
+ it('applyLocusDeltaData gets delta locus on DESYNC action if we have a syncUrl (empty response body)', () => {
1743
+ const {DESYNC} = LocusDeltaParser.loci;
1744
+ const meeting = {
1745
+ meetingRequest: {
1746
+ getLocusDTO: sandbox.stub().resolves({body: {}}),
1747
+ },
1748
+ locusInfo: {
1749
+ onDeltaLocus: sandbox.stub(),
1717
1750
  onFullLocus: sandbox.stub(),
1718
1751
  },
1719
1752
  locusUrl: 'oldLocusUrl',
1720
1753
  };
1721
1754
 
1722
- locusInfo.locusParser.resume = sandbox.stub();
1723
- locusInfo.applyLocusDeltaData(DESYNC, fakeLocus, meeting);
1755
+ locusInfo.locusParser.workingCopy = {
1756
+ syncUrl: 'oldSyncUrl',
1757
+ };
1724
1758
 
1725
- assert.calledOnceWithExactly(meeting.meetingRequest.getFullLocus,
1726
- {
1727
- desync: true,
1728
- locusUrl: 'newLocusUrl',
1729
- }
1730
- );
1759
+ // Since we have a promise inside a function we want to test that's not returned,
1760
+ // we will wait and stub it's last function to resolve this waiting promise.
1761
+ // Also ensures .onDeltaLocus() is called before .resume()
1762
+ return new Promise((resolve) => {
1763
+ locusInfo.locusParser.resume = sandbox.stub().callsFake(() => resolve());
1764
+ locusInfo.applyLocusDeltaData(DESYNC, fakeLocus, meeting);
1765
+ }).then(() => {
1766
+ assert.calledOnceWithExactly(meeting.meetingRequest.getLocusDTO, { url: 'oldSyncUrl' });
1767
+
1768
+ assert.notCalled(meeting.locusInfo.onDeltaLocus);
1769
+ assert.notCalled(meeting.locusInfo.onFullLocus);
1770
+ assert.calledOnce(locusInfo.locusParser.resume);
1771
+ });
1731
1772
  });
1732
1773
 
1733
- it('getFullLocus handles DESYNC action correctly', () => {
1774
+ it('applyLocusDeltaData gets full locus on DESYNC action if we do not have a syncUrl', () => {
1734
1775
  const {DESYNC} = LocusDeltaParser.loci;
1776
+ const fakeFullLocusDto = {id: 'fake full locus dto'};
1735
1777
  const meeting = {
1736
1778
  meetingRequest: {
1737
- getFullLocus: sandbox.stub().resolves({body: true}),
1779
+ getLocusDTO: sandbox.stub().resolves({body: fakeFullLocusDto}),
1738
1780
  },
1739
- locusInfo,
1781
+ locusInfo: {
1782
+ onFullLocus: sandbox.stub(),
1783
+ },
1784
+ locusUrl: 'oldLocusUrl',
1740
1785
  };
1741
1786
 
1742
- locusInfo.onFullLocus = sandbox.stub();
1787
+ locusInfo.locusParser.workingCopy = {}; // no syncUrl
1743
1788
 
1744
1789
  // Since we have a promise inside a function we want to test that's not returned,
1745
1790
  // we will wait and stub it's last function to resolve this waiting promise.
@@ -1748,7 +1793,9 @@ describe('plugin-meetings', () => {
1748
1793
  locusInfo.locusParser.resume = sandbox.stub().callsFake(() => resolve());
1749
1794
  locusInfo.applyLocusDeltaData(DESYNC, fakeLocus, meeting);
1750
1795
  }).then(() => {
1751
- assert.calledOnce(meeting.locusInfo.onFullLocus);
1796
+ assert.calledOnceWithExactly(meeting.meetingRequest.getLocusDTO, { url: 'oldLocusUrl' });
1797
+
1798
+ assert.calledOnceWithExactly(meeting.locusInfo.onFullLocus, fakeFullLocusDto);
1752
1799
  assert.calledOnce(locusInfo.locusParser.resume);
1753
1800
  });
1754
1801
  });
@@ -226,7 +226,7 @@ describe('plugin-meetings', () => {
226
226
  membersSpy = sinon.spy(MembersImport, 'default');
227
227
  meetingRequestSpy = sinon.spy(MeetingRequestImport, 'default');
228
228
 
229
- TriggerProxy.trigger = sinon.stub().returns(true);
229
+ sinon.stub(TriggerProxy, 'trigger').returns(true);
230
230
  Metrics.initialSetup(webex);
231
231
  MediaUtil.createMediaStream = sinon.stub().callsFake((tracks) => {
232
232
  return {
@@ -37,7 +37,7 @@ describe('plugin-meetings', () => {
37
37
  unmuteVideoAllowed: true,
38
38
 
39
39
  locusInfo: {
40
- onDeltaLocus: sinon.stub(),
40
+ handleLocusDelta: sinon.stub(),
41
41
  },
42
42
  members: {
43
43
  selfId: 'fake self id',
@@ -21,6 +21,7 @@ describe('plugin-meetings', () => {
21
21
  log: sandbox.stub(),
22
22
  error: sandbox.stub(),
23
23
  warn: sandbox.stub(),
24
+ debug: sandbox.stub(),
24
25
  };
25
26
 
26
27
  LoggerConfig.set({
@@ -42,6 +43,7 @@ describe('plugin-meetings', () => {
42
43
  meeting.annotaion = {cleanUp: sinon.stub()};
43
44
  meeting.getWebexObject = sinon.stub().returns(webex);
44
45
  meeting.simultaneousInterpretation = {cleanUp: sinon.stub()};
46
+ meeting.trigger = sinon.stub();
45
47
  });
46
48
 
47
49
  afterEach(() => {
@@ -177,10 +179,10 @@ describe('plugin-meetings', () => {
177
179
  });
178
180
 
179
181
  describe('updateLocusWithDelta', () => {
180
- it('should call onDeltaLocus with the new delta locus', () => {
182
+ it('should call handleLocusDelta with the new delta locus', () => {
181
183
  const meeting = {
182
184
  locusInfo: {
183
- onDeltaLocus: sinon.stub()
185
+ handleLocusDelta: sinon.stub()
184
186
  },
185
187
  };
186
188
 
@@ -193,13 +195,13 @@ describe('plugin-meetings', () => {
193
195
  const response = MeetingUtil.updateLocusWithDelta(meeting, originalResponse);
194
196
 
195
197
  assert.deepEqual(response, originalResponse);
196
- assert.calledOnceWithExactly(meeting.locusInfo.onDeltaLocus, 'locus');
198
+ assert.calledOnceWithExactly(meeting.locusInfo.handleLocusDelta, 'locus', meeting);
197
199
  });
198
200
 
199
201
  it('should handle locus being missing from the response', () => {
200
202
  const meeting = {
201
203
  locusInfo: {
202
- onDeltaLocus: sinon.stub(),
204
+ handleLocusDelta: sinon.stub(),
203
205
  },
204
206
  };
205
207
 
@@ -210,7 +212,7 @@ describe('plugin-meetings', () => {
210
212
  const response = MeetingUtil.updateLocusWithDelta(meeting, originalResponse);
211
213
 
212
214
  assert.deepEqual(response, originalResponse);
213
- assert.notCalled(meeting.locusInfo.onDeltaLocus);
215
+ assert.notCalled(meeting.locusInfo.handleLocusDelta);
214
216
  });
215
217
 
216
218
  it('should work with an undefined meeting', () => {
@@ -57,7 +57,7 @@ describe('plugin-meetings', () => {
57
57
  verboseEvents: true,
58
58
  enable: false,
59
59
  });
60
- TriggerProxy.trigger = sinon.stub().returns(true);
60
+ sinon.stub(TriggerProxy, 'trigger').returns(true);
61
61
  });
62
62
 
63
63
  let webex;
@@ -232,7 +232,7 @@ describe('plugin-meetings', () => {
232
232
  it('should send clear event if clear members', () => {
233
233
  const members = createMembers({url: url1});
234
234
  members.membersCollection.setAll(fakeMembersCollection);
235
- Trigger.trigger = sinon.stub();
235
+ sinon.stub(Trigger, 'trigger');
236
236
  members.clearMembers();
237
237
  assert.deepEqual(members.membersCollection.members, {});
238
238
  assert.calledWith(
@@ -250,7 +250,6 @@ describe('plugin-meetings', () => {
250
250
  describe('#locusParticipantsUpdate', () => {
251
251
  it('should send member update event with session info', () => {
252
252
  const members = createMembers({url: url1});
253
- Trigger.trigger = sinon.stub();
254
253
  const fakePayload = {
255
254
  participants: {
256
255
  forEach: sinon.stub(),