@webex/plugin-meetings 1.157.0 → 1.159.0

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.
Files changed (40) hide show
  1. package/README.md +3 -3
  2. package/browsers.js +1 -1
  3. package/dist/config.js +2 -1
  4. package/dist/config.js.map +1 -1
  5. package/dist/index.js +1 -2
  6. package/dist/index.js.map +1 -1
  7. package/dist/meeting-info/meeting-info-v2.js +172 -36
  8. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  9. package/dist/meeting-info/utilv2.js +44 -0
  10. package/dist/meeting-info/utilv2.js.map +1 -1
  11. package/dist/meetings/index.js +67 -17
  12. package/dist/meetings/index.js.map +1 -1
  13. package/dist/meetings/request.js +16 -6
  14. package/dist/meetings/request.js.map +1 -1
  15. package/dist/meetings/util.js +17 -0
  16. package/dist/meetings/util.js.map +1 -1
  17. package/package.json +6 -5
  18. package/src/config.js +2 -1
  19. package/src/index.js +0 -1
  20. package/src/meeting-info/meeting-info-v2.js +90 -5
  21. package/src/meeting-info/utilv2.js +39 -0
  22. package/src/meetings/index.js +44 -2
  23. package/src/meetings/request.js +15 -6
  24. package/src/meetings/util.js +19 -0
  25. package/test/{unit/spec/transcription/index.js → integration/spec/transcription.js} +1 -1
  26. package/test/unit/spec/common/browser-detection.js +1 -0
  27. package/test/unit/spec/locus-info/index.js +1 -1
  28. package/test/unit/spec/meeting/index.js +43 -3
  29. package/test/unit/spec/meeting-info/meetinginfov2.js +99 -2
  30. package/test/unit/spec/meeting-info/utilv2.js +72 -0
  31. package/test/unit/spec/meetings/index.js +323 -86
  32. package/test/unit/spec/meetings/utils.js +18 -0
  33. package/test/unit/spec/members/index.js +1 -0
  34. package/test/unit/spec/metrics/index.js +7 -26
  35. package/test/unit/spec/networkQualityMonitor/index.js +1 -0
  36. package/test/unit/spec/peerconnection-manager/index.js +11 -1
  37. package/test/unit/spec/personal-meeting-room/personal-meeting-room.js +1 -0
  38. package/test/unit/spec/reconnection-manager/index.js +1 -0
  39. package/test/unit/spec/roap/util.js +1 -0
  40. package/test/unit/spec/stats-analyzer/index.js +1 -0
@@ -1,34 +1,34 @@
1
1
  /*!
2
2
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
3
  */
4
+ import 'jsdom-global/register';
4
5
 
5
- import {assert} from '@webex/test-helper-chai';
6
- import sinon from 'sinon';
7
- import MockWebex from '@webex/test-helper-mock-webex';
8
6
  import Device from '@webex/internal-plugin-device';
9
7
  import Mercury from '@webex/internal-plugin-mercury';
8
+ import StaticConfig from '@webex/plugin-meetings/src/common/config';
9
+ import TriggerProxy from '@webex/plugin-meetings/src/common/events/trigger-proxy';
10
+ import LoggerConfig from '@webex/plugin-meetings/src/common/logs/logger-config';
11
+ import MediaUtil from '@webex/plugin-meetings/src/media/util';
12
+ import Meeting from '@webex/plugin-meetings/src/meeting';
13
+ import MeetingUtil from '@webex/plugin-meetings/src/meeting/util';
10
14
  import Meetings from '@webex/plugin-meetings/src/meetings';
11
- import PersonalMeetingRoom from '@webex/plugin-meetings/src/personal-meeting-room';
12
- import Reachability from '@webex/plugin-meetings/src/reachability';
13
15
  import MeetingCollection from '@webex/plugin-meetings/src/meetings/collection';
14
16
  import MeetingsUtil from '@webex/plugin-meetings/src/meetings/util';
15
- import Meeting from '@webex/plugin-meetings/src/meeting';
16
- import MediaUtil from '@webex/plugin-meetings/src/media/util';
17
- import LoggerProxy from '@webex/plugin-meetings/src/common/logs/logger-proxy';
18
- import LoggerConfig from '@webex/plugin-meetings/src/common/logs/logger-config';
19
- import StaticConfig from '@webex/plugin-meetings/src/common/config';
20
- import TriggerProxy from '@webex/plugin-meetings/src/common/events/trigger-proxy';
17
+ import PersonalMeetingRoom from '@webex/plugin-meetings/src/personal-meeting-room';
18
+ import Reachability from '@webex/plugin-meetings/src/reachability';
19
+ import {assert} from '@webex/test-helper-chai';
20
+ import MockWebex from '@webex/test-helper-mock-webex';
21
+ import sinon from 'sinon';
21
22
  import uuid from 'uuid';
22
- import {skipInBrowser} from '@webex/test-helper-mocha';
23
23
 
24
24
  import {
25
25
  LOCUSEVENT,
26
- ROAP,
26
+ OFFLINE,
27
27
  ONLINE,
28
- OFFLINE
28
+ ROAP
29
29
  } from '../../../../src/constants';
30
30
 
31
- skipInBrowser(describe)('plugin-meetings', () => {
31
+ describe('plugin-meetings', () => {
32
32
  const logger = {
33
33
  log: () => {},
34
34
  info: () => {},
@@ -39,9 +39,14 @@ skipInBrowser(describe)('plugin-meetings', () => {
39
39
  };
40
40
 
41
41
  beforeEach(() => {
42
- StaticConfig.set({bandwidth: {audio: 50, video: 500}});
43
- LoggerConfig.set({verboseEvents: true, enable: false});
44
- LoggerProxy.set(logger);
42
+ StaticConfig.set({
43
+ bandwidth: {
44
+ audio: 50, video: 500
45
+ }
46
+ });
47
+ LoggerConfig.set({
48
+ verboseEvents: true, enable: false
49
+ });
45
50
  TriggerProxy.trigger = sinon.stub().returns(true);
46
51
  });
47
52
 
@@ -54,7 +59,7 @@ skipInBrowser(describe)('plugin-meetings', () => {
54
59
 
55
60
  describe('meetings index', () => {
56
61
  beforeEach(() => {
57
- MeetingsUtil.triggerH264Codec = sinon.stub();
62
+ MeetingsUtil.checkH264Support = sinon.stub();
58
63
  uuid1 = uuid.v4();
59
64
  url1 = `https://example.com/${uuid.v4()}`;
60
65
  uri1 = `test-${uuid.v4()}@example.com`;
@@ -68,12 +73,36 @@ skipInBrowser(describe)('plugin-meetings', () => {
68
73
  }
69
74
  });
70
75
 
76
+
77
+ Object.assign(webex, {
78
+ logging: logger
79
+ });
80
+
71
81
  Object.assign(webex.meetings.config, {
82
+ bandwidth: {
83
+ // please note, these are the maximum bandwidth values
84
+ // the server supports, minimums have to be tested
85
+ audio: 64000,
86
+ video: 4000000,
87
+ startBitrate: 2000
88
+ },
72
89
  experimental: {
73
90
  enableUnifiedMeetings: true
91
+ },
92
+ logging: {
93
+ enable: true,
94
+ verboseEvents: true
74
95
  }
75
96
  });
76
97
 
98
+ Object.assign(webex, {
99
+ logger
100
+ });
101
+
102
+ Object.assign(webex.meetings, {
103
+ startReachability: sinon.stub().returns(Promise.resolve())
104
+ });
105
+
77
106
  Object.assign(webex.internal, {
78
107
  device: {
79
108
  deviceType: 'FAKE_DEVICE',
@@ -85,8 +114,23 @@ skipInBrowser(describe)('plugin-meetings', () => {
85
114
  disconnect: sinon.stub().returns(Promise.resolve()),
86
115
  on: () => {},
87
116
  off: () => {}
117
+ },
118
+ services: {
119
+ fetchLoginUserInformation: sinon.stub().returns(Promise.resolve({
120
+ userPreferences: [
121
+ 'SparkTOSAccept',
122
+ // eslint-disable-next-line no-useless-escape
123
+ '\"preferredWebExSite\":"\go.webex.com\"'
124
+ ]
125
+ })),
126
+ fetchClientRegionInfo: sinon.stub().returns(Promise.resolve())
127
+ },
128
+ metrics: {
129
+ submitClientMetrics: sinon.stub().returns(Promise.resolve())
88
130
  }
131
+
89
132
  });
133
+ webex.emit('ready');
90
134
  });
91
135
 
92
136
  it('has a webex instance with a meetings property', () => {
@@ -95,12 +139,12 @@ skipInBrowser(describe)('plugin-meetings', () => {
95
139
  });
96
140
 
97
141
  it('has set up the static config copy', () => {
98
- assert.equal(StaticConfig.meetings.bandwidth.audio, 50);
99
- assert.equal(StaticConfig.meetings.bandwidth.video, 500);
142
+ assert.equal(StaticConfig.meetings.bandwidth.audio, 64000);
143
+ assert.equal(StaticConfig.meetings.bandwidth.video, 4000000);
100
144
  });
101
145
 
102
146
  it('Should trigger h264 download', () => {
103
- assert.calledOnce(MeetingsUtil.triggerH264Codec);
147
+ assert.calledOnce(MeetingsUtil.checkH264Support);
104
148
  });
105
149
 
106
150
  describe('#_toggleUnifiedMeetings', () => {
@@ -126,15 +170,36 @@ skipInBrowser(describe)('plugin-meetings', () => {
126
170
  });
127
171
  });
128
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
+
129
196
  describe('Public API Contracts', () => {
130
197
  describe('#register', () => {
131
- it('emits an event and resolves when register succeeds', (done) => {
198
+ it('emits an event and resolves when register succeeds', async () => {
132
199
  webex.canAuthorize = true;
133
- webex.meetings.register().then(() => {
134
- assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {file: 'meetings', function: 'register'}, 'meetings:registered');
135
- assert.isTrue(webex.meetings.registered);
136
- done();
137
- });
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);
138
203
  });
139
204
 
140
205
  it('rejects when SDK canAuthorize is false', () => {
@@ -154,15 +219,24 @@ skipInBrowser(describe)('plugin-meetings', () => {
154
219
  assert.isRejected(webex.meetings.register());
155
220
  });
156
221
 
157
- it('resolves immediately if already registered', (done) => {
222
+ it('resolves immediately if already registered', async () => {
158
223
  webex.canAuthorize = true;
159
224
  webex.meetings.registered = true;
160
- webex.meetings.register().then(() => {
161
- assert.notCalled(webex.internal.device.register);
162
- assert.notCalled(webex.internal.mercury.connect);
163
- assert.isTrue(webex.meetings.registered);
164
- done();
165
- });
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);
166
240
  });
167
241
  });
168
242
 
@@ -170,7 +244,9 @@ skipInBrowser(describe)('plugin-meetings', () => {
170
244
  it('emits an event and resolves when unregister succeeds', (done) => {
171
245
  webex.meetings.registered = true;
172
246
  webex.meetings.unregister().then(() => {
173
- assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {file: 'meetings', function: 'unregister'}, 'meetings:unregistered');
247
+ assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {
248
+ file: 'meetings', function: 'unregister'
249
+ }, 'meetings:unregistered');
174
250
  assert.isFalse(webex.meetings.registered);
175
251
  done();
176
252
  });
@@ -262,9 +338,13 @@ skipInBrowser(describe)('plugin-meetings', () => {
262
338
  });
263
339
  describe('#getAllMeetings', () => {
264
340
  it('calls MeetingCollection to get all meetings with supplied options', () => {
265
- webex.meetings.getAllMeetings({test: test1});
341
+ webex.meetings.getAllMeetings({
342
+ test: test1
343
+ });
266
344
  assert.calledOnce(webex.meetings.meetingCollection.getAll);
267
- assert.calledWith(webex.meetings.meetingCollection.getAll, {test: test1});
345
+ assert.calledWith(webex.meetings.meetingCollection.getAll, {
346
+ test: test1
347
+ });
268
348
  });
269
349
  });
270
350
  });
@@ -276,14 +356,22 @@ skipInBrowser(describe)('plugin-meetings', () => {
276
356
  });
277
357
  describe('succesful requests', () => {
278
358
  beforeEach(() => {
279
- webex.meetings.request.getActiveMeetings = sinon.stub().returns(Promise.resolve({loci: [{url: url1}]}));
359
+ webex.meetings.request.getActiveMeetings = sinon.stub().returns(Promise.resolve({
360
+ loci: [{
361
+ url: url1
362
+ }]
363
+ }));
280
364
  });
281
365
  describe('when meeting is returned', () => {
282
366
  let parse;
283
367
 
284
368
  beforeEach(() => {
285
369
  parse = sinon.stub().returns(true);
286
- webex.meetings.meetingCollection.getByKey = sinon.stub().returns({locusInfo: {parse}});
370
+ webex.meetings.meetingCollection.getByKey = sinon.stub().returns({
371
+ locusInfo: {
372
+ parse
373
+ }
374
+ });
287
375
  });
288
376
  it('tests the sync meeting calls for existing meeting', async () => {
289
377
  await webex.meetings.syncMeetings();
@@ -299,7 +387,11 @@ skipInBrowser(describe)('plugin-meetings', () => {
299
387
  beforeEach(() => {
300
388
  initialSetup = sinon.stub().returns(true);
301
389
  webex.meetings.meetingCollection.getByKey = sinon.stub().returns(null);
302
- webex.meetings.create = sinon.stub().returns(Promise.resolve({locusInfo: {initialSetup}}));
390
+ webex.meetings.create = sinon.stub().returns(Promise.resolve({
391
+ locusInfo: {
392
+ initialSetup
393
+ }
394
+ }));
303
395
  });
304
396
  it('tests the sync meeting calls for not existing meeting', async () => {
305
397
  await webex.meetings.syncMeetings();
@@ -309,29 +401,51 @@ skipInBrowser(describe)('plugin-meetings', () => {
309
401
  assert.calledOnce(webex.meetings.create);
310
402
  assert.calledWith(webex.meetings.request.getActiveMeetings);
311
403
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
312
- assert.calledWith(webex.meetings.create, {url: url1}, 'LOCUS_ID');
313
- assert.calledWith(initialSetup, {url: url1});
404
+ assert.calledWith(webex.meetings.create, {
405
+ url: url1
406
+ }, 'LOCUS_ID');
407
+ assert.calledWith(initialSetup, {
408
+ url: url1
409
+ });
314
410
  });
315
411
  });
316
412
  describe('destory non active meeting', () => {
317
413
  let initialSetup;
318
414
  let parse;
415
+ let destroySpy;
319
416
 
320
417
  beforeEach(() => {
418
+ destroySpy = sinon.spy(webex.meetings, 'destroy');
321
419
  parse = sinon.stub().returns(true);
322
- webex.meetings.destroy = sinon.stub();
323
420
  initialSetup = sinon.stub().returns(true);
324
- webex.meetings.meetingCollection.getByKey = sinon.stub().returns({locusInfo: {parse}, sendCallAnalyzerMetrics: sinon.stub()});
325
- webex.meetings.meetingCollection.getAll = sinon.stub().returns({meetingutk: {locusUrl: 'fdfdjfdhj', sendCallAnalyzerMetrics: sinon.stub()}});
326
- webex.meetings.create = sinon.stub().returns(Promise.resolve({locusInfo: {initialSetup}, sendCallAnalyzerMetrics: sinon.stub()}));
327
- webex.meetings.request.getActiveMeetings = sinon.stub().returns(Promise.resolve({loci: []}));
421
+ webex.meetings.meetingCollection.getByKey = sinon.stub().returns({
422
+ locusInfo: {
423
+ parse
424
+ },
425
+ sendCallAnalyzerMetrics: sinon.stub()
426
+ });
427
+ webex.meetings.meetingCollection.getAll = sinon.stub().returns({
428
+ meetingutk: {
429
+ locusUrl: 'fdfdjfdhj', sendCallAnalyzerMetrics: sinon.stub()
430
+ }
431
+ });
432
+ webex.meetings.create = sinon.stub().returns(Promise.resolve({
433
+ locusInfo: {
434
+ initialSetup
435
+ },
436
+ sendCallAnalyzerMetrics: sinon.stub()
437
+ }));
438
+ webex.meetings.request.getActiveMeetings = sinon.stub().returns(Promise.resolve({
439
+ loci: []
440
+ }));
441
+ MeetingUtil.cleanUp = sinon.stub().returns(Promise.resolve());
328
442
  });
329
443
  it('destroy non active meetings', async () => {
330
444
  await webex.meetings.syncMeetings();
331
445
  assert.calledOnce(webex.meetings.request.getActiveMeetings);
332
- assert.calledOnce(webex.meetings.destroy);
446
+ assert.calledOnce(destroySpy);
333
447
 
334
- assert.calledOnce(MeetingsUtil.cleanUp);
448
+ assert.calledOnce(MeetingUtil.cleanUp);
335
449
  });
336
450
  });
337
451
  });
@@ -348,7 +462,9 @@ skipInBrowser(describe)('plugin-meetings', () => {
348
462
  type: 'CONVERSATION_URL'
349
463
  };
350
464
  webex.meetings.meetingCollection.getByKey = sinon.stub().returns();
351
- webex.meetings.createMeeting = sinon.stub().returns(Promise.resolve({on: () => true}));
465
+ webex.meetings.createMeeting = sinon.stub().returns(Promise.resolve({
466
+ on: () => true
467
+ }));
352
468
  });
353
469
 
354
470
  it('should call MeetingInfo#fetchInfoOptions() with proper params',
@@ -404,17 +520,30 @@ skipInBrowser(describe)('plugin-meetings', () => {
404
520
  webex.meetings.handleLocusEvent = sinon.stub().returns(true);
405
521
  });
406
522
  it('doesnt call handle locus mercury for a locus roap event', () => {
407
- webex.meetings.handleLocusMercury({data: {eventType: 'locus.message.roap'}});
523
+ webex.meetings.handleLocusMercury({
524
+ data: {
525
+ eventType: 'locus.message.roap'
526
+ }
527
+ });
408
528
  assert.notCalled(webex.meetings.handleLocusEvent);
409
529
  });
410
530
  it('doesnt call handle locus mercury for an undefined eventType', () => {
411
- webex.meetings.handleLocusMercury({data: {}});
531
+ webex.meetings.handleLocusMercury({
532
+ data: {
533
+ }
534
+ });
412
535
  assert.notCalled(webex.meetings.handleLocusEvent);
413
536
  });
414
537
  it('calls handle locus mercury for all locus events', () => {
415
- webex.meetings.handleLocusMercury({data: {eventType: test1}});
538
+ webex.meetings.handleLocusMercury({
539
+ data: {
540
+ eventType: test1
541
+ }
542
+ });
416
543
  assert.calledOnce(webex.meetings.handleLocusEvent);
417
- assert.calledWith(webex.meetings.handleLocusEvent, {eventType: test1});
544
+ assert.calledWith(webex.meetings.handleLocusEvent, {
545
+ eventType: test1
546
+ });
418
547
  });
419
548
  });
420
549
  describe('#handleLocusEvent', () => {
@@ -423,14 +552,26 @@ skipInBrowser(describe)('plugin-meetings', () => {
423
552
 
424
553
  beforeEach(() => {
425
554
  parse = sinon.stub().returns(true);
426
- webex.meetings.meetingCollection.getByKey = sinon.stub().returns({locusInfo: {parse}});
555
+ webex.meetings.meetingCollection.getByKey = sinon.stub().returns({
556
+ locusInfo: {
557
+ parse
558
+ }
559
+ });
427
560
  });
428
561
  it('should parse the meeting info', () => {
429
- webex.meetings.handleLocusEvent({locusUrl: url1});
562
+ webex.meetings.handleLocusEvent({
563
+ locusUrl: url1
564
+ });
430
565
  assert.calledOnce(webex.meetings.meetingCollection.getByKey);
431
566
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
432
567
  assert.calledOnce(parse);
433
- assert.calledWith(parse, {locusInfo: {parse}}, {locusUrl: url1});
568
+ assert.calledWith(parse, {
569
+ locusInfo: {
570
+ parse
571
+ }
572
+ }, {
573
+ locusUrl: url1
574
+ });
434
575
  });
435
576
  });
436
577
  describe('there was not a meeting', () => {
@@ -439,28 +580,92 @@ skipInBrowser(describe)('plugin-meetings', () => {
439
580
  beforeEach(() => {
440
581
  initialSetup = sinon.stub().returns(true);
441
582
  webex.meetings.meetingCollection.getByKey = sinon.stub().returns(undefined);
442
- webex.meetings.create = sinon.stub().returns(Promise.resolve({locusInfo: {initialSetup}}));
583
+ webex.meetings.create = sinon.stub().returns(Promise.resolve({
584
+ locusInfo: {
585
+ initialSetup
586
+ }
587
+ }));
443
588
  });
444
589
  it('should setup the meeting by difference event', async () => {
445
- await webex.meetings.handleLocusEvent({locus: {id: uuid1, replaces: [{locusUrl: 'http:locusUrl'}], self: {callBackInfo: {callbackAddress: uri1}}}, eventType: 'locus.difference', locusUrl: url1});
590
+ await webex.meetings.handleLocusEvent({
591
+ locus: {
592
+ id: uuid1,
593
+ replaces: [{
594
+ locusUrl: 'http:locusUrl'
595
+ }],
596
+ self: {
597
+ callBackInfo: {
598
+ callbackAddress: uri1
599
+ }
600
+ }
601
+ },
602
+ eventType: 'locus.difference',
603
+ locusUrl: url1
604
+ });
446
605
  assert.callCount(webex.meetings.meetingCollection.getByKey, 5);
447
606
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
448
607
  assert.calledOnce(initialSetup);
449
- assert.calledWith(initialSetup, {id: uuid1, replaces: [{locusUrl: 'http:locusUrl'}], self: {callBackInfo: {callbackAddress: uri1}}});
608
+ assert.calledWith(initialSetup, {
609
+ id: uuid1,
610
+ replaces: [{
611
+ locusUrl: 'http:locusUrl'
612
+ }],
613
+ self: {
614
+ callBackInfo: {
615
+ callbackAddress: uri1
616
+ }
617
+ }
618
+ });
450
619
  });
451
620
  it('should setup the meeting by difference event without replaces', async () => {
452
- await webex.meetings.handleLocusEvent({locus: {id: uuid1, self: {callBackInfo: {callbackAddress: uri1}}}, eventType: 'locus.difference', locusUrl: url1});
621
+ await webex.meetings.handleLocusEvent({
622
+ locus: {
623
+ id: uuid1,
624
+ self: {
625
+ callBackInfo: {
626
+ callbackAddress: uri1
627
+ }
628
+ }
629
+ },
630
+ eventType: 'locus.difference',
631
+ locusUrl: url1
632
+ });
453
633
  assert.callCount(webex.meetings.meetingCollection.getByKey, 4);
454
634
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
455
635
  assert.calledOnce(initialSetup);
456
- assert.calledWith(initialSetup, {id: uuid1, self: {callBackInfo: {callbackAddress: uri1}}});
636
+ assert.calledWith(initialSetup, {
637
+ id: uuid1,
638
+ self: {
639
+ callBackInfo: {
640
+ callbackAddress: uri1
641
+ }
642
+ }
643
+ });
457
644
  });
458
645
  it('should setup the meeting by a not difference event', async () => {
459
- await webex.meetings.handleLocusEvent({locus: {id: uuid1, self: {callBackInfo: {callbackAddress: uri1}}}, eventType: test1, locusUrl: url1});
646
+ await webex.meetings.handleLocusEvent({
647
+ locus: {
648
+ id: uuid1,
649
+ self: {
650
+ callBackInfo: {
651
+ callbackAddress: uri1
652
+ }
653
+ }
654
+ },
655
+ eventType: test1,
656
+ locusUrl: url1
657
+ });
460
658
  assert.callCount(webex.meetings.meetingCollection.getByKey, 4);
461
659
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
462
660
  assert.calledOnce(initialSetup);
463
- assert.calledWith(initialSetup, {id: uuid1, self: {callBackInfo: {callbackAddress: uri1}}});
661
+ assert.calledWith(initialSetup, {
662
+ id: uuid1,
663
+ self: {
664
+ callBackInfo: {
665
+ callbackAddress: uri1
666
+ }
667
+ }
668
+ });
464
669
  });
465
670
  });
466
671
  });
@@ -471,23 +676,23 @@ skipInBrowser(describe)('plugin-meetings', () => {
471
676
  webex.internal.device.url = url1;
472
677
  MeetingCollection.set = sinon.stub().returns(true);
473
678
  MeetingsUtil.getMeetingAddedType = sinon.stub().returns('test');
474
- MeetingsUtil.extractDestination = sinon.stub().returns('test');
679
+ TriggerProxy.trigger.reset();
475
680
  });
476
681
  describe('successful MeetingInfo.#fetchMeetingInfo', () => {
477
682
  beforeEach(() => {
478
- webex.meetings.meetingInfo.fetchMeetingInfo = sinon.stub().returns(Promise.resolve({body: {permissionToken: 'PT', meetingJoinUrl: 'meetingJoinUrl'}}));
683
+ webex.meetings.meetingInfo.fetchMeetingInfo = sinon.stub().returns(Promise.resolve({
684
+ body: {
685
+ permissionToken: 'PT', meetingJoinUrl: 'meetingJoinUrl'
686
+ }
687
+ }));
479
688
  });
480
689
  it('creates the meeting from a successful meeting info fetch promise testing', async () => {
481
- const meeting = webex.meetings.createMeeting('test', 'test');
690
+ const meeting = await webex.meetings.createMeeting('test', 'test');
482
691
 
483
- assert.exists(meeting.then);
484
- await meeting;
485
692
  assert.calledOnce(webex.meetings.meetingInfo.fetchMeetingInfo);
486
- assert.calledOnce(MeetingsUtil.extractDestination);
487
693
  assert.calledOnce(MeetingsUtil.getMeetingAddedType);
488
694
  assert.calledTwice(TriggerProxy.trigger);
489
695
  assert.calledWith(webex.meetings.meetingInfo.fetchMeetingInfo, 'test');
490
- assert.calledWith(MeetingsUtil.extractDestination, 'test', 'test');
491
696
  assert.calledWith(MeetingsUtil.getMeetingAddedType, 'test');
492
697
  assert.equal(meeting.permissionToken, 'PT');
493
698
  assert.equal(meeting.meetingJoinUrl, 'meetingJoinUrl');
@@ -498,18 +703,21 @@ skipInBrowser(describe)('plugin-meetings', () => {
498
703
 
499
704
  assert.instanceOf(meeting, Meeting, 'createMeeting should eventually resolve to a Meeting Object');
500
705
  assert.calledOnce(webex.meetings.meetingInfo.fetchMeetingInfo);
501
- assert.calledOnce(MeetingsUtil.extractDestination);
502
706
  assert.calledOnce(MeetingsUtil.getMeetingAddedType);
503
707
  assert.calledTwice(TriggerProxy.trigger);
504
708
  assert.calledWith(webex.meetings.meetingInfo.fetchMeetingInfo, 'test');
505
- assert.calledWith(MeetingsUtil.extractDestination, 'test', 'test');
506
709
  assert.calledWith(MeetingsUtil.getMeetingAddedType, 'test');
507
- assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {file: 'meetings', function: 'createMeeting'}, 'meeting:added', {meeting: sinon.match.instanceOf(Meeting), type: 'test'});
710
+ assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {
711
+ file: 'meetings', function: 'createMeeting'
712
+ }, 'meeting:added', {
713
+ meeting: sinon.match.instanceOf(Meeting), type: 'test'
714
+ });
508
715
  });
509
716
  });
510
717
  describe('rejected MeetingInfo.#fetchMeetingInfo', () => {
511
718
  beforeEach(() => {
512
719
  console.error = sinon.stub().returns(false);
720
+ TriggerProxy.trigger.reset();
513
721
  webex.meetings.meetingInfo.fetchMeetingInfo = sinon.stub().returns(Promise.reject(new Error('test')));
514
722
  });
515
723
  it('creates the meeting from a rejected meeting info fetch', async () => {
@@ -517,19 +725,25 @@ skipInBrowser(describe)('plugin-meetings', () => {
517
725
 
518
726
  assert.instanceOf(meeting, Meeting, 'createMeeting should eventually resolve to a Meeting Object');
519
727
  assert.calledOnce(webex.meetings.meetingInfo.fetchMeetingInfo);
520
- assert.calledOnce(MeetingsUtil.extractDestination);
521
728
  assert.calledOnce(MeetingsUtil.getMeetingAddedType);
522
729
  assert.calledTwice(TriggerProxy.trigger);
523
730
  assert.calledWith(webex.meetings.meetingInfo.fetchMeetingInfo, 'test');
524
- assert.calledWith(MeetingsUtil.extractDestination, 'test', 'test');
525
731
  assert.calledWith(MeetingsUtil.getMeetingAddedType, 'test');
526
- assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {file: 'meetings', function: 'createMeeting'}, 'meeting:added', {meeting: sinon.match.instanceOf(Meeting), type: 'test'});
732
+ assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {
733
+ file: 'meetings', function: 'createMeeting'
734
+ }, 'meeting:added', {
735
+ meeting: sinon.match.instanceOf(Meeting), type: 'test'
736
+ });
527
737
  });
528
738
  });
529
739
  });
530
740
  });
531
741
  describe('Public Event Triggers', () => {
532
742
  describe('#destroy', () => {
743
+ beforeEach(() => {
744
+ MediaUtil.createPeerConnection = sinon.stub().returns(true);
745
+ MeetingUtil.cleanUp = sinon.stub();
746
+ });
533
747
  it('should have #destroy', () => {
534
748
  assert.exists(webex.meetings.destroy);
535
749
  });
@@ -538,23 +752,33 @@ skipInBrowser(describe)('plugin-meetings', () => {
538
752
  webex.meetings.meetingCollection.delete = sinon.stub().returns(true);
539
753
  });
540
754
 
541
- it('tests the destroy removal from the collection', () => {
542
- webex.meetings.destroy({id: uuid1}, test1);
755
+ it('tests the destroy removal from the collection', async () => {
756
+ const meeting = await webex.meetings.createMeeting('test', 'test');
757
+
758
+ webex.meetings.destroy(meeting, test1);
543
759
 
544
760
  assert.calledOnce(webex.meetings.meetingCollection.delete);
545
- assert.calledWith(webex.meetings.meetingCollection.delete, uuid1);
546
- assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {file: 'meetings', function: 'destroy'}, 'meeting:removed', {meetingId: uuid1, reason: test1});
761
+ assert.calledWith(webex.meetings.meetingCollection.delete, meeting.id);
762
+ assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {
763
+ file: 'meetings', function: 'destroy'
764
+ }, 'meeting:removed', {
765
+ meetingId: meeting.id, reason: test1
766
+ });
547
767
  });
548
768
  });
549
769
 
550
770
  describe('with auto upload logs enabled', () => {
551
771
  beforeEach(() => {
552
- webex.meetings.config.autoUploadLogs = true;
772
+ webex.config.autoUploadLogs = true;
553
773
  webex.meetings.loggerRequest.uploadLogs = sinon.stub().returns(Promise.resolve());
554
774
  });
555
775
 
556
- it('uploads logs on destroy', () => {
557
- webex.meetings.destroy({id: uuid1}, test1);
776
+ // Invalid test currently does not upload log on destroy of meeting when we do destory
777
+ // rather happens when we do leave or when via the meetign object action
778
+ xit('uploads logs on destroy', async () => {
779
+ const meeting = await webex.meetings.createMeeting('test', 'test');
780
+
781
+ webex.meetings.destroy(meeting, test1);
558
782
  assert.calledOnce(webex.meetings.loggerRequest.uploadLogs);
559
783
  });
560
784
  });
@@ -563,9 +787,13 @@ skipInBrowser(describe)('plugin-meetings', () => {
563
787
  describe('#network:disconnected', () => {
564
788
  it('should trigger event upon mercury disconnect', () => {
565
789
  const {meetings} = webex;
566
- const SCOPE = {file: 'meetings/index', function: 'handleMercuryOffline'};
790
+ const SCOPE = {
791
+ file: 'meetings/index', function: 'handleMercuryOffline'
792
+ };
567
793
  const EVENT = 'network:disconnected';
568
794
 
795
+ TriggerProxy.trigger.reset();
796
+
569
797
  meetings.handleMercuryOffline = sinon.spy(meetings.handleMercuryOffline);
570
798
  webex.internal.mercury.disconnect = sinon.stub().callsFake(meetings.handleMercuryOffline);
571
799
 
@@ -576,6 +804,15 @@ skipInBrowser(describe)('plugin-meetings', () => {
576
804
  assert.calledWith(TriggerProxy.trigger, webex.internal.mercury, SCOPE, EVENT);
577
805
  });
578
806
  });
807
+
808
+ describe('#fetchUserPreferredWebexSite', () => {
809
+ it('should call request.fetchLoginUserInformation to get the preferred webex site ', async () => {
810
+ assert.isDefined(webex.meetings.preferredWebexSite);
811
+ await webex.meetings.fetchUserPreferredWebexSite();
812
+
813
+ assert.equal(webex.meetings.preferredWebexSite, 'go.webex.com');
814
+ });
815
+ });
579
816
  });
580
817
  });
581
818
  });