@webex/plugin-meetings 2.30.1 → 2.31.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.
@@ -154,7 +154,9 @@ export const self = {
154
154
  resourceGuest: false,
155
155
  moderator: true,
156
156
  panelist: false,
157
- mediaBaseUrl: 'https://locus.meet-a.prod.meetapi.webex.com/locus/api/v1/loci/4e073f82-f5b6-31e5-93b3/participant/e0d54e94-226c-3290-b75a-/media'
157
+ mediaBaseUrl: 'https://locus.meet-a.prod.meetapi.webex.com/locus/api/v1/loci/4e073f82-f5b6-31e5-93b3/participant/e0d54e94-226c-3290-b75a-/media',
158
+ canNotViewTheParticipantList: false,
159
+ isSharingBlocked: false,
158
160
  };
159
161
 
160
162
  export const selfWithInactivity = {
@@ -1,7 +1,6 @@
1
1
  import {assert} from '@webex/test-helper-chai';
2
2
  import Sinon from 'sinon';
3
3
  import {cloneDeep} from 'lodash';
4
-
5
4
  import SelfUtils from '@webex/plugin-meetings/src/locus-info/selfUtils';
6
5
 
7
6
  import {self} from './selfConstant';
@@ -59,6 +58,34 @@ describe('plugin-meetings', () => {
59
58
  });
60
59
  });
61
60
 
61
+ describe('canNotViewTheParticipantList', () => {
62
+ it('should return the correct value', () => {
63
+ assert.equal(SelfUtils.canNotViewTheParticipantList(self), self.canNotViewTheParticipantList);
64
+ });
65
+
66
+ it('should return false if the new self does not have a value', () => {
67
+ const mutatedSelf = cloneDeep(self);
68
+
69
+ delete mutatedSelf.canNotViewTheParticipantList;
70
+
71
+ assert.equal(SelfUtils.canNotViewTheParticipantList(mutatedSelf), false);
72
+ });
73
+ });
74
+
75
+ describe('isSharingBlocked', () => {
76
+ it('should return the correct value', () => {
77
+ assert.equal(SelfUtils.isSharingBlocked(self), self.isSharingBlocked);
78
+ });
79
+
80
+ it('should return false if the new self does not have a value', () => {
81
+ const mutatedSelf = cloneDeep(self);
82
+
83
+ delete mutatedSelf.isSharingBlocked;
84
+
85
+ assert.equal(SelfUtils.isSharingBlocked(mutatedSelf), false);
86
+ });
87
+ });
88
+
62
89
  describe('getRoles', () => {
63
90
  it('get roles works', () => {
64
91
  assert.deepEqual(SelfUtils.getRoles(self), ['PRESENTER']);
@@ -79,6 +106,52 @@ describe('plugin-meetings', () => {
79
106
  assert.deepEqual(SelfUtils.getRoles(), []);
80
107
  });
81
108
  });
109
+
110
+ describe('getSelves', () => {
111
+ describe('canNotViewTheParticipantListChanged', () => {
112
+ it('should return canNotViewTheParticipantListChanged = true when changed', () => {
113
+ const clonedSelf = cloneDeep(self);
114
+
115
+ clonedSelf.canNotViewTheParticipantList = true; // different
116
+
117
+ const {updates} = SelfUtils.getSelves(self, clonedSelf);
118
+
119
+ assert.equal(updates.canNotViewTheParticipantListChanged, true);
120
+ });
121
+
122
+ it('should return canNotViewTheParticipantListChanged = false when unchanged', () => {
123
+ const clonedSelf = cloneDeep(self);
124
+
125
+ clonedSelf.canNotViewTheParticipantList = false; // same
126
+
127
+ const {updates} = SelfUtils.getSelves(self, clonedSelf);
128
+
129
+ assert.equal(updates.canNotViewTheParticipantListChanged, false);
130
+ });
131
+ });
132
+ });
133
+
134
+ describe('isSharingBlocked', () => {
135
+ it('should return isSharingBlockedChanged = true when changed', () => {
136
+ const clonedSelf = cloneDeep(self);
137
+
138
+ clonedSelf.isSharingBlocked = true; // different
139
+
140
+ const {updates} = SelfUtils.getSelves(self, clonedSelf);
141
+
142
+ assert.equal(updates.isSharingBlockedChanged, true);
143
+ });
144
+
145
+ it('should return isSharingBlockedChanged = false when unchanged', () => {
146
+ const clonedSelf = cloneDeep(self);
147
+
148
+ clonedSelf.isSharingBlocked = false; // same
149
+
150
+ const {updates} = SelfUtils.getSelves(self, clonedSelf);
151
+
152
+ assert.equal(updates.isSharingBlockedChanged, false);
153
+ });
154
+ });
82
155
  });
83
156
 
84
157
  describe('isJoined', () => {
@@ -9,7 +9,6 @@ import {assert} from '@webex/test-helper-chai';
9
9
  import MockWebex from '@webex/test-helper-mock-webex';
10
10
  import sinon from 'sinon';
11
11
  import uuid from 'uuid';
12
-
13
12
  import StaticConfig from '@webex/plugin-meetings/src/common/config';
14
13
  import TriggerProxy from '@webex/plugin-meetings/src/common/events/trigger-proxy';
15
14
  import LoggerConfig from '@webex/plugin-meetings/src/common/logs/logger-config';
@@ -27,7 +26,9 @@ import {
27
26
  LOCUSEVENT,
28
27
  OFFLINE,
29
28
  ONLINE,
30
- ROAP
29
+ ROAP,
30
+ LOCUSINFO,
31
+ EVENT_TRIGGERS
31
32
  } from '../../../../src/constants';
32
33
 
33
34
  describe('plugin-meetings', () => {
@@ -1110,5 +1111,84 @@ describe('plugin-meetings', () => {
1110
1111
  });
1111
1112
  });
1112
1113
  });
1114
+
1115
+ describe('#setupLocusControlListeners', () => {
1116
+ let meeting;
1117
+
1118
+ beforeEach(async () => {
1119
+ MediaUtil.createPeerConnection = sinon.stub().returns(true);
1120
+ webex.internal.device.userId = uuid1;
1121
+ webex.internal.device.url = url1;
1122
+ MeetingCollection.set = sinon.stub().returns(true);
1123
+ MeetingsUtil.getMeetingAddedType = sinon.stub().returns('test meeting added type');
1124
+ TriggerProxy.trigger.reset();
1125
+ // clock = sinon.useFakeTimers();
1126
+ // setTimeoutSpy = sinon.spy(clock, 'setTimeout');
1127
+ webex.meetings.meetingInfo.fetchMeetingInfo = sinon.stub().returns(Promise.resolve({
1128
+ body: {
1129
+ permissionToken: 'PT', meetingJoinUrl: 'meetingJoinUrl'
1130
+ }
1131
+ }));
1132
+
1133
+ meeting = await webex.meetings.createMeeting('test destination', 'test type');
1134
+
1135
+ TriggerProxy.trigger.reset();
1136
+ });
1137
+
1138
+ it('triggers correct event when CONTROLS_ENTRY_EXIT_TONE_UPDATED emitted', async () => {
1139
+ await meeting.locusInfo.emitScoped(
1140
+ {},
1141
+ LOCUSINFO.EVENTS.CONTROLS_ENTRY_EXIT_TONE_UPDATED,
1142
+ {entryExitTone: 'foo'}
1143
+ );
1144
+
1145
+ assert.calledOnce(TriggerProxy.trigger);
1146
+ assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meeting),
1147
+ {
1148
+ file: 'meeting/index',
1149
+ function: 'setupLocusControlsListener'
1150
+ },
1151
+ EVENT_TRIGGERS.MEETING_ENTRY_EXIT_TONE_UPDATE,
1152
+ {entryExitTone: 'foo'});
1153
+ });
1154
+
1155
+ const checkSelfTrigger = async (inEvent, outEvent) => {
1156
+ await meeting.locusInfo.emitScoped(
1157
+ {},
1158
+ inEvent,
1159
+ {foo: 'bar'}
1160
+ );
1161
+
1162
+ assert.calledOnce(TriggerProxy.trigger);
1163
+ assert.calledWith(TriggerProxy.trigger, sinon.match.instanceOf(Meeting),
1164
+ {
1165
+ file: 'meeting/index',
1166
+ function: 'setUpLocusInfoSelfListener'
1167
+ },
1168
+ outEvent,
1169
+ {payload: {foo: 'bar'}});
1170
+ };
1171
+
1172
+ it('triggers correct event when SELF_CANNOT_VIEW_PARTICIPANT_LIST_CHANGE emitted', async () => {
1173
+ checkSelfTrigger(
1174
+ LOCUSINFO.EVENTS.SELF_CANNOT_VIEW_PARTICIPANT_LIST_CHANGE,
1175
+ EVENT_TRIGGERS.MEETING_SELF_CANNOT_VIEW_PARTICIPANT_LIST
1176
+ );
1177
+ });
1178
+
1179
+ it('triggers correct event when SELF_IS_SHARING_BLOCKED_CHANGE emitted', async () => {
1180
+ checkSelfTrigger(
1181
+ LOCUSINFO.EVENTS.SELF_IS_SHARING_BLOCKED_CHANGE,
1182
+ EVENT_TRIGGERS.MEETING_SELF_IS_SHARING_BLOCKED
1183
+ );
1184
+ });
1185
+
1186
+ it('triggers correct event when LOCAL_UNMUTE_REQUESTED emitted', async () => {
1187
+ checkSelfTrigger(
1188
+ LOCUSINFO.EVENTS.LOCAL_UNMUTE_REQUESTED,
1189
+ EVENT_TRIGGERS.MEETING_SELF_REQUESTED_TO_UNMUTE
1190
+ );
1191
+ });
1192
+ });
1113
1193
  });
1114
1194
  });