@webex/plugin-meetings 3.7.0-next.20 → 3.7.0-next.22

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.
@@ -11,12 +11,12 @@ describe('plugin-meetings', () => {
11
11
  let webex;
12
12
  let webinar;
13
13
  let uuidStub;
14
- let getUserTokenStub;
14
+ let getUserTokenStub;
15
15
 
16
16
  beforeEach(() => {
17
17
  // @ts-ignore
18
- getUserTokenStub = sinon.stub().resolves('test-token');
19
- uuidStub = sinon.stub(uuid,'v4').returns('test-uuid');
18
+ getUserTokenStub = sinon.stub().resolves('test-token');
19
+ uuidStub = sinon.stub(uuid,'v4').returns('test-uuid');
20
20
  webex = new MockWebex({});
21
21
  webex.internal.mercury.on = sinon.stub();
22
22
  webinar = new Webinar({}, {parent: webex});
@@ -26,10 +26,11 @@ describe('plugin-meetings', () => {
26
26
  webex.meetings = {};
27
27
  webex.credentials.getUserToken = getUserTokenStub;
28
28
  webex.meetings.getMeetingByType = sinon.stub();
29
+
29
30
  });
30
31
 
31
32
  afterEach(() => {
32
- sinon.restore();
33
+ sinon.restore();
33
34
  });
34
35
 
35
36
  describe('#locusUrlUpdate', () => {
@@ -102,6 +103,21 @@ describe('plugin-meetings', () => {
102
103
  assert.equal(result.isDemoted, true, 'should indicate demotion');
103
104
  });
104
105
 
106
+ it('updates roles when attendee just join meeting', () => {
107
+ const payload = {
108
+ oldRoles: [''],
109
+ newRoles: ['ATTENDEE']
110
+ };
111
+
112
+ const result = webinar.updateRoleChanged(payload);
113
+
114
+ assert.equal(webinar.selfIsPanelist, false, 'self should not be a panelist');
115
+ assert.equal(webinar.selfIsAttendee, true, 'self should be an attendee');
116
+ assert.equal(webinar.canManageWebcast, false, 'self should not have manage webcast capability');
117
+ assert.equal(result.isPromoted, false, 'should not indicate promotion');
118
+ assert.equal(result.isDemoted, true, 'should indicate demotion');
119
+ });
120
+
105
121
  it('updates roles when promoted to moderator', () => {
106
122
  const payload = {
107
123
  oldRoles: ['PANELIST'],
@@ -133,6 +149,107 @@ describe('plugin-meetings', () => {
133
149
  });
134
150
  });
135
151
 
152
+ describe('#updateStatusByRole', () => {
153
+ let updateLLMConnection;
154
+ let updateMediaShares;
155
+ beforeEach(() => {
156
+ // @ts-ignore
157
+ updateLLMConnection = sinon.stub();
158
+ updateMediaShares = sinon.stub()
159
+ webinar.webex.meetings = {
160
+ getMeetingByType: sinon.stub().returns({
161
+ id: 'meeting-id',
162
+ updateLLMConnection: updateLLMConnection,
163
+ shareStatus: 'whiteboard_share_active',
164
+ locusInfo: {
165
+ mediaShares: 'mediaShares',
166
+ updateMediaShares: updateMediaShares
167
+ }
168
+ })
169
+ };
170
+ });
171
+
172
+ afterEach(() => {
173
+ sinon.restore();
174
+ });
175
+
176
+ it('trigger updateLLMConnection if PS started', () => {
177
+
178
+ webinar.practiceSessionEnabled = true;
179
+ const roleChange = {isPromoted: true, isDemoted: false};
180
+
181
+ const result = webinar.updateStatusByRole(roleChange);
182
+
183
+ assert.calledOnce(updateLLMConnection);
184
+ });
185
+
186
+ it('Not trigger updateLLMConnection if PS not started', () => {
187
+
188
+ webinar.practiceSessionEnabled = false;
189
+ const roleChange = {isPromoted: true, isDemoted: false};
190
+
191
+ const result = webinar.updateStatusByRole(roleChange);
192
+
193
+ assert.notCalled(updateLLMConnection);
194
+ });
195
+
196
+ it('trigger updateMediaShares if promoted', () => {
197
+
198
+ const roleChange = {isPromoted: true, isDemoted: false};
199
+
200
+ const result = webinar.updateStatusByRole(roleChange);
201
+
202
+ assert.calledOnce(updateMediaShares);
203
+ });
204
+
205
+ it('Not trigger updateMediaShares if no role change', () => {
206
+
207
+ const roleChange = {isPromoted: false, isDemoted: false};
208
+
209
+ const result = webinar.updateStatusByRole(roleChange);
210
+
211
+ assert.notCalled(updateMediaShares);
212
+ });
213
+ it('trigger updateMediaShares if is promoted', () => {
214
+
215
+ const roleChange = {isPromoted: true, isDemoted: false};
216
+
217
+ const result = webinar.updateStatusByRole(roleChange);
218
+
219
+ assert.calledOnce(updateMediaShares);
220
+ });
221
+
222
+ it('trigger updateMediaShares if is attendee with whiteboard share', () => {
223
+
224
+ const roleChange = {isPromoted: false, isDemoted: true};
225
+
226
+ const result = webinar.updateStatusByRole(roleChange);
227
+
228
+ assert.calledOnce(updateMediaShares);
229
+ });
230
+
231
+ it('Not trigger updateMediaShares if is attendee with screen share', () => {
232
+
233
+ webinar.webex.meetings = {
234
+ getMeetingByType: sinon.stub().returns({
235
+ id: 'meeting-id',
236
+ updateLLMConnection: updateLLMConnection,
237
+ shareStatus: 'remote_share_active',
238
+ locusInfo: {
239
+ mediaShares: 'mediaShares',
240
+ updateMediaShares: updateMediaShares
241
+ }
242
+ })
243
+ };
244
+
245
+ const roleChange = {isPromoted: false, isDemoted: true};
246
+
247
+ const result = webinar.updateStatusByRole(roleChange);
248
+
249
+ assert.notCalled(updateMediaShares);
250
+ });
251
+ });
252
+
136
253
  describe("#setPracticeSessionState", () => {
137
254
  [true, false].forEach((enabled) => {
138
255
  it(`sends a PATCH request to ${enabled ? "enable" : "disable"} the practice session`, async () => {
@@ -166,6 +283,30 @@ describe('plugin-meetings', () => {
166
283
  });
167
284
  });
168
285
 
286
+ describe('#isJoinPracticeSessionDataChannel', () => {
287
+ it('check whether should join PS data channel', () => {
288
+ webinar.selfIsPanelist = true;
289
+ webinar.practiceSessionEnabled = false;
290
+
291
+ assert.equal(webinar.isJoinPracticeSessionDataChannel(), false);
292
+
293
+ webinar.selfIsPanelist = true;
294
+ webinar.practiceSessionEnabled = true;
295
+
296
+ assert.equal(webinar.isJoinPracticeSessionDataChannel(), true);
297
+
298
+ webinar.selfIsPanelist = false;
299
+ webinar.practiceSessionEnabled = false;
300
+
301
+ assert.equal(webinar.isJoinPracticeSessionDataChannel(), false);
302
+
303
+ webinar.selfIsPanelist = false;
304
+ webinar.practiceSessionEnabled = true;
305
+
306
+ assert.equal(webinar.isJoinPracticeSessionDataChannel(), false);
307
+ });
308
+ });
309
+
169
310
  describe('#updatePracticeSessionStatus', () => {
170
311
  it('sets PS state true', () => {
171
312
  webinar.updatePracticeSessionStatus({enabled: true});
@@ -263,11 +404,11 @@ describe('plugin-meetings', () => {
263
404
  });
264
405
  assert.equal(result, "REQUEST_RETURN_VALUE", "should return the resolved value from the request");
265
406
  });
266
-
407
+
267
408
  it('handles API call failures gracefully', async () => {
268
409
  webex.request.rejects(new Error('API_ERROR'));
269
410
  const errorLogger = sinon.stub(LoggerProxy.logger, 'error');
270
-
411
+
271
412
  try {
272
413
  await webinar.stopWebcast();
273
414
  assert.fail('stopWebcast should throw an error');
@@ -277,7 +418,7 @@ describe('plugin-meetings', () => {
277
418
  assert.calledWith(errorLogger, 'Meeting:webinar#stopWebcast failed', sinon.match.instanceOf(Error));
278
419
  } finally {
279
420
  errorLogger.restore();
280
- }
421
+ }
281
422
  });
282
423
  });
283
424
 
@@ -296,11 +437,11 @@ describe('plugin-meetings', () => {
296
437
  });
297
438
  assert.equal(result, "REQUEST_RETURN_VALUE", "should return the resolved value from the request");
298
439
  });
299
-
440
+
300
441
  it('handles API call failures gracefully', async () => {
301
442
  webex.request.rejects(new Error('API_ERROR'));
302
443
  const errorLogger = sinon.stub(LoggerProxy.logger, 'error');
303
-
444
+
304
445
  try {
305
446
  await webinar.queryWebcastLayout();
306
447
  assert.fail('queryWebcastLayout should throw an error');
@@ -310,7 +451,7 @@ describe('plugin-meetings', () => {
310
451
  assert.calledWith(errorLogger, 'Meeting:webinar#queryWebcastLayout failed', sinon.match.instanceOf(Error));
311
452
  } finally {
312
453
  errorLogger.restore();
313
- }
454
+ }
314
455
  });
315
456
  });
316
457
 
@@ -338,11 +479,11 @@ describe('plugin-meetings', () => {
338
479
  });
339
480
  assert.equal(result, "REQUEST_RETURN_VALUE", "should return the resolved value from the request");
340
481
  });
341
-
482
+
342
483
  it('handles API call failures gracefully', async () => {
343
484
  webex.request.rejects(new Error('API_ERROR'));
344
485
  const errorLogger = sinon.stub(LoggerProxy.logger, 'error');
345
-
486
+
346
487
  try {
347
488
  await webinar.updateWebcastLayout(layout);
348
489
  assert.fail('updateWebcastLayout should throw an error');
@@ -352,15 +493,15 @@ describe('plugin-meetings', () => {
352
493
  assert.calledWith(errorLogger, 'Meeting:webinar#updateWebcastLayout failed', sinon.match.instanceOf(Error));
353
494
  } finally {
354
495
  errorLogger.restore();
355
- }
496
+ }
356
497
  });
357
498
  });
358
-
499
+
359
500
  describe("#searchWebcastAttendees", () => {
360
501
  const queryString = 'queryString';
361
502
  const specialCharsQuery = 'query@string!';
362
503
  const emptyQuery = '';
363
-
504
+
364
505
  it("sends a GET request to search the webcast attendees", async () => {
365
506
  const result = await webinar.searchWebcastAttendees(queryString);
366
507
  assert.calledOnce(webex.request);
@@ -374,11 +515,11 @@ describe('plugin-meetings', () => {
374
515
  });
375
516
  assert.equal(result, "REQUEST_RETURN_VALUE", "should return the resolved value from the request");
376
517
  });
377
-
518
+
378
519
  it('handles API call failures gracefully', async () => {
379
520
  webex.request.rejects(new Error('API_ERROR'));
380
521
  const errorLogger = sinon.stub(LoggerProxy.logger, 'error');
381
-
522
+
382
523
  try {
383
524
  await webinar.searchWebcastAttendees(queryString);
384
525
  assert.fail('searchWebcastAttendees should throw an error');
@@ -390,7 +531,7 @@ describe('plugin-meetings', () => {
390
531
  errorLogger.restore();
391
532
  }
392
533
  });
393
-
534
+
394
535
  it("should handle empty query string", async () => {
395
536
  const result = await webinar.searchWebcastAttendees(emptyQuery);
396
537
  assert.calledOnce(webex.request);
@@ -404,7 +545,7 @@ describe('plugin-meetings', () => {
404
545
  });
405
546
  assert.equal(result, "REQUEST_RETURN_VALUE", "should return the resolved value from the request");
406
547
  });
407
-
548
+
408
549
  it("should handle query string with special characters", async () => {
409
550
  const result = await webinar.searchWebcastAttendees(specialCharsQuery);
410
551
  assert.calledOnce(webex.request);
@@ -419,7 +560,7 @@ describe('plugin-meetings', () => {
419
560
  assert.equal(result, "REQUEST_RETURN_VALUE", "should return the resolved value from the request");
420
561
  });
421
562
  });
422
-
563
+
423
564
 
424
565
  describe("#viewAllWebcastAttendees", () => {
425
566
  it(`sends a GET request to view all the webcast attendees`, async () => {
@@ -435,11 +576,11 @@ describe('plugin-meetings', () => {
435
576
  });
436
577
  assert.equal(result, "REQUEST_RETURN_VALUE", "should return the resolved value from the request");
437
578
  });
438
-
579
+
439
580
  it('handles API call failures gracefully', async () => {
440
581
  webex.request.rejects(new Error('API_ERROR'));
441
582
  const errorLogger = sinon.stub(LoggerProxy.logger, 'error');
442
-
583
+
443
584
  try {
444
585
  await webinar.viewAllWebcastAttendees();
445
586
  assert.fail('viewAllWebcastAttendees should throw an error');
@@ -449,10 +590,10 @@ describe('plugin-meetings', () => {
449
590
  assert.calledWith(errorLogger, 'Meeting:webinar#viewAllWebcastAttendees failed', sinon.match.instanceOf(Error));
450
591
  } finally {
451
592
  errorLogger.restore();
452
- }
593
+ }
453
594
  });
454
595
  });
455
-
596
+
456
597
  describe("#expelWebcastAttendee", () => {
457
598
  const participantId = 'participantId'
458
599
  it(`sends a DELETE request to expel the webcast attendee`, async () => {
@@ -468,11 +609,11 @@ describe('plugin-meetings', () => {
468
609
  });
469
610
  assert.equal(result, "REQUEST_RETURN_VALUE", "should return the resolved value from the request");
470
611
  });
471
-
612
+
472
613
  it('handles API call failures gracefully', async () => {
473
614
  webex.request.rejects(new Error('API_ERROR'));
474
615
  const errorLogger = sinon.stub(LoggerProxy.logger, 'error');
475
-
616
+
476
617
  try {
477
618
  await webinar.expelWebcastAttendee(participantId);
478
619
  assert.fail('expelWebcastAttendee should throw an error');