@webex/plugin-meetings 3.8.0-next.70 → 3.8.0-next.72

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.
@@ -4,7 +4,7 @@ import {cloneDeep, defaultsDeep} from 'lodash';
4
4
  import SelfUtils from '@webex/plugin-meetings/src/locus-info/selfUtils';
5
5
 
6
6
  import {self} from './selfConstant';
7
- import {_IDLE_, _WAIT_} from '@webex/plugin-meetings/src/constants';
7
+ import {_IDLE_, _WAIT_, _OBSERVE_, _NONE_} from '@webex/plugin-meetings/src/constants';
8
8
 
9
9
  describe('plugin-meetings', () => {
10
10
  describe('selfUtils', () => {
@@ -269,13 +269,18 @@ describe('plugin-meetings', () => {
269
269
  });
270
270
 
271
271
  describe('getSelves', () => {
272
+ let parsedSelf;
273
+
274
+ beforeEach(() => {
275
+ parsedSelf = SelfUtils.parse(self);
276
+ });
272
277
  describe('canNotViewTheParticipantListChanged', () => {
273
278
  it('should return canNotViewTheParticipantListChanged = true when changed', () => {
274
279
  const clonedSelf = cloneDeep(self);
275
280
 
276
281
  clonedSelf.canNotViewTheParticipantList = true; // different
277
282
 
278
- const {updates} = SelfUtils.getSelves(self, clonedSelf);
283
+ const {updates} = SelfUtils.getSelves(parsedSelf, clonedSelf);
279
284
 
280
285
  assert.equal(updates.canNotViewTheParticipantListChanged, true);
281
286
  });
@@ -285,7 +290,7 @@ describe('plugin-meetings', () => {
285
290
 
286
291
  clonedSelf.canNotViewTheParticipantList = false; // same
287
292
 
288
- const {updates} = SelfUtils.getSelves(self, clonedSelf);
293
+ const {updates} = SelfUtils.getSelves(parsedSelf, clonedSelf);
289
294
 
290
295
  assert.equal(updates.canNotViewTheParticipantListChanged, false);
291
296
  });
@@ -295,7 +300,7 @@ describe('plugin-meetings', () => {
295
300
  it('should return localAudioUnmuteRequestedByServer = false when requestedToUnmute = false', () => {
296
301
  const clonedSelf = cloneDeep(self);
297
302
 
298
- const {updates} = SelfUtils.getSelves(self, clonedSelf);
303
+ const {updates} = SelfUtils.getSelves(parsedSelf, clonedSelf);
299
304
 
300
305
  assert.equal(updates.localAudioUnmuteRequestedByServer, false);
301
306
  });
@@ -307,7 +312,7 @@ describe('plugin-meetings', () => {
307
312
  clonedSelf.controls.audio.requestedToUnmute = true;
308
313
  clonedSelf.controls.audio.lastModifiedRequestedToUnmute = '2023-06-16T18:25:04.369Z';
309
314
 
310
- const {updates} = SelfUtils.getSelves(self, clonedSelf);
315
+ const {updates} = SelfUtils.getSelves(parsedSelf, clonedSelf);
311
316
 
312
317
  assert.equal(updates.localAudioUnmuteRequestedByServer, true);
313
318
  });
@@ -321,7 +326,7 @@ describe('plugin-meetings', () => {
321
326
  clonedSelf.controls.audio.requestedToUnmute = true;
322
327
  clonedSelf.controls.audio.lastModifiedRequestedToUnmute = '2023-06-16T19:25:04.369Z';
323
328
 
324
- const {updates} = SelfUtils.getSelves(self, clonedSelf);
329
+ const {updates} = SelfUtils.getSelves(parsedSelf, clonedSelf);
325
330
 
326
331
  assert.equal(updates.localAudioUnmuteRequestedByServer, true);
327
332
  });
@@ -334,70 +339,139 @@ describe('plugin-meetings', () => {
334
339
  clonedSelf.controls.audio.requestedToUnmute = true;
335
340
  clonedSelf.controls.audio.lastModifiedRequestedToUnmute = '2023-06-16T18:25:04.369Z';
336
341
 
337
- const {updates} = SelfUtils.getSelves(self, clonedSelf);
342
+ const {updates} = SelfUtils.getSelves(parsedSelf, clonedSelf);
338
343
 
339
344
  assert.equal(updates.localAudioUnmuteRequestedByServer, false);
340
345
  });
341
346
  });
342
347
 
343
- describe('updates.isUserUnadmitted', () => {
344
- const testIsUserUnadmitted = (previousObjectDelta, currentObjectDelta, expected) => function () {
345
- const previous =
346
- previousObjectDelta === undefined ? undefined : defaultsDeep(previousObjectDelta, self);
347
- const current = defaultsDeep(currentObjectDelta, self);
348
-
349
- const {updates} = SelfUtils.getSelves(previous, current, self.devices[0].url);
350
-
351
- assert.equal(updates.isUserUnadmitted, expected);
352
- };
348
+ describe('updates.hasUserEnteredLobby', () => {
349
+ const testIsUserUnadmitted = (
350
+ previousParsedSelves,
351
+ currentSelfDelta,
352
+ participants,
353
+ expected
354
+ ) =>
355
+ function () {
356
+ const currentSelf = defaultsDeep(currentSelfDelta, self);
357
+
358
+ if (previousParsedSelves === undefined) {
359
+ parsedSelf.state = undefined;
360
+ } else {
361
+ parsedSelf = defaultsDeep(previousParsedSelves, parsedSelf);
362
+ }
363
+ const {updates} = SelfUtils.getSelves(
364
+ parsedSelf,
365
+ currentSelf,
366
+ currentSelf.devices[0].url,
367
+ participants
368
+ );
369
+
370
+ assert.equal(updates.hasUserEnteredLobby, expected);
371
+ };
353
372
 
354
373
  it(
355
374
  'should return true when previous is undefined and current is in lobby',
356
375
  testIsUserUnadmitted(
357
376
  undefined,
358
377
  {devices: [{intent: {type: _WAIT_}}], state: _IDLE_},
378
+ [],
359
379
  true
360
380
  )
361
381
  );
362
382
 
363
383
  it(
364
384
  'should return false when previous is undefined and user is not in meeting',
365
- testIsUserUnadmitted(undefined, {devices: [], state: _IDLE_}, false)
385
+ testIsUserUnadmitted(undefined, {devices: [], state: _IDLE_}, [], false)
366
386
  );
367
387
 
368
388
  it(
369
389
  'should return false when previous is undefined and current is in meeting',
370
- testIsUserUnadmitted(undefined, {}, false)
390
+ testIsUserUnadmitted(undefined, {}, [], false)
391
+ );
392
+
393
+ it(
394
+ 'should return true when previous is undefined and current is in lobby with paired device',
395
+ testIsUserUnadmitted(
396
+ undefined,
397
+ {
398
+ devices: [{intent: {type: _OBSERVE_, associatedWith: 'pairedDeviceUrl'}}],
399
+ state: _IDLE_,
400
+ },
401
+ [{url: 'pairedDeviceUrl', devices: [{intent: {type: _WAIT_}}]}],
402
+ true
403
+ )
404
+ );
405
+
406
+ it(
407
+ 'should return false when previous is in lobby with paired device and current is the same',
408
+ testIsUserUnadmitted(
409
+ {
410
+ pairedWith: {intent: {type: _WAIT_}},
411
+ joinedWith: {intent: {type: _OBSERVE_}},
412
+ state: _IDLE_,
413
+ },
414
+ {
415
+ devices: [{intent: {type: _OBSERVE_, associatedWith: 'pairedDeviceUrl'}}],
416
+ state: _IDLE_,
417
+ },
418
+ [{url: 'pairedDeviceUrl', devices: [{intent: {type: _WAIT_}}]}],
419
+ false
420
+ )
371
421
  );
372
422
 
373
423
  it(
374
424
  'should return false when previous is in lobby and current is in lobby',
375
425
  testIsUserUnadmitted(
426
+ {joinedWith: {intent: {type: _WAIT_}}, state: _IDLE_},
376
427
  {devices: [{intent: {type: _WAIT_}}], state: _IDLE_},
377
- {devices: [{intent: {type: _WAIT_}}], state: _IDLE_},
428
+ [],
429
+ false
430
+ )
431
+ );
432
+
433
+ it(
434
+ 'should return false when previous is in lobby with paired device and current is in the meeting',
435
+ testIsUserUnadmitted(
436
+ {
437
+ pairedWith: {intent: {type: _WAIT_}},
438
+ joinedWith: {intent: {type: _OBSERVE_}},
439
+ state: _IDLE_,
440
+ },
441
+ {
442
+ devices: [{intent: {type: _OBSERVE_, associatedWith: 'pairedDeviceUrl'}}],
443
+ state: _IDLE_,
444
+ },
445
+ [{url: 'pairedDeviceUrl', devices: [{intent: {type: _NONE_}}]}],
378
446
  false
379
447
  )
380
448
  );
381
449
 
382
450
  it(
383
451
  'should return false when previous is in lobby and current is in meeting',
384
- testIsUserUnadmitted({devices: [{intent: {type: _WAIT_}}], state: _IDLE_}, {}, false)
452
+ testIsUserUnadmitted({joinedWith: {intent: {type: _WAIT_}}, state: _IDLE_}, {}, [], false)
385
453
  );
386
454
 
387
455
  it(
388
456
  'should return true when previous is in meeting and current is in lobby',
389
- testIsUserUnadmitted({}, {devices: [{intent: {type: _WAIT_}}], state: _IDLE_}, true)
457
+ testIsUserUnadmitted({}, {devices: [{intent: {type: _WAIT_}}], state: _IDLE_}, [], true)
390
458
  );
391
459
  });
392
460
  });
393
461
 
394
462
  describe('isSharingBlocked', () => {
463
+ let parsedSelf;
464
+
465
+ beforeEach(() => {
466
+ parsedSelf = SelfUtils.parse(self);
467
+ });
468
+
395
469
  it('should return isSharingBlockedChanged = true when changed', () => {
396
470
  const clonedSelf = cloneDeep(self);
397
471
 
398
472
  clonedSelf.isSharingBlocked = true; // different
399
473
 
400
- const {updates} = SelfUtils.getSelves(self, clonedSelf);
474
+ const {updates} = SelfUtils.getSelves(parsedSelf, clonedSelf);
401
475
 
402
476
  assert.equal(updates.isSharingBlockedChanged, true);
403
477
  });
@@ -407,7 +481,7 @@ describe('plugin-meetings', () => {
407
481
 
408
482
  clonedSelf.isSharingBlocked = false; // same
409
483
 
410
- const {updates} = SelfUtils.getSelves(self, clonedSelf);
484
+ const {updates} = SelfUtils.getSelves(parsedSelf, clonedSelf);
411
485
 
412
486
  assert.equal(updates.isSharingBlockedChanged, false);
413
487
  });