@webex/plugin-meetings 2.7.0 → 2.10.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.
@@ -3399,6 +3399,8 @@ describe('plugin-meetings', () => {
3399
3399
  let canUserStopSpy;
3400
3400
  let canUserPauseSpy;
3401
3401
  let canUserResumeSpy;
3402
+ let canUserRaiseHandSpy;
3403
+ let canUserLowerAllHandsSpy;
3402
3404
 
3403
3405
 
3404
3406
  beforeEach(() => {
@@ -3410,6 +3412,8 @@ describe('plugin-meetings', () => {
3410
3412
  canUserPauseSpy = sinon.spy(MeetingUtil, 'canUserPause');
3411
3413
  canUserResumeSpy = sinon.spy(MeetingUtil, 'canUserResume');
3412
3414
  inMeetingActionsSetSpy = sinon.spy(meeting.inMeetingActions, 'set');
3415
+ canUserRaiseHandSpy = sinon.spy(MeetingUtil, 'canUserRaiseHand');
3416
+ canUserLowerAllHandsSpy = sinon.spy(MeetingUtil, 'canUserLowerAllHands');
3413
3417
  });
3414
3418
 
3415
3419
  afterEach(() => {
@@ -3442,6 +3446,8 @@ describe('plugin-meetings', () => {
3442
3446
  assert.calledWith(canUserStopSpy, payload.info.userDisplayHints);
3443
3447
  assert.calledWith(canUserPauseSpy, payload.info.userDisplayHints);
3444
3448
  assert.calledWith(canUserResumeSpy, payload.info.userDisplayHints);
3449
+ assert.calledWith(canUserRaiseHandSpy, payload.info.userDisplayHints);
3450
+ assert.calledWith(canUserLowerAllHandsSpy, payload.info.userDisplayHints);
3445
3451
 
3446
3452
  assert.calledWith(
3447
3453
  TriggerProxy.trigger,
@@ -214,6 +214,20 @@ describe('plugin-meetings', () => {
214
214
  });
215
215
  });
216
216
 
217
+ describe('canUserRaiseHand', () => {
218
+ it('works as expected', () => {
219
+ assert.deepEqual(MeetingUtil.canUserRaiseHand(['RAISE_HAND']), true);
220
+ assert.deepEqual(MeetingUtil.canUserRaiseHand([]), false);
221
+ });
222
+ });
223
+
224
+ describe('canUserLowerAllHands', () => {
225
+ it('works as expected', () => {
226
+ assert.deepEqual(MeetingUtil.canUserLowerAllHands(['LOWER_ALL_HANDS']), true);
227
+ assert.deepEqual(MeetingUtil.canUserLowerAllHands([]), false);
228
+ });
229
+ });
230
+
217
231
  describe('canUserLock', () => {
218
232
  it('works as expected', () => {
219
233
  assert.deepEqual(MeetingUtil.canUserLock(['LOCK_CONTROL_LOCK', 'LOCK_STATUS_UNLOCKED']), true);
@@ -362,4 +376,3 @@ describe('plugin-meetings', () => {
362
376
  });
363
377
  });
364
378
  });
365
-
@@ -0,0 +1,23 @@
1
+ import sinon from 'sinon';
2
+ import {assert} from '@webex/test-helper-chai';
3
+
4
+ import MemberUtil from '@webex/plugin-meetings/src/member/util';
5
+ import Member from '@webex/plugin-meetings/src/member';
6
+
7
+
8
+ describe('member', () => {
9
+ afterEach(() => {
10
+ sinon.restore();
11
+ });
12
+
13
+ it('checks that processParticipant calls isHandRaised', () => {
14
+ const participant = {controls: {}};
15
+
16
+ const member = new Member({});
17
+
18
+ sinon.spy(MemberUtil, 'isHandRaised');
19
+ member.processParticipant(participant);
20
+
21
+ assert.calledOnceWithExactly(MemberUtil.isHandRaised, participant);
22
+ });
23
+ });
@@ -0,0 +1,50 @@
1
+ import {assert} from '@webex/test-helper-chai';
2
+
3
+ import MemberUtil from '@webex/plugin-meetings/src/member/util';
4
+
5
+
6
+ describe('isHandRaised', () => {
7
+ it('throws error when there is no participant', () => {
8
+ assert.throws(() => {
9
+ MemberUtil.isHandRaised();
10
+ }, 'Raise hand could not be processed, participant is undefined.');
11
+ });
12
+
13
+ it('returns false when controls is not there', () => {
14
+ const participant = {};
15
+
16
+ assert.isFalse(MemberUtil.isHandRaised(participant));
17
+ });
18
+
19
+ it('returns false when hand is not there in controls', () => {
20
+ const participant = {
21
+ controls: {}
22
+ };
23
+
24
+ assert.isFalse(MemberUtil.isHandRaised(participant));
25
+ });
26
+
27
+ it('returns true when hand raised is true', () => {
28
+ const participant = {
29
+ controls: {
30
+ hand: {
31
+ raised: true
32
+ },
33
+ }
34
+ };
35
+
36
+ assert.isTrue(MemberUtil.isHandRaised(participant));
37
+ });
38
+
39
+ it('returns false when hand raised is false', () => {
40
+ const participant = {
41
+ controls: {
42
+ hand: {
43
+ raised: false
44
+ },
45
+ }
46
+ };
47
+
48
+ assert.isFalse(MemberUtil.isHandRaised(participant));
49
+ });
50
+ });
@@ -11,6 +11,7 @@ import {Credentials} from '@webex/webex-core';
11
11
  import Support from '@webex/internal-plugin-support';
12
12
  import MockWebex from '@webex/test-helper-mock-webex';
13
13
  import Meetings from '@webex/plugin-meetings';
14
+
14
15
  import Members from '@webex/plugin-meetings/src/members';
15
16
  import MembersUtil from '@webex/plugin-meetings/src/members/util';
16
17
 
@@ -189,5 +190,27 @@ describe('plugin-meetings', () => {
189
190
  assert.isRejected(members.cancelPhoneInvite({phoneNumber: '+18578675309'}));
190
191
  });
191
192
  });
193
+
194
+ describe('#raiseHand', () => {
195
+ it('should fire spies correctly when raiseOrLowerHand is called with valid params', async () => {
196
+ const members = createMembers({url: url1});
197
+
198
+ const {membersRequest} = members;
199
+
200
+ const generateOptionsSpy = sandbox.spy(MembersUtil, 'generateRaiseHandMemberOptions');
201
+ const raiseOrLowerHandMemberSpy = sandbox.spy(membersRequest, 'raiseOrLowerHandMember');
202
+
203
+ await members.raiseOrLowerHand('test1', true);
204
+
205
+ assert.calledOnce(generateOptionsSpy);
206
+ assert.calledOnce(raiseOrLowerHandMemberSpy);
207
+ });
208
+
209
+ it('should throw a rejection if there is no locus url', async () => {
210
+ const members = createMembers({url: false});
211
+
212
+ assert.isRejected(members.raiseOrLowerHand('test1', true));
213
+ });
214
+ });
192
215
  });
193
216
  });
@@ -4,6 +4,7 @@ import uuid from 'uuid';
4
4
  import chaiAsPromised from 'chai-as-promised';
5
5
  import MockWebex from '@webex/test-helper-mock-webex';
6
6
  import Meetings from '@webex/plugin-meetings';
7
+
7
8
  import MembersRequest from '@webex/plugin-meetings/src/members/request';
8
9
 
9
10
  const {assert} = chai;
@@ -97,5 +98,25 @@ describe('plugin-meetings', () => {
97
98
  assert.equal(requestParams.body.actionType, 'REMOVE');
98
99
  });
99
100
  });
101
+
102
+ describe('#raiseHand', () => {
103
+ it('sends a PATCH to the locus endpoint', async () => {
104
+ const locusUrl = url1;
105
+ const memberId = 'test1';
106
+
107
+ const options = {
108
+ memberId,
109
+ locusUrl,
110
+ raised: true
111
+ };
112
+
113
+ await membersRequest.raiseOrLowerHandMember(options);
114
+ const requestParams = membersRequest.request.getCall(0).args[0];
115
+
116
+ assert.equal(requestParams.method, 'PATCH');
117
+ assert.equal(requestParams.uri, `${locusUrl}/participant/${memberId}/controls`);
118
+ assert.equal(requestParams.body.hand.raised, true);
119
+ });
120
+ });
100
121
  });
101
122
  });