@webex/plugin-meetings 1.158.0 → 1.159.2

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.
@@ -28,7 +28,6 @@ import {
28
28
  ROAP
29
29
  } from '../../../../src/constants';
30
30
 
31
-
32
31
  describe('plugin-meetings', () => {
33
32
  const logger = {
34
33
  log: () => {},
@@ -74,6 +73,11 @@ describe('plugin-meetings', () => {
74
73
  }
75
74
  });
76
75
 
76
+
77
+ Object.assign(webex, {
78
+ logging: logger
79
+ });
80
+
77
81
  Object.assign(webex.meetings.config, {
78
82
  bandwidth: {
79
83
  // please note, these are the maximum bandwidth values
@@ -86,7 +90,7 @@ describe('plugin-meetings', () => {
86
90
  enableUnifiedMeetings: true
87
91
  },
88
92
  logging: {
89
- enable: false,
93
+ enable: true,
90
94
  verboseEvents: true
91
95
  }
92
96
  });
@@ -95,6 +99,10 @@ describe('plugin-meetings', () => {
95
99
  logger
96
100
  });
97
101
 
102
+ Object.assign(webex.meetings, {
103
+ startReachability: sinon.stub().returns(Promise.resolve())
104
+ });
105
+
98
106
  Object.assign(webex.internal, {
99
107
  device: {
100
108
  deviceType: 'FAKE_DEVICE',
@@ -162,17 +170,36 @@ describe('plugin-meetings', () => {
162
170
  });
163
171
  });
164
172
 
173
+ describe('#_toggleAdhocMeetings', () => {
174
+ it('should have toggleAdhocMeetings', () => {
175
+ assert.equal(typeof webex.meetings._toggleAdhocMeetings, 'function');
176
+ });
177
+
178
+ describe('success', () => {
179
+ it('should update meetings to start adhoc meeting', () => {
180
+ webex.meetings._toggleAdhocMeetings(false);
181
+ assert.equal(webex.meetings.config.experimental.enableAdhocMeetings, false);
182
+ });
183
+ });
184
+
185
+ describe('failure', () => {
186
+ it('should not accept non boolean input', () => {
187
+ const currentEnableAdhocMeetings = webex.meetings.config.experimental.enableAdhocMeetings;
188
+
189
+ webex.meetings._toggleAdhocMeetings('test');
190
+ assert.equal(webex.meetings.config.experimental.enableAdhocMeetings, currentEnableAdhocMeetings);
191
+ });
192
+ });
193
+ });
194
+
195
+
165
196
  describe('Public API Contracts', () => {
166
197
  describe('#register', () => {
167
- it('emits an event and resolves when register succeeds', (done) => {
198
+ it('emits an event and resolves when register succeeds', async () => {
168
199
  webex.canAuthorize = true;
169
- webex.meetings.register().then(() => {
170
- assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {
171
- file: 'meetings', function: 'register'
172
- }, 'meetings:registered');
173
- assert.isTrue(webex.meetings.registered);
174
- done();
175
- });
200
+ await webex.meetings.register();
201
+ assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {file: 'meetings', function: 'register'}, 'meetings:registered');
202
+ assert.isTrue(webex.meetings.registered);
176
203
  });
177
204
 
178
205
  it('rejects when SDK canAuthorize is false', () => {
@@ -192,15 +219,24 @@ describe('plugin-meetings', () => {
192
219
  assert.isRejected(webex.meetings.register());
193
220
  });
194
221
 
195
- it('resolves immediately if already registered', (done) => {
222
+ it('resolves immediately if already registered', async () => {
196
223
  webex.canAuthorize = true;
197
224
  webex.meetings.registered = true;
198
- webex.meetings.register().then(() => {
199
- assert.notCalled(webex.internal.device.register);
200
- assert.notCalled(webex.internal.mercury.connect);
201
- assert.isTrue(webex.meetings.registered);
202
- done();
203
- });
225
+ await webex.meetings.register();
226
+ assert.notCalled(webex.internal.device.register);
227
+ assert.notCalled(webex.internal.mercury.connect);
228
+ assert.isTrue(webex.meetings.registered);
229
+ });
230
+
231
+ it('on register makes sure following functions are called ', async () => {
232
+ webex.canAuthorize = true;
233
+ webex.meetings.registered = false;
234
+ await webex.meetings.register();
235
+ assert.called(webex.internal.device.register);
236
+ assert.called(webex.internal.services.fetchLoginUserInformation);
237
+ assert.called(webex.internal.services.fetchClientRegionInfo);
238
+ assert.called(webex.internal.mercury.connect);
239
+ assert.isTrue(webex.meetings.registered);
204
240
  });
205
241
  });
206
242
 
@@ -639,7 +675,7 @@ describe('plugin-meetings', () => {
639
675
  webex.internal.device.userId = uuid1;
640
676
  webex.internal.device.url = url1;
641
677
  MeetingCollection.set = sinon.stub().returns(true);
642
- MeetingsUtil.getMeetingAddedType = sinon.stub().returns('test');
678
+ MeetingsUtil.getMeetingAddedType = sinon.stub().returns('test meeting added type');
643
679
  TriggerProxy.trigger.reset();
644
680
  });
645
681
  describe('successful MeetingInfo.#fetchMeetingInfo', () => {
@@ -651,30 +687,32 @@ describe('plugin-meetings', () => {
651
687
  }));
652
688
  });
653
689
  it('creates the meeting from a successful meeting info fetch promise testing', async () => {
654
- const meeting = await webex.meetings.createMeeting('test', 'test');
690
+ const meeting = await webex.meetings.createMeeting('test destination', 'test type');
655
691
 
656
692
  assert.calledOnce(webex.meetings.meetingInfo.fetchMeetingInfo);
657
693
  assert.calledOnce(MeetingsUtil.getMeetingAddedType);
658
694
  assert.calledTwice(TriggerProxy.trigger);
659
- assert.calledWith(webex.meetings.meetingInfo.fetchMeetingInfo, 'test');
660
- assert.calledWith(MeetingsUtil.getMeetingAddedType, 'test');
695
+ assert.calledWith(webex.meetings.meetingInfo.fetchMeetingInfo, 'test destination', 'test type');
696
+ assert.calledWith(MeetingsUtil.getMeetingAddedType, 'test type');
661
697
  assert.equal(meeting.permissionToken, 'PT');
662
698
  assert.equal(meeting.meetingJoinUrl, 'meetingJoinUrl');
699
+ assert.equal(meeting.destination, 'test destination');
700
+ assert.equal(meeting.destinationType, 'test type');
663
701
  });
664
702
 
665
703
  it('creates the meeting from a successful meeting info fetch meeting resolve testing', async () => {
666
- const meeting = await webex.meetings.createMeeting('test', 'test');
704
+ const meeting = await webex.meetings.createMeeting('test destination', 'test type');
667
705
 
668
706
  assert.instanceOf(meeting, Meeting, 'createMeeting should eventually resolve to a Meeting Object');
669
707
  assert.calledOnce(webex.meetings.meetingInfo.fetchMeetingInfo);
670
708
  assert.calledOnce(MeetingsUtil.getMeetingAddedType);
671
709
  assert.calledTwice(TriggerProxy.trigger);
672
- assert.calledWith(webex.meetings.meetingInfo.fetchMeetingInfo, 'test');
673
- assert.calledWith(MeetingsUtil.getMeetingAddedType, 'test');
710
+ assert.calledWith(webex.meetings.meetingInfo.fetchMeetingInfo, 'test destination', 'test type');
711
+ assert.calledWith(MeetingsUtil.getMeetingAddedType, 'test type');
674
712
  assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {
675
713
  file: 'meetings', function: 'createMeeting'
676
714
  }, 'meeting:added', {
677
- meeting: sinon.match.instanceOf(Meeting), type: 'test'
715
+ meeting: sinon.match.instanceOf(Meeting), type: 'test meeting added type'
678
716
  });
679
717
  });
680
718
  });
@@ -685,18 +723,18 @@ describe('plugin-meetings', () => {
685
723
  webex.meetings.meetingInfo.fetchMeetingInfo = sinon.stub().returns(Promise.reject(new Error('test')));
686
724
  });
687
725
  it('creates the meeting from a rejected meeting info fetch', async () => {
688
- const meeting = await webex.meetings.createMeeting('test', 'test');
726
+ const meeting = await webex.meetings.createMeeting('test destination', 'test type');
689
727
 
690
728
  assert.instanceOf(meeting, Meeting, 'createMeeting should eventually resolve to a Meeting Object');
691
729
  assert.calledOnce(webex.meetings.meetingInfo.fetchMeetingInfo);
692
730
  assert.calledOnce(MeetingsUtil.getMeetingAddedType);
693
731
  assert.calledTwice(TriggerProxy.trigger);
694
- assert.calledWith(webex.meetings.meetingInfo.fetchMeetingInfo, 'test');
695
- assert.calledWith(MeetingsUtil.getMeetingAddedType, 'test');
732
+ assert.calledWith(webex.meetings.meetingInfo.fetchMeetingInfo, 'test destination', 'test type');
733
+ assert.calledWith(MeetingsUtil.getMeetingAddedType, 'test type');
696
734
  assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {
697
735
  file: 'meetings', function: 'createMeeting'
698
736
  }, 'meeting:added', {
699
- meeting: sinon.match.instanceOf(Meeting), type: 'test'
737
+ meeting: sinon.match.instanceOf(Meeting), type: 'test meeting added type'
700
738
  });
701
739
  });
702
740
  });
@@ -768,6 +806,29 @@ describe('plugin-meetings', () => {
768
806
  assert.calledWith(TriggerProxy.trigger, webex.internal.mercury, SCOPE, EVENT);
769
807
  });
770
808
  });
809
+
810
+ describe('#fetchUserPreferredWebexSite', () => {
811
+ it('should call request.fetchLoginUserInformation to get the preferred webex site ', async () => {
812
+ assert.isDefined(webex.meetings.preferredWebexSite);
813
+ await webex.meetings.fetchUserPreferredWebexSite();
814
+
815
+ assert.equal(webex.meetings.preferredWebexSite, 'go.webex.com');
816
+ });
817
+
818
+ it('should not fail if UserPreferred info is not fetched ', async () => {
819
+ Object.assign(webex.internal, {
820
+ services: {
821
+ fetchLoginUserInformation: sinon.stub().returns(Promise.resolve({})),
822
+ },
823
+
824
+ });
825
+
826
+ await webex.meetings.fetchUserPreferredWebexSite()
827
+ .then(() => {
828
+ assert.equal(webex.meetings.preferredWebexSite, '');
829
+ });
830
+ });
831
+ });
771
832
  });
772
833
  });
773
834
  });
@@ -0,0 +1,18 @@
1
+ import {assert} from '@webex/test-helper-chai';
2
+ import MeetingsUtil from '@webex/plugin-meetings/src/meetings/util';
3
+
4
+ describe('plugin-meetings', () => {
5
+ describe('Meetings utils function', () => {
6
+ describe('#parseUserPreferences', () => {
7
+ it('parsed the prefered webesite from userPreferences', async () => {
8
+ const res = MeetingsUtil.parseUserPreferences([
9
+ 'SparkTOSAccept',
10
+ '"preferredWebExSite":"go.webex.com"'
11
+ ]);
12
+
13
+ assert.equal(res, 'go.webex.com');
14
+ });
15
+ });
16
+ });
17
+ });
18
+