@webex/plugin-meetings 3.6.0-next.11 → 3.6.0-next.13

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.
Files changed (63) hide show
  1. package/README.md +2 -1
  2. package/dist/breakouts/breakout.js +1 -1
  3. package/dist/breakouts/index.js +1 -1
  4. package/dist/constants.js +24 -2
  5. package/dist/constants.js.map +1 -1
  6. package/dist/controls-options-manager/enums.js +1 -0
  7. package/dist/controls-options-manager/enums.js.map +1 -1
  8. package/dist/controls-options-manager/index.js +10 -3
  9. package/dist/controls-options-manager/index.js.map +1 -1
  10. package/dist/controls-options-manager/types.js.map +1 -1
  11. package/dist/controls-options-manager/util.js +12 -0
  12. package/dist/controls-options-manager/util.js.map +1 -1
  13. package/dist/interpretation/index.js +1 -1
  14. package/dist/interpretation/siLanguage.js +1 -1
  15. package/dist/locus-info/controlsUtils.js +28 -4
  16. package/dist/locus-info/controlsUtils.js.map +1 -1
  17. package/dist/locus-info/fullState.js +2 -1
  18. package/dist/locus-info/fullState.js.map +1 -1
  19. package/dist/locus-info/index.js +61 -3
  20. package/dist/locus-info/index.js.map +1 -1
  21. package/dist/meeting/in-meeting-actions.js +19 -1
  22. package/dist/meeting/in-meeting-actions.js.map +1 -1
  23. package/dist/meeting/index.js +366 -277
  24. package/dist/meeting/index.js.map +1 -1
  25. package/dist/members/index.js +3 -2
  26. package/dist/members/index.js.map +1 -1
  27. package/dist/members/util.js +9 -5
  28. package/dist/members/util.js.map +1 -1
  29. package/dist/types/constants.d.ts +19 -0
  30. package/dist/types/controls-options-manager/enums.d.ts +2 -1
  31. package/dist/types/controls-options-manager/index.d.ts +2 -1
  32. package/dist/types/controls-options-manager/types.d.ts +2 -0
  33. package/dist/types/locus-info/index.d.ts +9 -0
  34. package/dist/types/meeting/in-meeting-actions.d.ts +18 -0
  35. package/dist/types/meeting/index.d.ts +11 -1
  36. package/dist/types/members/index.d.ts +2 -1
  37. package/dist/types/members/util.d.ts +3 -1
  38. package/dist/webinar/index.js +32 -19
  39. package/dist/webinar/index.js.map +1 -1
  40. package/package.json +10 -10
  41. package/src/constants.ts +25 -0
  42. package/src/controls-options-manager/enums.ts +1 -0
  43. package/src/controls-options-manager/index.ts +19 -2
  44. package/src/controls-options-manager/types.ts +2 -0
  45. package/src/controls-options-manager/util.ts +12 -0
  46. package/src/locus-info/controlsUtils.ts +46 -2
  47. package/src/locus-info/fullState.ts +1 -0
  48. package/src/locus-info/index.ts +60 -0
  49. package/src/meeting/in-meeting-actions.ts +37 -0
  50. package/src/meeting/index.ts +93 -7
  51. package/src/members/index.ts +4 -2
  52. package/src/members/util.ts +3 -1
  53. package/src/webinar/index.ts +31 -17
  54. package/test/unit/spec/controls-options-manager/index.js +56 -32
  55. package/test/unit/spec/controls-options-manager/util.js +44 -0
  56. package/test/unit/spec/locus-info/controlsUtils.js +80 -4
  57. package/test/unit/spec/locus-info/index.js +59 -2
  58. package/test/unit/spec/meeting/in-meeting-actions.ts +18 -0
  59. package/test/unit/spec/meeting/index.js +100 -16
  60. package/test/unit/spec/members/index.js +25 -2
  61. package/test/unit/spec/members/request.js +37 -3
  62. package/test/unit/spec/members/utils.js +15 -1
  63. package/test/unit/spec/webinar/index.ts +82 -16
@@ -81,7 +81,7 @@ describe('plugin-meetings', () => {
81
81
  newControls = {
82
82
  disallowUnmute: {enabled: true},
83
83
  lock: {},
84
- meetingFull: {},
84
+ meetingFull: {meetingFull: false, meetingPanelistFull: true},
85
85
  muteOnEntry: {enabled: true},
86
86
  raiseHand: {enabled: true},
87
87
  reactions: {enabled: true, showDisplayNameWithReactions: true},
@@ -95,12 +95,15 @@ describe('plugin-meetings', () => {
95
95
  },
96
96
  shareControl: {control: 'example-value'},
97
97
  transcribe: {},
98
- viewTheParticipantList: {enabled: true},
98
+ viewTheParticipantList: {enabled: true, panelistEnabled: true, attendeeCount: false},
99
99
  meetingContainer: {
100
100
  meetingContainerUrl: 'http://new-url.com',
101
101
  },
102
102
  entryExitTone: {enabled: true, mode: 'foo'},
103
103
  video: {enabled: true},
104
+ videoLayout: {overrideDefault: true, lockAttendeeViewOnStageOnly:false, stageParameters: {}},
105
+ webcastControl: {streaming: false},
106
+ practiceSession: {enabled: true},
104
107
  };
105
108
  });
106
109
 
@@ -205,6 +208,58 @@ describe('plugin-meetings', () => {
205
208
  );
206
209
  });
207
210
 
211
+ it('should trigger the CONTROLS_STAGE_VIEW_UPDATED event when necessary', () => {
212
+ locusInfo.controls = {};
213
+ locusInfo.emitScoped = sinon.stub();
214
+ locusInfo.updateControls(newControls);
215
+
216
+ assert.calledWith(
217
+ locusInfo.emitScoped,
218
+ {file: 'locus-info', function: 'updateControls'},
219
+ LOCUSINFO.EVENTS.CONTROLS_STAGE_VIEW_UPDATED,
220
+ {state: newControls.videoLayout}
221
+ );
222
+ });
223
+
224
+ it('should trigger the CONTROLS_WEBCAST_CHANGED event when necessary', () => {
225
+ locusInfo.controls = {};
226
+ locusInfo.emitScoped = sinon.stub();
227
+ locusInfo.updateControls(newControls);
228
+
229
+ assert.calledWith(
230
+ locusInfo.emitScoped,
231
+ {file: 'locus-info', function: 'updateControls'},
232
+ LOCUSINFO.EVENTS.CONTROLS_WEBCAST_CHANGED,
233
+ {state: newControls.webcastControl}
234
+ );
235
+ });
236
+
237
+ it('should trigger the CONTROLS_MEETING_FULL_CHANGED event when necessary', () => {
238
+ locusInfo.controls = {};
239
+ locusInfo.emitScoped = sinon.stub();
240
+ locusInfo.updateControls(newControls);
241
+
242
+ assert.calledWith(
243
+ locusInfo.emitScoped,
244
+ {file: 'locus-info', function: 'updateControls'},
245
+ LOCUSINFO.EVENTS.CONTROLS_MEETING_FULL_CHANGED,
246
+ {state: newControls.meetingFull}
247
+ );
248
+ });
249
+
250
+ it('should trigger the CONTROLS_PRACTICE_SESSION_STATUS_UPDATED event when necessary', () => {
251
+ locusInfo.controls = {};
252
+ locusInfo.emitScoped = sinon.stub();
253
+ locusInfo.updateControls(newControls);
254
+
255
+ assert.calledWith(
256
+ locusInfo.emitScoped,
257
+ {file: 'locus-info', function: 'updateControls'},
258
+ LOCUSINFO.EVENTS.CONTROLS_PRACTICE_SESSION_STATUS_UPDATED,
259
+ {state: newControls.practiceSession}
260
+ );
261
+ });
262
+
208
263
  it('should not trigger the CONTROLS_RECORDING_UPDATED event', () => {
209
264
  locusInfo.controls = {};
210
265
  locusInfo.emitScoped = sinon.stub();
@@ -1729,6 +1784,7 @@ describe('plugin-meetings', () => {
1729
1784
  locusInfo.updateMemberShip = sinon.stub();
1730
1785
  locusInfo.updateIdentifiers = sinon.stub();
1731
1786
  locusInfo.updateEmbeddedApps = sinon.stub();
1787
+ locusInfo.updateResources = sinon.stub();
1732
1788
  locusInfo.compareAndUpdate = sinon.stub();
1733
1789
 
1734
1790
  locusInfo.updateLocusInfo(newLocus);
@@ -1750,6 +1806,7 @@ describe('plugin-meetings', () => {
1750
1806
  assert.notCalled(locusInfo.updateMemberShip);
1751
1807
  assert.notCalled(locusInfo.updateIdentifiers);
1752
1808
  assert.notCalled(locusInfo.updateEmbeddedApps);
1809
+ assert.notCalled(locusInfo.updateResources);
1753
1810
  assert.notCalled(locusInfo.compareAndUpdate);
1754
1811
  });
1755
1812
 
@@ -60,6 +60,10 @@ describe('plugin-meetings', () => {
60
60
  canUpdateShareControl: null,
61
61
  canEnableViewTheParticipantsList: null,
62
62
  canDisableViewTheParticipantsList: null,
63
+ canEnableViewTheParticipantsListPanelist: null,
64
+ canDisableViewTheParticipantsListPanelist: null,
65
+ canEnableShowAttendeeCount: null,
66
+ canDisableShowAttendeeCount: null,
63
67
  canEnableRaiseHand: null,
64
68
  canDisableRaiseHand: null,
65
69
  canEnableVideo: null,
@@ -79,6 +83,11 @@ describe('plugin-meetings', () => {
79
83
  canShareWhiteBoard: null,
80
84
  enforceVirtualBackground: null,
81
85
  canPollingAndQA: null,
86
+ canStartWebcast: null,
87
+ canStopWebcast: null,
88
+ canShowStageView: null,
89
+ canEnableStageView: null,
90
+ canDisableStageView: null,
82
91
  ...expected,
83
92
  };
84
93
 
@@ -144,6 +153,10 @@ describe('plugin-meetings', () => {
144
153
  'canUpdateShareControl',
145
154
  'canEnableViewTheParticipantsList',
146
155
  'canDisableViewTheParticipantsList',
156
+ 'canEnableViewTheParticipantsListPanelist',
157
+ 'canDisableViewTheParticipantsListPanelist',
158
+ 'canEnableShowAttendeeCount',
159
+ 'canDisableShowAttendeeCount',
147
160
  'canEnableRaiseHand',
148
161
  'canDisableRaiseHand',
149
162
  'canEnableVideo',
@@ -163,6 +176,11 @@ describe('plugin-meetings', () => {
163
176
  'canShareWhiteBoard',
164
177
  'enforceVirtualBackground',
165
178
  'canPollingAndQA',
179
+ 'canStartWebcast',
180
+ 'canStopWebcast',
181
+ 'canShowStageView',
182
+ 'canEnableStageView',
183
+ 'canDisableStageView',
166
184
  ].forEach((key) => {
167
185
  it(`get and set for ${key} work as expected`, () => {
168
186
  const inMeetingActions = new InMeetingActions();
@@ -8885,6 +8885,78 @@ describe('plugin-meetings', () => {
8885
8885
  );
8886
8886
  });
8887
8887
 
8888
+ it('listens to MEETING_CONTROLS_WEBCAST_UPDATED', async () => {
8889
+ const state = {example: 'value'};
8890
+
8891
+ await meeting.locusInfo.emitScoped(
8892
+ {function: 'test', file: 'test'},
8893
+ LOCUSINFO.EVENTS.CONTROLS_WEBCAST_CHANGED,
8894
+ {state}
8895
+ );
8896
+
8897
+ assert.calledWith(
8898
+ TriggerProxy.trigger,
8899
+ meeting,
8900
+ {file: 'meeting/index', function: 'setupLocusControlsListener'},
8901
+ EVENT_TRIGGERS.MEETING_CONTROLS_WEBCAST_UPDATED,
8902
+ {state}
8903
+ );
8904
+ });
8905
+
8906
+ it('listens to MEETING_CONTROLS_MEETING_FULL_UPDATED', async () => {
8907
+ const state = {example: 'value'};
8908
+
8909
+ await meeting.locusInfo.emitScoped(
8910
+ {function: 'test', file: 'test'},
8911
+ LOCUSINFO.EVENTS.CONTROLS_MEETING_FULL_CHANGED,
8912
+ {state}
8913
+ );
8914
+
8915
+ assert.calledWith(
8916
+ TriggerProxy.trigger,
8917
+ meeting,
8918
+ {file: 'meeting/index', function: 'setupLocusControlsListener'},
8919
+ EVENT_TRIGGERS.MEETING_CONTROLS_MEETING_FULL_UPDATED,
8920
+ {state}
8921
+ );
8922
+ });
8923
+
8924
+ it('listens to MEETING_CONTROLS_PRACTICE_SESSION_STATUS_UPDATED', async () => {
8925
+ const state = {example: 'value'};
8926
+
8927
+ await meeting.locusInfo.emitScoped(
8928
+ {function: 'test', file: 'test'},
8929
+ LOCUSINFO.EVENTS.CONTROLS_PRACTICE_SESSION_STATUS_UPDATED,
8930
+ {state}
8931
+ );
8932
+
8933
+ assert.calledWith(
8934
+ TriggerProxy.trigger,
8935
+ meeting,
8936
+ {file: 'meeting/index', function: 'setupLocusControlsListener'},
8937
+ EVENT_TRIGGERS.MEETING_CONTROLS_PRACTICE_SESSION_STATUS_UPDATED,
8938
+ {state}
8939
+ );
8940
+ });
8941
+
8942
+ it('listens to MEETING_CONTROLS_STAGE_VIEW_UPDATED', async () => {
8943
+ const state = {example: 'value'};
8944
+
8945
+ await meeting.locusInfo.emitScoped(
8946
+ {function: 'test', file: 'test'},
8947
+ LOCUSINFO.EVENTS.CONTROLS_STAGE_VIEW_UPDATED,
8948
+ {state}
8949
+ );
8950
+
8951
+ assert.calledWith(
8952
+ TriggerProxy.trigger,
8953
+ meeting,
8954
+ {file: 'meeting/index', function: 'setupLocusControlsListener'},
8955
+ EVENT_TRIGGERS.MEETING_CONTROLS_STAGE_VIEW_UPDATED,
8956
+ {state}
8957
+ );
8958
+ });
8959
+
8888
8960
  it('listens to MEETING_CONTROLS_VIDEO_UPDATED', async () => {
8889
8961
  const state = {example: 'value'};
8890
8962
 
@@ -8998,12 +9070,6 @@ describe('plugin-meetings', () => {
8998
9070
  approval: {
8999
9071
  url: 'url',
9000
9072
  },
9001
- webcast: {
9002
- url: 'url',
9003
- },
9004
- webinarAttendeesSearching: {
9005
- url: 'url',
9006
- },
9007
9073
  },
9008
9074
  };
9009
9075
 
@@ -9017,10 +9083,6 @@ describe('plugin-meetings', () => {
9017
9083
  meeting.simultaneousInterpretation = {
9018
9084
  approvalUrlUpdate: sinon.stub().returns(undefined),
9019
9085
  };
9020
- meeting.webinar = {
9021
- webcastUrlUpdate: sinon.stub().returns(undefined),
9022
- webinarAttendeesSearchingUrlUpdate: sinon.stub().returns(undefined),
9023
- };
9024
9086
 
9025
9087
  meeting.locusInfo.emit(
9026
9088
  {function: 'test', file: 'test'},
@@ -9040,15 +9102,37 @@ describe('plugin-meetings', () => {
9040
9102
  meeting.simultaneousInterpretation.approvalUrlUpdate,
9041
9103
  newLocusServices.services.approval.url
9042
9104
  );
9043
- assert.calledWith(
9044
- meeting.webinar.webcastUrlUpdate,
9045
- newLocusServices.services.webcast.url
9105
+ assert.calledOnce(meeting.recordingController.setSessionId);
9106
+ done();
9107
+ });
9108
+ });
9109
+
9110
+ describe('#setUpLocusResourcesListener', () => {
9111
+ it('listens to the locus resources update event', (done) => {
9112
+ const newLocusResources = {
9113
+ resources: {
9114
+ webcastInstance: {
9115
+ url: 'url',
9116
+ },
9117
+
9118
+ },
9119
+ };
9120
+
9121
+ meeting.webinar = {
9122
+ updateWebcastUrl: sinon.stub().returns(undefined),
9123
+ };
9124
+
9125
+ meeting.locusInfo.emit(
9126
+ {function: 'test', file: 'test'},
9127
+ 'LINKS_RESOURCES',
9128
+ newLocusResources
9046
9129
  );
9130
+
9047
9131
  assert.calledWith(
9048
- meeting.webinar.webinarAttendeesSearchingUrlUpdate,
9049
- newLocusServices.services.webinarAttendeesSearching.url
9132
+ meeting.webinar.updateWebcastUrl,
9133
+ newLocusResources
9050
9134
  );
9051
- assert.calledOnce(meeting.recordingController.setSessionId);
9135
+
9052
9136
  done();
9053
9137
  });
9054
9138
  });
@@ -660,17 +660,20 @@ describe('plugin-meetings', () => {
660
660
  resultPromise,
661
661
  spies,
662
662
  expectedRequestingMemberId,
663
- expectedLocusUrl
663
+ expectedLocusUrl,
664
+ expectedRoles,
664
665
  ) => {
665
666
  await assert.isFulfilled(resultPromise);
666
667
  assert.calledOnceWithExactly(
667
668
  spies.generateLowerAllHandsMemberOptions,
668
669
  expectedRequestingMemberId,
669
- expectedLocusUrl
670
+ expectedLocusUrl,
671
+ expectedRoles,
670
672
  );
671
673
  assert.calledOnceWithExactly(spies.lowerAllHandsMember, {
672
674
  requestingParticipantId: expectedRequestingMemberId,
673
675
  locusUrl: expectedLocusUrl,
676
+ ...(expectedRoles !== undefined && { roles: expectedRoles })
674
677
  });
675
678
  assert.strictEqual(resultPromise, spies.lowerAllHandsMember.getCall(0).returnValue);
676
679
  };
@@ -707,6 +710,26 @@ describe('plugin-meetings', () => {
707
710
 
708
711
  await checkValid(resultPromise, spies, requestingMemberId, url1);
709
712
  });
713
+
714
+ it('should make the correct request when called with valid requestingMemberId and roles', async () => {
715
+ const requestingMemberId = 'test-member-id';
716
+ const roles = ['panelist', 'attendee'];
717
+ const { members, spies } = setup('test-locus-url');
718
+
719
+ const resultPromise = members.lowerAllHands(requestingMemberId, roles);
720
+
721
+ await checkValid(resultPromise, spies, requestingMemberId, 'test-locus-url', roles);
722
+ });
723
+
724
+ it('should handle an empty roles array correctly', async () => {
725
+ const requestingMemberId = 'test-member-id';
726
+ const roles = [];
727
+ const { members, spies } = setup('test-locus-url');
728
+
729
+ const resultPromise = members.lowerAllHands(requestingMemberId, roles);
730
+
731
+ await checkValid(resultPromise, spies, requestingMemberId, 'test-locus-url', roles);
732
+ });
710
733
  });
711
734
 
712
735
  describe('#editDisplayName', () => {
@@ -225,7 +225,7 @@ describe('plugin-meetings', () => {
225
225
  });
226
226
 
227
227
  describe('#assignRolesMember', () => {
228
- it('sends a PATCH to the locus endpoint', async () => {
228
+ it('sends a assignRolesMember PATCH to the locus endpoint', async () => {
229
229
  const locusUrl = url1;
230
230
  const memberId = 'test1';
231
231
  const roles = [
@@ -255,7 +255,7 @@ describe('plugin-meetings', () => {
255
255
  });
256
256
 
257
257
  describe('#raiseHand', () => {
258
- it('sends a PATCH to the locus endpoint', async () => {
258
+ it('sends a raiseOrLowerHandMember PATCH to the locus endpoint', async () => {
259
259
  const locusUrl = url1;
260
260
  const memberId = 'test1';
261
261
 
@@ -319,7 +319,7 @@ describe('plugin-meetings', () => {
319
319
  assert.strictEqual(result, requestResponse);
320
320
  });
321
321
 
322
- it('sends a PATCH to the locus endpoint', async () => {
322
+ it('sends a lowerAllHandsMember PATCH to the locus endpoint', async () => {
323
323
  const locusUrl = url1;
324
324
  const memberId = 'test1';
325
325
 
@@ -348,6 +348,40 @@ describe('plugin-meetings', () => {
348
348
  },
349
349
  });
350
350
  });
351
+
352
+ it('sends a lowerAllHandsMember PATCH to the locus endpoint with roles', async () => {
353
+ const locusUrl = url1;
354
+ const memberId = 'test1';
355
+ const roles = ['attendee'];
356
+
357
+ const options = {
358
+ requestingParticipantId: memberId,
359
+ locusUrl,
360
+ roles,
361
+ };
362
+
363
+ const getRequestParamsSpy = sandbox.spy(membersUtil, 'getLowerAllHandsMemberRequestParams');
364
+
365
+ await membersRequest.lowerAllHandsMember(options);
366
+
367
+ assert.calledOnceWithExactly(getRequestParamsSpy, {
368
+ requestingParticipantId: memberId,
369
+ locusUrl: url1,
370
+ roles: ['attendee'],
371
+ });
372
+
373
+ checkRequest({
374
+ method: 'PATCH',
375
+ uri: `${locusUrl}/controls`,
376
+ body: {
377
+ hand: {
378
+ raised: false,
379
+ roles: ['attendee'],
380
+ },
381
+ requestingParticipantId: memberId,
382
+ },
383
+ });
384
+ });
351
385
  });
352
386
 
353
387
  describe('#editDisplayName', () => {
@@ -101,7 +101,7 @@ describe('plugin-meetings', () => {
101
101
  });
102
102
  });
103
103
  describe('#generateLowerAllHandsMemberOptions', () => {
104
- it('returns the correct options', () => {
104
+ it('returns the correct options without roles', () => {
105
105
  const requestingParticipantId = 'test';
106
106
  const locusUrl = 'urlTest1';
107
107
 
@@ -113,6 +113,20 @@ describe('plugin-meetings', () => {
113
113
  }
114
114
  );
115
115
  });
116
+ it('returns the correct options with roles', () => {
117
+ const requestingParticipantId = 'test';
118
+ const locusUrl = 'urlTest1';
119
+ const roles = ['panelist'];
120
+
121
+ assert.deepEqual(
122
+ MembersUtil.generateLowerAllHandsMemberOptions(requestingParticipantId, locusUrl, roles),
123
+ {
124
+ requestingParticipantId,
125
+ locusUrl,
126
+ roles,
127
+ }
128
+ );
129
+ });
116
130
  });
117
131
  describe('#generateEditDisplayNameMemberOptions', () => {
118
132
  it('returns the correct options', () => {
@@ -29,32 +29,98 @@ describe('plugin-meetings', () => {
29
29
  });
30
30
  });
31
31
 
32
- describe('#webcastUrlUpdate', () => {
33
- it('sets the webcast url', () => {
34
- webinar.webcastUrlUpdate('newUrl');
32
+ describe('#updateWebcastUrl', () => {
33
+ it('sets the webcast instance url', () => {
34
+ webinar.updateWebcastUrl({resources: {webcastInstance: {url:'newUrl'}}});
35
35
 
36
- assert.equal(webinar.webcastUrl, 'newUrl');
36
+ assert.equal(webinar.webcastInstanceUrl, 'newUrl');
37
37
  });
38
38
  });
39
39
 
40
- describe('#webinarAttendeesSearchingUrlUpdate', () => {
41
- it('sets the webinarAttendeesSearching url', () => {
42
- webinar.webinarAttendeesSearchingUrlUpdate('newUrl');
43
-
44
- assert.equal(webinar.webinarAttendeesSearchingUrl, 'newUrl');
45
- });
46
- });
47
40
 
48
41
  describe('#updateCanManageWebcast', () => {
49
- it('update canManageWebcast', () => {
50
- webinar.updateCanManageWebcast(true);
42
+ it('sets the webcast instance url when valid', () => {
43
+ webinar.updateWebcastUrl({resources: {webcastInstance: {url:'newUrl'}}});
44
+ assert.equal(webinar.webcastInstanceUrl, 'newUrl', 'webcast instance URL should be updated');
45
+ });
51
46
 
52
- assert.equal(webinar.canManageWebcast, true);
47
+ it('handles missing resources gracefully', () => {
48
+ webinar.updateWebcastUrl({});
49
+ assert.isUndefined(webinar.webcastInstanceUrl, 'webcast instance URL should be undefined');
50
+ });
53
51
 
54
- webinar.updateCanManageWebcast(false);
52
+ it('handles missing webcastInstance gracefully', () => {
53
+ webinar.updateWebcastUrl({resources: {}});
54
+ assert.isUndefined(webinar.webcastInstanceUrl, 'webcast instance URL should be undefined');
55
+ });
55
56
 
56
- assert.equal(webinar.canManageWebcast, false);
57
+ it('handles missing URL gracefully', () => {
58
+ webinar.updateWebcastUrl({resources: {webcastInstance: {}}});
59
+ assert.isUndefined(webinar.webcastInstanceUrl, 'webcast instance URL should be undefined');
57
60
  });
58
61
  });
62
+
63
+ describe('#updateRoleChanged', () => {
64
+ it('updates roles when promoted from attendee to panelist', () => {
65
+ const payload = {
66
+ oldRoles: ['ATTENDEE'],
67
+ newRoles: ['PANELIST']
68
+ };
69
+
70
+ const result = webinar.updateRoleChanged(payload);
71
+
72
+ assert.equal(webinar.selfIsPanelist, true, 'self should be a panelist');
73
+ assert.equal(webinar.selfIsAttendee, false, 'self should not be an attendee');
74
+ assert.equal(webinar.canManageWebcast, false, 'self should not have manage webcast capability');
75
+ assert.equal(result.isPromoted, true, 'should indicate promotion');
76
+ assert.equal(result.isDemoted, false, 'should not indicate demotion');
77
+ });
78
+
79
+ it('updates roles when demoted from panelist to attendee', () => {
80
+ const payload = {
81
+ oldRoles: ['PANELIST'],
82
+ newRoles: ['ATTENDEE']
83
+ };
84
+
85
+ const result = webinar.updateRoleChanged(payload);
86
+
87
+ assert.equal(webinar.selfIsPanelist, false, 'self should not be a panelist');
88
+ assert.equal(webinar.selfIsAttendee, true, 'self should be an attendee');
89
+ assert.equal(webinar.canManageWebcast, false, 'self should not have manage webcast capability');
90
+ assert.equal(result.isPromoted, false, 'should not indicate promotion');
91
+ assert.equal(result.isDemoted, true, 'should indicate demotion');
92
+ });
93
+
94
+ it('updates roles when promoted to moderator', () => {
95
+ const payload = {
96
+ oldRoles: ['PANELIST'],
97
+ newRoles: ['MODERATOR']
98
+ };
99
+
100
+ const result = webinar.updateRoleChanged(payload);
101
+
102
+ assert.equal(webinar.selfIsPanelist, false, 'self should not be a panelist');
103
+ assert.equal(webinar.selfIsAttendee, false, 'self should not be an attendee');
104
+ assert.equal(webinar.canManageWebcast, true, 'self should have manage webcast capability');
105
+ assert.equal(result.isPromoted, false, 'should not indicate promotion');
106
+ assert.equal(result.isDemoted, false, 'should not indicate demotion');
107
+ });
108
+
109
+ it('updates roles when unchanged (remains as panelist)', () => {
110
+ const payload = {
111
+ oldRoles: ['PANELIST'],
112
+ newRoles: ['PANELIST']
113
+ };
114
+
115
+ const result = webinar.updateRoleChanged(payload);
116
+
117
+ assert.equal(webinar.selfIsPanelist, true, 'self should remain a panelist');
118
+ assert.equal(webinar.selfIsAttendee, false, 'self should not be an attendee');
119
+ assert.equal(webinar.canManageWebcast, false, 'self should not have manage webcast capability');
120
+ assert.equal(result.isPromoted, false, 'should not indicate promotion');
121
+ assert.equal(result.isDemoted, false, 'should not indicate demotion');
122
+ });
123
+ });
124
+
59
125
  })
60
126
  })