@webex/plugin-meetings 2.2.2 → 2.3.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.
@@ -0,0 +1,55 @@
1
+ import {assert} from '@webex/test-helper-chai';
2
+
3
+ import InMeetingActions from '@webex/plugin-meetings/src/meeting/in-meeting-actions';
4
+
5
+
6
+ describe('plugin-meetings', () => {
7
+ describe('in-meeting-actions', () => {
8
+ const checkValues = (actions, expected) => {
9
+ const expectedValues = {
10
+ canLock: null,
11
+ canUnlock: null,
12
+ canAssignHost: null,
13
+ canStartRecording: null,
14
+ canPauseRecording: null,
15
+ canResumeRecording: null,
16
+ canStopRecording: null,
17
+ ...expected
18
+ };
19
+
20
+ // Check get retuns all the correct values at once
21
+ assert.deepEqual(actions.get(), expectedValues);
22
+
23
+ // Check each value individually
24
+ Object.keys(expectedValues).forEach((key) => {
25
+ assert.deepEqual(actions[key], expectedValues[key]);
26
+ });
27
+ };
28
+
29
+ [
30
+ 'canLock',
31
+ 'canUnlock',
32
+ 'canAssignHost',
33
+ 'canStartRecording',
34
+ 'canPauseRecording',
35
+ 'canResumeRecording',
36
+ 'canStopRecording'
37
+ ].forEach((key) => {
38
+ it(`get and set for ${key} work as expected`, () => {
39
+ const inMeetingActions = new InMeetingActions();
40
+
41
+ checkValues(inMeetingActions);
42
+
43
+ let changed = inMeetingActions.set({[key]: true});
44
+
45
+ assert.isTrue(changed);
46
+
47
+ checkValues(inMeetingActions, {[key]: true});
48
+
49
+ changed = inMeetingActions.set({[key]: true});
50
+
51
+ assert.isFalse(changed);
52
+ });
53
+ });
54
+ });
55
+ });
@@ -3145,6 +3145,126 @@ describe('plugin-meetings', () => {
3145
3145
  assert.equal(meeting.correlationId, uuid1);
3146
3146
  });
3147
3147
  });
3148
+
3149
+ describe('#setUpLocusInfoAssignHostListener', () => {
3150
+ let locusInfoOnSpy;
3151
+ let inMeetingActionsSetSpy;
3152
+
3153
+ beforeEach(() => {
3154
+ locusInfoOnSpy = sinon.spy(meeting.locusInfo, 'on');
3155
+ inMeetingActionsSetSpy = sinon.spy(meeting.inMeetingActions, 'set');
3156
+ });
3157
+
3158
+ afterEach(() => {
3159
+ locusInfoOnSpy.restore();
3160
+ inMeetingActionsSetSpy.restore();
3161
+ });
3162
+
3163
+ it('registers the correct event', () => {
3164
+ meeting.setUpLocusInfoAssignHostListener();
3165
+
3166
+ assert.calledOnce(locusInfoOnSpy);
3167
+
3168
+ assert.equal(locusInfoOnSpy.firstCall.args[0], 'LOCUS_INFO_CAN_ASSIGN_HOST');
3169
+ const callback = locusInfoOnSpy.firstCall.args[1];
3170
+
3171
+ const payload = {canAssignHost: true};
3172
+
3173
+ callback(payload);
3174
+
3175
+ assert.calledWith(inMeetingActionsSetSpy, payload);
3176
+
3177
+ assert.calledWith(
3178
+ TriggerProxy.trigger,
3179
+ meeting,
3180
+ {
3181
+ file: 'meeting/index',
3182
+ function: 'setUpLocusInfoAssignHostListener'
3183
+ },
3184
+ 'meeting:actionsUpdate',
3185
+ meeting.inMeetingActions.get()
3186
+ );
3187
+
3188
+ TriggerProxy.trigger.resetHistory();
3189
+
3190
+ callback(payload);
3191
+
3192
+ assert.notCalled(TriggerProxy.trigger);
3193
+ });
3194
+ });
3195
+
3196
+ describe('#setUpLocusInfoMeetingInfoListener', () => {
3197
+ let locusInfoOnSpy;
3198
+ let inMeetingActionsSetSpy;
3199
+ let canUserLockSpy;
3200
+ let canUserUnlockSpy;
3201
+ let canUserRecordSpy;
3202
+ let canUserStopSpy;
3203
+ let canUserPauseSpy;
3204
+ let canUserResumeSpy;
3205
+
3206
+
3207
+ beforeEach(() => {
3208
+ locusInfoOnSpy = sinon.spy(meeting.locusInfo, 'on');
3209
+ canUserLockSpy = sinon.spy(MeetingUtil, 'canUserLock');
3210
+ canUserUnlockSpy = sinon.spy(MeetingUtil, 'canUserUnlock');
3211
+ canUserRecordSpy = sinon.spy(MeetingUtil, 'canUserRecord');
3212
+ canUserStopSpy = sinon.spy(MeetingUtil, 'canUserStop');
3213
+ canUserPauseSpy = sinon.spy(MeetingUtil, 'canUserPause');
3214
+ canUserResumeSpy = sinon.spy(MeetingUtil, 'canUserResume');
3215
+ inMeetingActionsSetSpy = sinon.spy(meeting.inMeetingActions, 'set');
3216
+ });
3217
+
3218
+ afterEach(() => {
3219
+ locusInfoOnSpy.restore();
3220
+ inMeetingActionsSetSpy.restore();
3221
+ });
3222
+
3223
+
3224
+ it('registers the correct MEETING_INFO_UPDATED event', () => {
3225
+ meeting.setUpLocusInfoMeetingInfoListener();
3226
+
3227
+ assert.calledThrice(locusInfoOnSpy);
3228
+
3229
+ assert.equal(locusInfoOnSpy.firstCall.args[0], 'MEETING_LOCKED');
3230
+ assert.equal(locusInfoOnSpy.secondCall.args[0], 'MEETING_UNLOCKED');
3231
+ assert.equal(locusInfoOnSpy.thirdCall.args[0], 'MEETING_INFO_UPDATED');
3232
+ const callback = locusInfoOnSpy.thirdCall.args[1];
3233
+
3234
+ const payload = {
3235
+ info: {
3236
+ userDisplayHints: ['LOCK_CONTROL_UNLOCK']
3237
+ }
3238
+ };
3239
+
3240
+ callback(payload);
3241
+
3242
+ assert.calledWith(canUserLockSpy, payload.info.userDisplayHints);
3243
+ assert.calledWith(canUserUnlockSpy, payload.info.userDisplayHints);
3244
+ assert.calledWith(canUserRecordSpy, payload.info.userDisplayHints);
3245
+ assert.calledWith(canUserStopSpy, payload.info.userDisplayHints);
3246
+ assert.calledWith(canUserPauseSpy, payload.info.userDisplayHints);
3247
+ assert.calledWith(canUserResumeSpy, payload.info.userDisplayHints);
3248
+
3249
+ assert.calledWith(
3250
+ TriggerProxy.trigger,
3251
+ meeting,
3252
+ {
3253
+ file: 'meeting/index',
3254
+ function: 'setUpLocusInfoMeetingInfoListener'
3255
+ },
3256
+ 'meeting:actionsUpdate',
3257
+ meeting.inMeetingActions.get()
3258
+ );
3259
+
3260
+ TriggerProxy.trigger.resetHistory();
3261
+
3262
+ callback(payload);
3263
+
3264
+ assert.notCalled(TriggerProxy.trigger);
3265
+ });
3266
+ });
3267
+
3148
3268
  describe('#setLocus', () => {
3149
3269
  beforeEach(() => {
3150
3270
  meeting.locusInfo.initialSetup = sinon.stub().returns(true);
@@ -1,5 +1,6 @@
1
1
  import sinon from 'sinon';
2
2
  import {assert} from '@webex/test-helper-chai';
3
+
3
4
  import MeetingUtil from '@webex/plugin-meetings/src/meeting/util';
4
5
  import LoggerProxy from '@webex/plugin-meetings/src/common/logs/logger-proxy';
5
6
  import LoggerConfig
@@ -173,6 +174,192 @@ describe('plugin-meetings', () => {
173
174
  assert.equal(parameter.meetingNumber, 'meetingNumber');
174
175
  });
175
176
  });
177
+
178
+ describe('getUserDisplayHintsFromLocusInfo', () => {
179
+ it('returns display hints', () => {
180
+ assert.deepEqual(MeetingUtil.getUserDisplayHintsFromLocusInfo(), []);
181
+
182
+ assert.deepEqual(
183
+ MeetingUtil.getUserDisplayHintsFromLocusInfo({}),
184
+ []
185
+ );
186
+
187
+ assert.deepEqual(
188
+ MeetingUtil.getUserDisplayHintsFromLocusInfo({parsedLocus: {}}),
189
+ []
190
+ );
191
+
192
+ assert.deepEqual(
193
+ MeetingUtil.getUserDisplayHintsFromLocusInfo({parsedLocus: {info: {}}}),
194
+ []
195
+ );
196
+
197
+ assert.deepEqual(
198
+ MeetingUtil.getUserDisplayHintsFromLocusInfo({parsedLocus: {info: {userDisplayHints: []}}}),
199
+ []
200
+ );
201
+
202
+ assert.deepEqual(
203
+ MeetingUtil.getUserDisplayHintsFromLocusInfo({
204
+ parsedLocus: {
205
+ info: {
206
+ userDisplayHints: [
207
+ 'HINT_1'
208
+ ]
209
+ }
210
+ }
211
+ }),
212
+ ['HINT_1']
213
+ );
214
+ });
215
+ });
216
+
217
+ describe('canUserLock', () => {
218
+ it('works as expected', () => {
219
+ assert.deepEqual(MeetingUtil.canUserLock(['LOCK_CONTROL_LOCK', 'LOCK_STATUS_UNLOCKED']), true);
220
+ assert.deepEqual(MeetingUtil.canUserLock(['LOCK_CONTROL_LOCK']), false);
221
+ assert.deepEqual(MeetingUtil.canUserLock(['LOCK_STATUS_UNLOCKED']), false);
222
+ assert.deepEqual(MeetingUtil.canUserLock([]), false);
223
+ });
224
+ });
225
+
226
+ describe('canUserUnlock', () => {
227
+ it('works as expected', () => {
228
+ assert.deepEqual(MeetingUtil.canUserUnlock(['LOCK_CONTROL_UNLOCK', 'LOCK_STATUS_LOCKED']), true);
229
+ assert.deepEqual(MeetingUtil.canUserUnlock(['LOCK_CONTROL_UNLOCK']), false);
230
+ assert.deepEqual(MeetingUtil.canUserUnlock(['LOCK_STATUS_LOCKED']), false);
231
+ assert.deepEqual(MeetingUtil.canUserUnlock([]), false);
232
+ });
233
+ });
234
+
235
+ describe('canUserRecord', () => {
236
+ it('works as expected', () => {
237
+ assert.deepEqual(MeetingUtil.canUserRecord(['RECORDING_CONTROL_START']), true);
238
+ assert.deepEqual(MeetingUtil.canUserRecord([]), false);
239
+ });
240
+ });
241
+
242
+ describe('canUserPause', () => {
243
+ it('works as expected', () => {
244
+ assert.deepEqual(MeetingUtil.canUserPause(['RECORDING_CONTROL_PAUSE']), true);
245
+ assert.deepEqual(MeetingUtil.canUserPause([]), false);
246
+ });
247
+ });
248
+
249
+ describe('canUserResume', () => {
250
+ it('works as expected', () => {
251
+ assert.deepEqual(MeetingUtil.canUserResume(['RECORDING_CONTROL_RESUME']), true);
252
+ assert.deepEqual(MeetingUtil.canUserResume([]), false);
253
+ });
254
+ });
255
+
256
+ describe('canUserStop', () => {
257
+ it('works as expected', () => {
258
+ assert.deepEqual(MeetingUtil.canUserStop(['RECORDING_CONTROL_STOP']), true);
259
+ assert.deepEqual(MeetingUtil.canUserStop([]), false);
260
+ });
261
+ });
262
+
263
+ describe('recording tests', () => {
264
+ let request;
265
+ let locusInfo;
266
+ const locusUrl = 'locusUrl';
267
+
268
+ beforeEach(() => {
269
+ locusInfo = {
270
+ parsedLocus: {
271
+ info: {
272
+ userDisplayHints: [
273
+ 'RECORDING_CONTROL_START'
274
+ ]
275
+ }
276
+ }
277
+ };
278
+ request = {
279
+ recordMeeting: sinon.stub().returns(Promise.resolve())
280
+ };
281
+ });
282
+
283
+ describe('startRecording', () => {
284
+ it('can start recording when the correct display hint is present', () => {
285
+ locusInfo.parsedLocus.info.userDisplayHints.push('RECORDING_CONTROL_START');
286
+
287
+ const result = MeetingUtil.startRecording(request, locusUrl, locusInfo);
288
+
289
+ assert.calledWith(request.recordMeeting, {locusUrl, recording: true, paused: false});
290
+
291
+ assert.deepEqual(result, request.recordMeeting.firstCall.returnValue);
292
+ });
293
+
294
+ it('rejects when correct display hint is not present', () => {
295
+ const result = MeetingUtil.startRecording(request, locusUrl, {});
296
+
297
+ assert.notCalled(request.recordMeeting);
298
+
299
+ assert.isRejected(result);
300
+ });
301
+ });
302
+
303
+ describe('pauseRecording', () => {
304
+ it('can pause recording when the correct display hint is present', () => {
305
+ locusInfo.parsedLocus.info.userDisplayHints.push('RECORDING_CONTROL_PAUSE');
306
+
307
+ const result = MeetingUtil.pauseRecording(request, locusUrl, locusInfo);
308
+
309
+ assert.calledWith(request.recordMeeting, {locusUrl, recording: true, paused: true});
310
+
311
+ assert.deepEqual(result, request.recordMeeting.firstCall.returnValue);
312
+ });
313
+
314
+ it('rejects when correct display hint is not present', () => {
315
+ const result = MeetingUtil.pauseRecording(request, locusUrl, {});
316
+
317
+ assert.notCalled(request.recordMeeting);
318
+
319
+ assert.isRejected(result);
320
+ });
321
+ });
322
+
323
+ describe('resumeRecording', () => {
324
+ it('can resume recording when the correct display hint is present', () => {
325
+ locusInfo.parsedLocus.info.userDisplayHints.push('RECORDING_CONTROL_RESUME');
326
+
327
+ const result = MeetingUtil.resumeRecording(request, locusUrl, locusInfo);
328
+
329
+ assert.calledWith(request.recordMeeting, {locusUrl, recording: true, paused: false});
330
+
331
+ assert.deepEqual(result, request.recordMeeting.firstCall.returnValue);
332
+ });
333
+
334
+ it('rejects when correct display hint is not present', () => {
335
+ const result = MeetingUtil.resumeRecording(request, locusUrl, {});
336
+
337
+ assert.notCalled(request.recordMeeting);
338
+
339
+ assert.isRejected(result);
340
+ });
341
+ });
342
+
343
+ describe('stopRecording', () => {
344
+ it('can stop recording when the correct display hint is present', () => {
345
+ locusInfo.parsedLocus.info.userDisplayHints.push('RECORDING_CONTROL_STOP');
346
+
347
+ const result = MeetingUtil.stopRecording(request, locusUrl, locusInfo);
348
+
349
+ assert.calledWith(request.recordMeeting, {locusUrl, recording: false, paused: false});
350
+
351
+ assert.deepEqual(result, request.recordMeeting.firstCall.returnValue);
352
+ });
353
+
354
+ it('rejects when correct display hint is not present', () => {
355
+ const result = MeetingUtil.stopRecording(request, locusUrl, {});
356
+
357
+ assert.notCalled(request.recordMeeting);
358
+
359
+ assert.isRejected(result);
360
+ });
361
+ });
362
+ });
176
363
  });
177
364
  });
178
365
 
@@ -76,12 +76,12 @@ browserOnly(describe)('Meeting metrics', () => {
76
76
  metrics.initialSetup({}, webex);
77
77
  const payload = metrics.initPayload('myIPv6Metric', {}, {clientType: 'TEAMS_CLIENT'});
78
78
 
79
- assert(payload.origin.clientInfo.localNetworkPrefix === '2001:d00::');
79
+ assert(payload.origin.clientInfo.localNetworkPrefix === '2001:db8:0:8d3::');
80
80
  assert(payload.event.name === 'myIPv6Metric');
81
81
 
82
82
  const payload2 = metrics.initMediaPayload('myIPv6Metric', {}, {clientType: 'TEAMS_CLIENT'});
83
83
 
84
- assert(payload2.origin.clientInfo.localNetworkPrefix === '2001:d00::');
84
+ assert(payload2.origin.clientInfo.localNetworkPrefix === '2001:db8:0:8d3::');
85
85
  });
86
86
  });
87
87