@webex/plugin-meetings 3.8.0-next.82 → 3.8.0-next.83

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.
@@ -32,58 +32,7 @@ sinon.assert.expose(chai.assert, {prefix: ''});
32
32
  describe('plugin-meetings', () => {
33
33
  let webex;
34
34
  let url1;
35
- const fakeMembersCollection = {
36
- test1: {
37
- namespace: 'Meetings',
38
- participant: {
39
- state: 'JOINED',
40
- type: 'USER',
41
- person: {
42
- id: '6eb08f8b-bf69-3251-a126-b161bead2d21',
43
- phoneNumber: '+18578675309',
44
- isExternal: true,
45
- primaryDisplayString: '+18578675309',
46
- },
47
- devices: [
48
- {
49
- url: 'https://fakeURL.com',
50
- deviceType: 'SIP',
51
- state: 'JOINED',
52
- intents: [null],
53
- correlationId: '1234',
54
- provisionalUrl: 'dialout:///fake',
55
- isSparkPstn: true,
56
- },
57
- {
58
- url: 'dialout:///fakeagain',
59
- deviceType: 'PROVISIONAL',
60
- state: 'JOINED',
61
- intents: [null],
62
- correlationId: '4321',
63
- isVideoCallback: false,
64
- clientUrl: 'https://fakeURL',
65
- provisionalType: 'DIAL_OUT_ONLY',
66
- dialingStatus: 'SUCCESS',
67
- },
68
- ],
69
- status: {
70
- audioStatus: 'SENDRECV',
71
- videoStatus: 'INACTIVE',
72
- },
73
- id: 'abc-123-abc-123',
74
- guest: true,
75
- resourceGuest: false,
76
- moderator: false,
77
- panelist: false,
78
- moveToLobbyNotAllowed: true,
79
- deviceUrl: 'https://fakeDeviceurl',
80
- },
81
- id: 'abc-123-abc-123',
82
- status: 'IN_MEETING',
83
- type: 'MEETING',
84
- isModerator: false,
85
- },
86
- };
35
+ let fakeMembersCollection;
87
36
 
88
37
  describe('members', () => {
89
38
  const sandbox = sinon.createSandbox();
@@ -92,6 +41,65 @@ describe('plugin-meetings', () => {
92
41
  let membersRequestSpy;
93
42
 
94
43
  beforeEach(() => {
44
+ fakeMembersCollection = {
45
+ test1: {
46
+ associatedUsers: new Set(),
47
+ namespace: 'Meetings',
48
+ participant: {
49
+ state: 'JOINED',
50
+ type: 'USER',
51
+ person: {
52
+ id: '6eb08f8b-bf69-3251-a126-b161bead2d21',
53
+ phoneNumber: '+18578675309',
54
+ isExternal: true,
55
+ primaryDisplayString: '+18578675309',
56
+ },
57
+ devices: [
58
+ {
59
+ url: 'https://fakeURL.com',
60
+ deviceType: 'SIP',
61
+ state: 'JOINED',
62
+ intents: [null],
63
+ correlationId: '1234',
64
+ provisionalUrl: 'dialout:///fake',
65
+ isSparkPstn: true,
66
+ },
67
+ {
68
+ url: 'dialout:///fakeagain',
69
+ deviceType: 'PROVISIONAL',
70
+ state: 'JOINED',
71
+ intents: [null],
72
+ correlationId: '4321',
73
+ isVideoCallback: false,
74
+ clientUrl: 'https://fakeURL',
75
+ provisionalType: 'DIAL_OUT_ONLY',
76
+ dialingStatus: 'SUCCESS',
77
+ },
78
+ ],
79
+ status: {
80
+ audioStatus: 'SENDRECV',
81
+ videoStatus: 'INACTIVE',
82
+ },
83
+ id: 'test1',
84
+ guest: true,
85
+ resourceGuest: false,
86
+ moderator: false,
87
+ panelist: false,
88
+ moveToLobbyNotAllowed: true,
89
+ deviceUrl: 'https://fakeDeviceurl',
90
+ url: 'fake participant url for test1',
91
+ },
92
+ id: 'test1',
93
+ status: 'IN_MEETING',
94
+ type: 'USER',
95
+ isModerator: false,
96
+ isHost: false,
97
+ isSelf: false,
98
+ isContentSharing: false,
99
+ pairedWith: {},
100
+ },
101
+ };
102
+
95
103
  webex = new MockWebex({
96
104
  children: {
97
105
  meetings: Meetings,
@@ -291,6 +299,110 @@ describe('plugin-meetings', () => {
291
299
  }
292
300
  );
293
301
  });
302
+
303
+ describe('handles members with paired devices correctly', () => {
304
+ const runCheck = (propsForUpdate, expectedPropsOnPairedMember) => {
305
+ const members = createMembers({url: url1});
306
+
307
+ const DEVICE_PARTICIPANT_URL = 'fake participant url for test2';
308
+
309
+ members.membersCollection.setAll(fakeMembersCollection);
310
+
311
+ // simulate a locus update with a member that has a paired device
312
+ members.locusParticipantsUpdate({
313
+ ...propsForUpdate,
314
+ participants: [
315
+ {
316
+ id: 'test1',
317
+ type: 'USER',
318
+ person: {},
319
+ devices: [
320
+ {
321
+ intents: [
322
+ {
323
+ type: 'OBSERVE',
324
+ associatedWith: DEVICE_PARTICIPANT_URL,
325
+ },
326
+ ],
327
+ },
328
+ ],
329
+ },
330
+ {
331
+ id: 'test2',
332
+ type: 'RESOURCE_ROOM',
333
+ person: {},
334
+ devices: [
335
+ {
336
+ state: 'JOINED',
337
+ intents: [null],
338
+ },
339
+ ],
340
+ url: DEVICE_PARTICIPANT_URL,
341
+ },
342
+ ],
343
+ });
344
+
345
+ let member = members.membersCollection.get('test1');
346
+ assert.isDefined(member.pairedWith);
347
+ assert.strictEqual(member.pairedWith.participantUrl, DEVICE_PARTICIPANT_URL);
348
+ assert.strictEqual(member.pairedWith.memberId, 'test2');
349
+
350
+ let pairedDeviceMember = members.membersCollection.get('test2');
351
+ assert(pairedDeviceMember.associatedUsers.has(member.id));
352
+ assert.strictEqual(pairedDeviceMember.associatedUser, member.id);
353
+ assert.strictEqual(pairedDeviceMember.associatedUsers.size, 1);
354
+
355
+ assert.strictEqual(
356
+ pairedDeviceMember.isPairedWithSelf,
357
+ expectedPropsOnPairedMember.isPairedWithSelf
358
+ );
359
+ assert.strictEqual(pairedDeviceMember.isHost, expectedPropsOnPairedMember.isHost);
360
+
361
+ // now simulate the user and paired device leaving the meeting
362
+ members.locusParticipantsUpdate({
363
+ ...propsForUpdate,
364
+ participants: [
365
+ {
366
+ id: 'test1',
367
+ type: 'USER',
368
+ person: {},
369
+ devices: [],
370
+ },
371
+ {
372
+ id: 'test2',
373
+ type: 'RESOURCE_ROOM',
374
+ person: {},
375
+ devices: [],
376
+ },
377
+ ],
378
+ });
379
+
380
+ // and check that all the relevant properties were reset
381
+ member = members.membersCollection.get('test1');
382
+ assert.isDefined(member.pairedWith);
383
+ assert.isUndefined(member.pairedWith.participantUrl);
384
+ assert.isUndefined(member.pairedWith.memberId);
385
+
386
+ pairedDeviceMember = members.membersCollection.get('test2');
387
+ assert.strictEqual(pairedDeviceMember.associatedUser, null);
388
+ assert.strictEqual(pairedDeviceMember.associatedUsers.size, 0);
389
+
390
+ assert.strictEqual(pairedDeviceMember.isPairedWithSelf, false);
391
+ assert.strictEqual(pairedDeviceMember.isHost, false);
392
+ };
393
+
394
+ it('sets the right properties when a member has a paired device', () => {
395
+ runCheck({}, {isPairedWithSelf: false, isHost: false});
396
+ });
397
+
398
+ it('sets the right properties when a member has a paired device (isSelf)', () => {
399
+ runCheck({selfId: 'test1'}, {isPairedWithSelf: true, isHost: false});
400
+ });
401
+
402
+ it('sets the right properties when a member has a paired device (isHost)', () => {
403
+ runCheck({hostId: 'test1'}, {isPairedWithSelf: false, isHost: true});
404
+ });
405
+ });
294
406
  });
295
407
  describe('#sendDialPadKey', () => {
296
408
  it('should throw a rejection when calling sendDialPadKey with no tones', async () => {