@webex/plugin-meetings 1.157.1 → 1.158.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.
@@ -2,33 +2,34 @@
2
2
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
3
  */
4
4
  import 'jsdom-global/register';
5
- import {assert} from '@webex/test-helper-chai';
6
- import sinon from 'sinon';
7
- import MockWebex from '@webex/test-helper-mock-webex';
5
+
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
+
32
+ describe('plugin-meetings', () => {
32
33
  const logger = {
33
34
  log: () => {},
34
35
  info: () => {},
@@ -39,9 +40,14 @@ skipInBrowser(describe)('plugin-meetings', () => {
39
40
  };
40
41
 
41
42
  beforeEach(() => {
42
- StaticConfig.set({bandwidth: {audio: 50, video: 500}});
43
- LoggerConfig.set({verboseEvents: true, enable: false});
44
- LoggerProxy.set(logger);
43
+ StaticConfig.set({
44
+ bandwidth: {
45
+ audio: 50, video: 500
46
+ }
47
+ });
48
+ LoggerConfig.set({
49
+ verboseEvents: true, enable: false
50
+ });
45
51
  TriggerProxy.trigger = sinon.stub().returns(true);
46
52
  });
47
53
 
@@ -54,7 +60,7 @@ skipInBrowser(describe)('plugin-meetings', () => {
54
60
 
55
61
  describe('meetings index', () => {
56
62
  beforeEach(() => {
57
- MeetingsUtil.triggerH264Codec = sinon.stub();
63
+ MeetingsUtil.checkH264Support = sinon.stub();
58
64
  uuid1 = uuid.v4();
59
65
  url1 = `https://example.com/${uuid.v4()}`;
60
66
  uri1 = `test-${uuid.v4()}@example.com`;
@@ -69,11 +75,26 @@ skipInBrowser(describe)('plugin-meetings', () => {
69
75
  });
70
76
 
71
77
  Object.assign(webex.meetings.config, {
78
+ bandwidth: {
79
+ // please note, these are the maximum bandwidth values
80
+ // the server supports, minimums have to be tested
81
+ audio: 64000,
82
+ video: 4000000,
83
+ startBitrate: 2000
84
+ },
72
85
  experimental: {
73
86
  enableUnifiedMeetings: true
87
+ },
88
+ logging: {
89
+ enable: false,
90
+ verboseEvents: true
74
91
  }
75
92
  });
76
93
 
94
+ Object.assign(webex, {
95
+ logger
96
+ });
97
+
77
98
  Object.assign(webex.internal, {
78
99
  device: {
79
100
  deviceType: 'FAKE_DEVICE',
@@ -85,8 +106,23 @@ skipInBrowser(describe)('plugin-meetings', () => {
85
106
  disconnect: sinon.stub().returns(Promise.resolve()),
86
107
  on: () => {},
87
108
  off: () => {}
109
+ },
110
+ services: {
111
+ fetchLoginUserInformation: sinon.stub().returns(Promise.resolve({
112
+ userPreferences: [
113
+ 'SparkTOSAccept',
114
+ // eslint-disable-next-line no-useless-escape
115
+ '\"preferredWebExSite\":"\go.webex.com\"'
116
+ ]
117
+ })),
118
+ fetchClientRegionInfo: sinon.stub().returns(Promise.resolve())
119
+ },
120
+ metrics: {
121
+ submitClientMetrics: sinon.stub().returns(Promise.resolve())
88
122
  }
123
+
89
124
  });
125
+ webex.emit('ready');
90
126
  });
91
127
 
92
128
  it('has a webex instance with a meetings property', () => {
@@ -95,12 +131,12 @@ skipInBrowser(describe)('plugin-meetings', () => {
95
131
  });
96
132
 
97
133
  it('has set up the static config copy', () => {
98
- assert.equal(StaticConfig.meetings.bandwidth.audio, 50);
99
- assert.equal(StaticConfig.meetings.bandwidth.video, 500);
134
+ assert.equal(StaticConfig.meetings.bandwidth.audio, 64000);
135
+ assert.equal(StaticConfig.meetings.bandwidth.video, 4000000);
100
136
  });
101
137
 
102
138
  it('Should trigger h264 download', () => {
103
- assert.calledOnce(MeetingsUtil.triggerH264Codec);
139
+ assert.calledOnce(MeetingsUtil.checkH264Support);
104
140
  });
105
141
 
106
142
  describe('#_toggleUnifiedMeetings', () => {
@@ -131,7 +167,9 @@ skipInBrowser(describe)('plugin-meetings', () => {
131
167
  it('emits an event and resolves when register succeeds', (done) => {
132
168
  webex.canAuthorize = true;
133
169
  webex.meetings.register().then(() => {
134
- assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {file: 'meetings', function: 'register'}, 'meetings:registered');
170
+ assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {
171
+ file: 'meetings', function: 'register'
172
+ }, 'meetings:registered');
135
173
  assert.isTrue(webex.meetings.registered);
136
174
  done();
137
175
  });
@@ -170,7 +208,9 @@ skipInBrowser(describe)('plugin-meetings', () => {
170
208
  it('emits an event and resolves when unregister succeeds', (done) => {
171
209
  webex.meetings.registered = true;
172
210
  webex.meetings.unregister().then(() => {
173
- assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {file: 'meetings', function: 'unregister'}, 'meetings:unregistered');
211
+ assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {
212
+ file: 'meetings', function: 'unregister'
213
+ }, 'meetings:unregistered');
174
214
  assert.isFalse(webex.meetings.registered);
175
215
  done();
176
216
  });
@@ -262,9 +302,13 @@ skipInBrowser(describe)('plugin-meetings', () => {
262
302
  });
263
303
  describe('#getAllMeetings', () => {
264
304
  it('calls MeetingCollection to get all meetings with supplied options', () => {
265
- webex.meetings.getAllMeetings({test: test1});
305
+ webex.meetings.getAllMeetings({
306
+ test: test1
307
+ });
266
308
  assert.calledOnce(webex.meetings.meetingCollection.getAll);
267
- assert.calledWith(webex.meetings.meetingCollection.getAll, {test: test1});
309
+ assert.calledWith(webex.meetings.meetingCollection.getAll, {
310
+ test: test1
311
+ });
268
312
  });
269
313
  });
270
314
  });
@@ -276,14 +320,22 @@ skipInBrowser(describe)('plugin-meetings', () => {
276
320
  });
277
321
  describe('succesful requests', () => {
278
322
  beforeEach(() => {
279
- webex.meetings.request.getActiveMeetings = sinon.stub().returns(Promise.resolve({loci: [{url: url1}]}));
323
+ webex.meetings.request.getActiveMeetings = sinon.stub().returns(Promise.resolve({
324
+ loci: [{
325
+ url: url1
326
+ }]
327
+ }));
280
328
  });
281
329
  describe('when meeting is returned', () => {
282
330
  let parse;
283
331
 
284
332
  beforeEach(() => {
285
333
  parse = sinon.stub().returns(true);
286
- webex.meetings.meetingCollection.getByKey = sinon.stub().returns({locusInfo: {parse}});
334
+ webex.meetings.meetingCollection.getByKey = sinon.stub().returns({
335
+ locusInfo: {
336
+ parse
337
+ }
338
+ });
287
339
  });
288
340
  it('tests the sync meeting calls for existing meeting', async () => {
289
341
  await webex.meetings.syncMeetings();
@@ -299,7 +351,11 @@ skipInBrowser(describe)('plugin-meetings', () => {
299
351
  beforeEach(() => {
300
352
  initialSetup = sinon.stub().returns(true);
301
353
  webex.meetings.meetingCollection.getByKey = sinon.stub().returns(null);
302
- webex.meetings.create = sinon.stub().returns(Promise.resolve({locusInfo: {initialSetup}}));
354
+ webex.meetings.create = sinon.stub().returns(Promise.resolve({
355
+ locusInfo: {
356
+ initialSetup
357
+ }
358
+ }));
303
359
  });
304
360
  it('tests the sync meeting calls for not existing meeting', async () => {
305
361
  await webex.meetings.syncMeetings();
@@ -309,29 +365,51 @@ skipInBrowser(describe)('plugin-meetings', () => {
309
365
  assert.calledOnce(webex.meetings.create);
310
366
  assert.calledWith(webex.meetings.request.getActiveMeetings);
311
367
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
312
- assert.calledWith(webex.meetings.create, {url: url1}, 'LOCUS_ID');
313
- assert.calledWith(initialSetup, {url: url1});
368
+ assert.calledWith(webex.meetings.create, {
369
+ url: url1
370
+ }, 'LOCUS_ID');
371
+ assert.calledWith(initialSetup, {
372
+ url: url1
373
+ });
314
374
  });
315
375
  });
316
376
  describe('destory non active meeting', () => {
317
377
  let initialSetup;
318
378
  let parse;
379
+ let destroySpy;
319
380
 
320
381
  beforeEach(() => {
382
+ destroySpy = sinon.spy(webex.meetings, 'destroy');
321
383
  parse = sinon.stub().returns(true);
322
- webex.meetings.destroy = sinon.stub();
323
384
  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: []}));
385
+ webex.meetings.meetingCollection.getByKey = sinon.stub().returns({
386
+ locusInfo: {
387
+ parse
388
+ },
389
+ sendCallAnalyzerMetrics: sinon.stub()
390
+ });
391
+ webex.meetings.meetingCollection.getAll = sinon.stub().returns({
392
+ meetingutk: {
393
+ locusUrl: 'fdfdjfdhj', sendCallAnalyzerMetrics: sinon.stub()
394
+ }
395
+ });
396
+ webex.meetings.create = sinon.stub().returns(Promise.resolve({
397
+ locusInfo: {
398
+ initialSetup
399
+ },
400
+ sendCallAnalyzerMetrics: sinon.stub()
401
+ }));
402
+ webex.meetings.request.getActiveMeetings = sinon.stub().returns(Promise.resolve({
403
+ loci: []
404
+ }));
405
+ MeetingUtil.cleanUp = sinon.stub().returns(Promise.resolve());
328
406
  });
329
407
  it('destroy non active meetings', async () => {
330
408
  await webex.meetings.syncMeetings();
331
409
  assert.calledOnce(webex.meetings.request.getActiveMeetings);
332
- assert.calledOnce(webex.meetings.destroy);
410
+ assert.calledOnce(destroySpy);
333
411
 
334
- assert.calledOnce(MeetingsUtil.cleanUp);
412
+ assert.calledOnce(MeetingUtil.cleanUp);
335
413
  });
336
414
  });
337
415
  });
@@ -348,7 +426,9 @@ skipInBrowser(describe)('plugin-meetings', () => {
348
426
  type: 'CONVERSATION_URL'
349
427
  };
350
428
  webex.meetings.meetingCollection.getByKey = sinon.stub().returns();
351
- webex.meetings.createMeeting = sinon.stub().returns(Promise.resolve({on: () => true}));
429
+ webex.meetings.createMeeting = sinon.stub().returns(Promise.resolve({
430
+ on: () => true
431
+ }));
352
432
  });
353
433
 
354
434
  it('should call MeetingInfo#fetchInfoOptions() with proper params',
@@ -404,17 +484,30 @@ skipInBrowser(describe)('plugin-meetings', () => {
404
484
  webex.meetings.handleLocusEvent = sinon.stub().returns(true);
405
485
  });
406
486
  it('doesnt call handle locus mercury for a locus roap event', () => {
407
- webex.meetings.handleLocusMercury({data: {eventType: 'locus.message.roap'}});
487
+ webex.meetings.handleLocusMercury({
488
+ data: {
489
+ eventType: 'locus.message.roap'
490
+ }
491
+ });
408
492
  assert.notCalled(webex.meetings.handleLocusEvent);
409
493
  });
410
494
  it('doesnt call handle locus mercury for an undefined eventType', () => {
411
- webex.meetings.handleLocusMercury({data: {}});
495
+ webex.meetings.handleLocusMercury({
496
+ data: {
497
+ }
498
+ });
412
499
  assert.notCalled(webex.meetings.handleLocusEvent);
413
500
  });
414
501
  it('calls handle locus mercury for all locus events', () => {
415
- webex.meetings.handleLocusMercury({data: {eventType: test1}});
502
+ webex.meetings.handleLocusMercury({
503
+ data: {
504
+ eventType: test1
505
+ }
506
+ });
416
507
  assert.calledOnce(webex.meetings.handleLocusEvent);
417
- assert.calledWith(webex.meetings.handleLocusEvent, {eventType: test1});
508
+ assert.calledWith(webex.meetings.handleLocusEvent, {
509
+ eventType: test1
510
+ });
418
511
  });
419
512
  });
420
513
  describe('#handleLocusEvent', () => {
@@ -423,14 +516,26 @@ skipInBrowser(describe)('plugin-meetings', () => {
423
516
 
424
517
  beforeEach(() => {
425
518
  parse = sinon.stub().returns(true);
426
- webex.meetings.meetingCollection.getByKey = sinon.stub().returns({locusInfo: {parse}});
519
+ webex.meetings.meetingCollection.getByKey = sinon.stub().returns({
520
+ locusInfo: {
521
+ parse
522
+ }
523
+ });
427
524
  });
428
525
  it('should parse the meeting info', () => {
429
- webex.meetings.handleLocusEvent({locusUrl: url1});
526
+ webex.meetings.handleLocusEvent({
527
+ locusUrl: url1
528
+ });
430
529
  assert.calledOnce(webex.meetings.meetingCollection.getByKey);
431
530
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
432
531
  assert.calledOnce(parse);
433
- assert.calledWith(parse, {locusInfo: {parse}}, {locusUrl: url1});
532
+ assert.calledWith(parse, {
533
+ locusInfo: {
534
+ parse
535
+ }
536
+ }, {
537
+ locusUrl: url1
538
+ });
434
539
  });
435
540
  });
436
541
  describe('there was not a meeting', () => {
@@ -439,28 +544,92 @@ skipInBrowser(describe)('plugin-meetings', () => {
439
544
  beforeEach(() => {
440
545
  initialSetup = sinon.stub().returns(true);
441
546
  webex.meetings.meetingCollection.getByKey = sinon.stub().returns(undefined);
442
- webex.meetings.create = sinon.stub().returns(Promise.resolve({locusInfo: {initialSetup}}));
547
+ webex.meetings.create = sinon.stub().returns(Promise.resolve({
548
+ locusInfo: {
549
+ initialSetup
550
+ }
551
+ }));
443
552
  });
444
553
  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});
554
+ await webex.meetings.handleLocusEvent({
555
+ locus: {
556
+ id: uuid1,
557
+ replaces: [{
558
+ locusUrl: 'http:locusUrl'
559
+ }],
560
+ self: {
561
+ callBackInfo: {
562
+ callbackAddress: uri1
563
+ }
564
+ }
565
+ },
566
+ eventType: 'locus.difference',
567
+ locusUrl: url1
568
+ });
446
569
  assert.callCount(webex.meetings.meetingCollection.getByKey, 5);
447
570
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
448
571
  assert.calledOnce(initialSetup);
449
- assert.calledWith(initialSetup, {id: uuid1, replaces: [{locusUrl: 'http:locusUrl'}], self: {callBackInfo: {callbackAddress: uri1}}});
572
+ assert.calledWith(initialSetup, {
573
+ id: uuid1,
574
+ replaces: [{
575
+ locusUrl: 'http:locusUrl'
576
+ }],
577
+ self: {
578
+ callBackInfo: {
579
+ callbackAddress: uri1
580
+ }
581
+ }
582
+ });
450
583
  });
451
584
  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});
585
+ await webex.meetings.handleLocusEvent({
586
+ locus: {
587
+ id: uuid1,
588
+ self: {
589
+ callBackInfo: {
590
+ callbackAddress: uri1
591
+ }
592
+ }
593
+ },
594
+ eventType: 'locus.difference',
595
+ locusUrl: url1
596
+ });
453
597
  assert.callCount(webex.meetings.meetingCollection.getByKey, 4);
454
598
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
455
599
  assert.calledOnce(initialSetup);
456
- assert.calledWith(initialSetup, {id: uuid1, self: {callBackInfo: {callbackAddress: uri1}}});
600
+ assert.calledWith(initialSetup, {
601
+ id: uuid1,
602
+ self: {
603
+ callBackInfo: {
604
+ callbackAddress: uri1
605
+ }
606
+ }
607
+ });
457
608
  });
458
609
  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});
610
+ await webex.meetings.handleLocusEvent({
611
+ locus: {
612
+ id: uuid1,
613
+ self: {
614
+ callBackInfo: {
615
+ callbackAddress: uri1
616
+ }
617
+ }
618
+ },
619
+ eventType: test1,
620
+ locusUrl: url1
621
+ });
460
622
  assert.callCount(webex.meetings.meetingCollection.getByKey, 4);
461
623
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
462
624
  assert.calledOnce(initialSetup);
463
- assert.calledWith(initialSetup, {id: uuid1, self: {callBackInfo: {callbackAddress: uri1}}});
625
+ assert.calledWith(initialSetup, {
626
+ id: uuid1,
627
+ self: {
628
+ callBackInfo: {
629
+ callbackAddress: uri1
630
+ }
631
+ }
632
+ });
464
633
  });
465
634
  });
466
635
  });
@@ -471,23 +640,23 @@ skipInBrowser(describe)('plugin-meetings', () => {
471
640
  webex.internal.device.url = url1;
472
641
  MeetingCollection.set = sinon.stub().returns(true);
473
642
  MeetingsUtil.getMeetingAddedType = sinon.stub().returns('test');
474
- MeetingsUtil.extractDestination = sinon.stub().returns('test');
643
+ TriggerProxy.trigger.reset();
475
644
  });
476
645
  describe('successful MeetingInfo.#fetchMeetingInfo', () => {
477
646
  beforeEach(() => {
478
- webex.meetings.meetingInfo.fetchMeetingInfo = sinon.stub().returns(Promise.resolve({body: {permissionToken: 'PT', meetingJoinUrl: 'meetingJoinUrl'}}));
647
+ webex.meetings.meetingInfo.fetchMeetingInfo = sinon.stub().returns(Promise.resolve({
648
+ body: {
649
+ permissionToken: 'PT', meetingJoinUrl: 'meetingJoinUrl'
650
+ }
651
+ }));
479
652
  });
480
653
  it('creates the meeting from a successful meeting info fetch promise testing', async () => {
481
- const meeting = webex.meetings.createMeeting('test', 'test');
654
+ const meeting = await webex.meetings.createMeeting('test', 'test');
482
655
 
483
- assert.exists(meeting.then);
484
- await meeting;
485
656
  assert.calledOnce(webex.meetings.meetingInfo.fetchMeetingInfo);
486
- assert.calledOnce(MeetingsUtil.extractDestination);
487
657
  assert.calledOnce(MeetingsUtil.getMeetingAddedType);
488
658
  assert.calledTwice(TriggerProxy.trigger);
489
659
  assert.calledWith(webex.meetings.meetingInfo.fetchMeetingInfo, 'test');
490
- assert.calledWith(MeetingsUtil.extractDestination, 'test', 'test');
491
660
  assert.calledWith(MeetingsUtil.getMeetingAddedType, 'test');
492
661
  assert.equal(meeting.permissionToken, 'PT');
493
662
  assert.equal(meeting.meetingJoinUrl, 'meetingJoinUrl');
@@ -498,18 +667,21 @@ skipInBrowser(describe)('plugin-meetings', () => {
498
667
 
499
668
  assert.instanceOf(meeting, Meeting, 'createMeeting should eventually resolve to a Meeting Object');
500
669
  assert.calledOnce(webex.meetings.meetingInfo.fetchMeetingInfo);
501
- assert.calledOnce(MeetingsUtil.extractDestination);
502
670
  assert.calledOnce(MeetingsUtil.getMeetingAddedType);
503
671
  assert.calledTwice(TriggerProxy.trigger);
504
672
  assert.calledWith(webex.meetings.meetingInfo.fetchMeetingInfo, 'test');
505
- assert.calledWith(MeetingsUtil.extractDestination, 'test', 'test');
506
673
  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'});
674
+ assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {
675
+ file: 'meetings', function: 'createMeeting'
676
+ }, 'meeting:added', {
677
+ meeting: sinon.match.instanceOf(Meeting), type: 'test'
678
+ });
508
679
  });
509
680
  });
510
681
  describe('rejected MeetingInfo.#fetchMeetingInfo', () => {
511
682
  beforeEach(() => {
512
683
  console.error = sinon.stub().returns(false);
684
+ TriggerProxy.trigger.reset();
513
685
  webex.meetings.meetingInfo.fetchMeetingInfo = sinon.stub().returns(Promise.reject(new Error('test')));
514
686
  });
515
687
  it('creates the meeting from a rejected meeting info fetch', async () => {
@@ -517,19 +689,25 @@ skipInBrowser(describe)('plugin-meetings', () => {
517
689
 
518
690
  assert.instanceOf(meeting, Meeting, 'createMeeting should eventually resolve to a Meeting Object');
519
691
  assert.calledOnce(webex.meetings.meetingInfo.fetchMeetingInfo);
520
- assert.calledOnce(MeetingsUtil.extractDestination);
521
692
  assert.calledOnce(MeetingsUtil.getMeetingAddedType);
522
693
  assert.calledTwice(TriggerProxy.trigger);
523
694
  assert.calledWith(webex.meetings.meetingInfo.fetchMeetingInfo, 'test');
524
- assert.calledWith(MeetingsUtil.extractDestination, 'test', 'test');
525
695
  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'});
696
+ assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {
697
+ file: 'meetings', function: 'createMeeting'
698
+ }, 'meeting:added', {
699
+ meeting: sinon.match.instanceOf(Meeting), type: 'test'
700
+ });
527
701
  });
528
702
  });
529
703
  });
530
704
  });
531
705
  describe('Public Event Triggers', () => {
532
706
  describe('#destroy', () => {
707
+ beforeEach(() => {
708
+ MediaUtil.createPeerConnection = sinon.stub().returns(true);
709
+ MeetingUtil.cleanUp = sinon.stub();
710
+ });
533
711
  it('should have #destroy', () => {
534
712
  assert.exists(webex.meetings.destroy);
535
713
  });
@@ -538,23 +716,33 @@ skipInBrowser(describe)('plugin-meetings', () => {
538
716
  webex.meetings.meetingCollection.delete = sinon.stub().returns(true);
539
717
  });
540
718
 
541
- it('tests the destroy removal from the collection', () => {
542
- webex.meetings.destroy({id: uuid1}, test1);
719
+ it('tests the destroy removal from the collection', async () => {
720
+ const meeting = await webex.meetings.createMeeting('test', 'test');
721
+
722
+ webex.meetings.destroy(meeting, test1);
543
723
 
544
724
  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});
725
+ assert.calledWith(webex.meetings.meetingCollection.delete, meeting.id);
726
+ assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meetings), {
727
+ file: 'meetings', function: 'destroy'
728
+ }, 'meeting:removed', {
729
+ meetingId: meeting.id, reason: test1
730
+ });
547
731
  });
548
732
  });
549
733
 
550
734
  describe('with auto upload logs enabled', () => {
551
735
  beforeEach(() => {
552
- webex.meetings.config.autoUploadLogs = true;
736
+ webex.config.autoUploadLogs = true;
553
737
  webex.meetings.loggerRequest.uploadLogs = sinon.stub().returns(Promise.resolve());
554
738
  });
555
739
 
556
- it('uploads logs on destroy', () => {
557
- webex.meetings.destroy({id: uuid1}, test1);
740
+ // Invalid test currently does not upload log on destroy of meeting when we do destory
741
+ // rather happens when we do leave or when via the meetign object action
742
+ xit('uploads logs on destroy', async () => {
743
+ const meeting = await webex.meetings.createMeeting('test', 'test');
744
+
745
+ webex.meetings.destroy(meeting, test1);
558
746
  assert.calledOnce(webex.meetings.loggerRequest.uploadLogs);
559
747
  });
560
748
  });
@@ -563,9 +751,13 @@ skipInBrowser(describe)('plugin-meetings', () => {
563
751
  describe('#network:disconnected', () => {
564
752
  it('should trigger event upon mercury disconnect', () => {
565
753
  const {meetings} = webex;
566
- const SCOPE = {file: 'meetings/index', function: 'handleMercuryOffline'};
754
+ const SCOPE = {
755
+ file: 'meetings/index', function: 'handleMercuryOffline'
756
+ };
567
757
  const EVENT = 'network:disconnected';
568
758
 
759
+ TriggerProxy.trigger.reset();
760
+
569
761
  meetings.handleMercuryOffline = sinon.spy(meetings.handleMercuryOffline);
570
762
  webex.internal.mercury.disconnect = sinon.stub().callsFake(meetings.handleMercuryOffline);
571
763
 
@@ -19,6 +19,16 @@ describe('Peerconnection Manager', () => {
19
19
  onicecandidateerror: null,
20
20
  localDescription: {sdp}
21
21
  };
22
+
23
+ Object.defineProperty(global.window, 'RTCSessionDescription', {
24
+ writable: true,
25
+ value: class {
26
+ constructor(options) {
27
+ this.type = options.type;
28
+ this.sdp = options.sdp;
29
+ }
30
+ }
31
+ });
22
32
  });
23
33
  describe('setRemoteSessionDetails', () => {
24
34
  it('change the start bitrate on remoteSDP and remove extmap', async () => {