@webex/plugin-meetings 2.60.1-next.12 → 2.60.1-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.
@@ -2,7 +2,6 @@
2
2
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
3
  */
4
4
  import 'jsdom-global/register';
5
- import jwt from 'jsonwebtoken';
6
5
  import {cloneDeep, forEach, isEqual, isUndefined} from 'lodash';
7
6
  import sinon from 'sinon';
8
7
  import * as internalMediaModule from '@webex/internal-media-core';
@@ -111,6 +110,10 @@ import CallDiagnosticMetrics from '@webex/internal-plugin-metrics/src/call-diagn
111
110
  import {ERROR_DESCRIPTIONS} from '@webex/internal-plugin-metrics/src/call-diagnostic/config';
112
111
  import MeetingCollection from '@webex/plugin-meetings/src/meetings/collection';
113
112
 
113
+ import {
114
+ EVENT_TRIGGERS as VOICEAEVENTS,
115
+ } from '@webex/internal-plugin-voicea';
116
+
114
117
  describe('plugin-meetings', () => {
115
118
  const logger = {
116
119
  info: () => {},
@@ -655,16 +658,60 @@ describe('plugin-meetings', () => {
655
658
  assert.equal(meeting.isTranscriptionSupported(), true);
656
659
  });
657
660
  });
661
+
658
662
  describe('#startTranscription', () => {
659
- it('should invoke subscribe method to invoke the callback', () => {
660
- meeting.monitorTranscriptionSocketConnection = sinon.stub();
661
- meeting.initializeTranscription = sinon.stub();
663
+ beforeEach(() => {
664
+ webex.internal.voicea.on = sinon.stub();
665
+ webex.internal.voicea.off = sinon.stub();
666
+ webex.internal.voicea.listenToEvents = sinon.stub();
667
+ webex.internal.voicea.toggleTranscribing = sinon.stub();
668
+ });
662
669
 
663
- meeting.startTranscription().then(() => {
664
- assert.equal(true, false);
665
- assert.calledOnce(meeting.initializeTranscription);
666
- assert.calledOnce(meeting.monitorTranscriptionSocketConnection);
667
- });
670
+ it('should subscribe to events for the first time and avoid subscribing for future transcription starts', async () => {
671
+ meeting.joinedWith = {
672
+ state: 'JOINED'
673
+ };
674
+ meeting.areVoiceaEventsSetup = false;
675
+ meeting.roles = ['MODERATOR'];
676
+
677
+ await meeting.startTranscription();
678
+
679
+ assert.equal(webex.internal.voicea.on.callCount, 5);
680
+ assert.equal(meeting.areVoiceaEventsSetup, true);
681
+ assert.equal(webex.internal.voicea.listenToEvents.callCount, 1);
682
+ assert.calledWith(
683
+ webex.internal.voicea.toggleTranscribing,
684
+ true,
685
+ );
686
+
687
+ await meeting.startTranscription();
688
+ assert.equal(webex.internal.voicea.on.callCount, 5);
689
+ assert.equal(meeting.areVoiceaEventsSetup, true);
690
+ assert.equal(webex.internal.voicea.listenToEvents.callCount, 1);
691
+ assert.calledTwice(
692
+ webex.internal.voicea.toggleTranscribing,
693
+ );
694
+ assert.calledWith(
695
+ webex.internal.voicea.toggleTranscribing,
696
+ true,
697
+ );
698
+ });
699
+
700
+ it('should listen to events and not toggleTranscribing if the user is not a host', async () => {
701
+ meeting.joinedWith = {
702
+ state: 'JOINED'
703
+ };
704
+ meeting.areVoiceaEventsSetup = false;
705
+ meeting.roles = ['COHOST'];
706
+
707
+ await meeting.startTranscription();
708
+
709
+ assert.equal(webex.internal.voicea.on.callCount, 5);
710
+ assert.equal(meeting.areVoiceaEventsSetup, true);
711
+ assert.equal(webex.internal.voicea.listenToEvents.callCount, 1);
712
+ assert.notCalled(
713
+ webex.internal.voicea.toggleTranscribing
714
+ );
668
715
  });
669
716
 
670
717
  it("should throw error if request doesn't work", async () => {
@@ -677,14 +724,69 @@ describe('plugin-meetings', () => {
677
724
  }
678
725
  });
679
726
  });
680
- describe('#stopReceivingTranscription', () => {
681
- it('should get invoked', () => {
682
- meeting.transcription = {
683
- closeSocket: sinon.stub(),
684
- };
685
727
 
686
- meeting.stopReceivingTranscription();
687
- assert.calledOnce(meeting.transcription.closeSocket);
728
+ describe('#stopTranscription', () => {
729
+ beforeEach(() => {
730
+ webex.internal.voicea.on = sinon.stub();
731
+ webex.internal.voicea.off = sinon.stub();
732
+ webex.internal.voicea.listenToEvents = sinon.stub();
733
+ webex.internal.voicea.toggleTranscribing = sinon.stub();
734
+ });
735
+
736
+ it('should stop listening to voicea events and also trigger a stop event', () => {
737
+ meeting.stopTranscription();
738
+ assert.equal(webex.internal.voicea.off.callCount, 5);
739
+ assert.equal(meeting.areVoiceaEventsSetup, false);
740
+ assert.calledWith(
741
+ TriggerProxy.trigger,
742
+ sinon.match.instanceOf(Meeting),
743
+ {
744
+ file: 'meeting/index',
745
+ function: 'triggerStopReceivingTranscriptionEvent',
746
+ },
747
+ EVENT_TRIGGERS.MEETING_STOPPED_RECEIVING_TRANSCRIPTION
748
+ );
749
+ });
750
+ });
751
+
752
+ describe('transcription events', () => {
753
+ it('should trigger meeting:caption-received event', () => {
754
+ meeting.voiceaListenerCallbacks[VOICEAEVENTS.NEW_CAPTION]({});
755
+ assert.calledWith(
756
+ TriggerProxy.trigger,
757
+ sinon.match.instanceOf(Meeting),
758
+ {
759
+ file: 'meeting/index',
760
+ function: 'setUpVoiceaListeners',
761
+ },
762
+ EVENT_TRIGGERS.MEETING_CAPTION_RECEIVED
763
+ );
764
+ });
765
+
766
+ it('should trigger meeting:receiveTranscription:started event', () => {
767
+ meeting.voiceaListenerCallbacks[VOICEAEVENTS.VOICEA_ANNOUNCEMENT]({});
768
+ assert.calledWith(
769
+ TriggerProxy.trigger,
770
+ sinon.match.instanceOf(Meeting),
771
+ {
772
+ file: 'meeting/index',
773
+ function: 'setUpVoiceaListeners',
774
+ },
775
+ EVENT_TRIGGERS.MEETING_STARTED_RECEIVING_TRANSCRIPTION
776
+ );
777
+ });
778
+
779
+ it('should trigger meeting:caption-received event', () => {
780
+ meeting.voiceaListenerCallbacks[VOICEAEVENTS.NEW_CAPTION]({});
781
+ assert.calledWith(
782
+ TriggerProxy.trigger,
783
+ sinon.match.instanceOf(Meeting),
784
+ {
785
+ file: 'meeting/index',
786
+ function: 'setUpVoiceaListeners',
787
+ },
788
+ EVENT_TRIGGERS.MEETING_CAPTION_RECEIVED
789
+ );
688
790
  });
689
791
  });
690
792
  describe('#isReactionsSupported', () => {
@@ -851,7 +953,7 @@ describe('plugin-meetings', () => {
851
953
  setCorrelationIdSpy = sinon.spy(meeting, 'setCorrelationId');
852
954
  meeting.setLocus = sinon.stub().returns(true);
853
955
  webex.meetings.registered = true;
854
- meeting.updateLLMConnection = sinon.stub();
956
+ meeting.updateLLMConnection = sinon.stub().returns(Promise.resolve());
855
957
  });
856
958
 
857
959
  describe('successful', () => {
@@ -861,6 +963,7 @@ describe('plugin-meetings', () => {
861
963
 
862
964
  it('should join the meeting and return promise', async () => {
863
965
  const join = meeting.join({pstnAudioType: 'dial-in'});
966
+ meeting.config.enableAutomaticLLM = true;
864
967
 
865
968
  assert.calledWith(webex.internal.newMetrics.submitClientEvent, {
866
969
  name: 'client.call.initiated',
@@ -878,13 +981,16 @@ describe('plugin-meetings', () => {
878
981
  assert.calledOnce(MeetingUtil.joinMeeting);
879
982
  assert.calledOnce(meeting.setLocus);
880
983
  assert.equal(result, joinMeetingResult);
881
- });
882
- it('should invoke `startTranscription()` if receiveTranscription is set to true', async () => {
883
- meeting.isTranscriptionSupported = sinon.stub().returns(true);
884
- meeting.startTranscription = sinon.stub().returns(Promise.resolve());
885
984
 
886
- await meeting.join({receiveTranscription: true});
887
- assert.calledOnce(meeting.startTranscription);
985
+ assert.calledWith(
986
+ TriggerProxy.trigger,
987
+ sinon.match.instanceOf(Meeting),
988
+ {
989
+ file: 'meeting/index',
990
+ function: 'join',
991
+ },
992
+ EVENT_TRIGGERS.MEETING_TRANSCRIPTION_CONNECTED,
993
+ );
888
994
  });
889
995
 
890
996
  it('should take trigger from meeting joinTrigger if available', () => {
@@ -960,6 +1066,7 @@ describe('plugin-meetings', () => {
960
1066
  });
961
1067
 
962
1068
  it('should post error event if failed', async () => {
1069
+ MeetingUtil.isPinOrGuest = sinon.stub().returns(false);
963
1070
  await meeting.join().catch(() => {
964
1071
  assert.deepEqual(
965
1072
  webex.internal.newMetrics.submitClientEvent.getCall(1).args[0].name,
@@ -1063,60 +1170,6 @@ describe('plugin-meetings', () => {
1063
1170
  });
1064
1171
  });
1065
1172
 
1066
- describe('receive transcription', () => {
1067
- it('should invoke `startTranscription()` if receiveTranscription is set to true', async () => {
1068
- meeting.isTranscriptionSupported = sinon.stub().returns(true);
1069
- meeting.startTranscription = sinon.stub().returns(Promise.resolve());
1070
-
1071
- await meeting.join({receiveTranscription: true});
1072
- assert.calledOnce(meeting.startTranscription);
1073
- });
1074
-
1075
- it('make sure that join does not wait for setting up receive transcriptions', async () => {
1076
- const defer = new Defer();
1077
-
1078
- meeting.isTranscriptionSupported = sinon.stub().returns(true);
1079
- meeting.receiveTranscription = sinon.stub().returns(defer.promise);
1080
-
1081
- const result = await meeting.join({receiveTranscription: true});
1082
-
1083
- assert.equal(result, joinMeetingResult);
1084
-
1085
- defer.resolve();
1086
- });
1087
-
1088
- it('handles catching error of receiveTranscription(), and join still resolves', async () => {
1089
- const defer = new Defer();
1090
-
1091
- meeting.isTranscriptionSupported = sinon.stub().returns(true);
1092
- meeting.startTranscription = sinon.stub().returns(defer.promise);
1093
-
1094
- const result = await meeting.join({receiveTranscription: true});
1095
-
1096
- assert.equal(result, joinMeetingResult);
1097
-
1098
- defer.reject(new Error('bad day', {cause: 'bad weather'}));
1099
-
1100
- try {
1101
- await defer.promise;
1102
- } catch (err) {
1103
- assert.deepEqual(Metrics.sendBehavioralMetric.getCalls()[0].args, [
1104
- BEHAVIORAL_METRICS.JOIN_SUCCESS,
1105
- {correlation_id: meeting.correlationId},
1106
- ]);
1107
-
1108
- assert.deepEqual(Metrics.sendBehavioralMetric.getCalls()[1].args, [
1109
- BEHAVIORAL_METRICS.RECEIVE_TRANSCRIPTION_AFTER_JOIN_FAILURE,
1110
- {
1111
- correlation_id: meeting.correlationId,
1112
- reason: err.message,
1113
- stack: err.stack,
1114
- },
1115
- ]);
1116
- }
1117
- });
1118
- });
1119
-
1120
1173
  describe('refreshPermissionToken', () => {
1121
1174
  it('should continue if permissionTokenRefresh fails with a generic error', async () => {
1122
1175
  meeting.checkAndRefreshPermissionToken = sinon.stub().rejects(new Error('bad day'));
@@ -3636,6 +3689,7 @@ describe('plugin-meetings', () => {
3636
3689
  meeting.unsetPeerConnections = sinon.stub().returns(true);
3637
3690
  meeting.logger.error = sinon.stub().returns(true);
3638
3691
  meeting.updateLLMConnection = sinon.stub().returns(Promise.resolve());
3692
+ webex.internal.voicea.off = sinon.stub().returns(true);
3639
3693
 
3640
3694
  // A meeting needs to be joined to leave
3641
3695
  meeting.meetingState = 'ACTIVE';
@@ -4419,6 +4473,8 @@ describe('plugin-meetings', () => {
4419
4473
  sipUrl: 'some_sip_url', // or sipMeetingUri
4420
4474
  meetingNumber: '123456', // this.config.experimental.enableUnifiedMeetings
4421
4475
  hostId: 'some_host_id', // this.owner;
4476
+ permissionToken:
4477
+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2NrUGFzc3dvcmQiOiJ0aGlzSXNNb2NrUGFzc3dvcmQifQ.3-WXiR8vhGUH3VXO0DTpsTwnnkVQ3vhGQcktwIarj3I',
4422
4478
  };
4423
4479
  const FAKE_MEETING_INFO_LOOKUP_URL = 'meetingLookupUrl';
4424
4480
 
@@ -4843,6 +4899,8 @@ describe('plugin-meetings', () => {
4843
4899
  sipUrl: 'some_sip_url', // or sipMeetingUri
4844
4900
  meetingNumber: '123456', // this.config.experimental.enableUnifiedMeetings
4845
4901
  hostId: 'some_host_id', // this.owner;
4902
+ permissionToken:
4903
+ 'eyJhbGciOiJIUzI1NiJ9.eyJleHAiOiIxMjM0NTYiLCJwZXJtaXNzaW9uIjp7InVzZXJQb2xpY2llcyI6eyJhIjp0cnVlfX19.wkTk0Hp8sUlq2wi2nP4-Ym4Xb7aEUHzyXA1kzk6f0V0',
4846
4904
  };
4847
4905
 
4848
4906
  [
@@ -4995,6 +5053,8 @@ describe('plugin-meetings', () => {
4995
5053
  sipUrl: 'some_sip_url',
4996
5054
  meetingNumber: '123456',
4997
5055
  hostId: 'some_host_id',
5056
+ permissionToken:
5057
+ 'eyJhbGciOiJIUzI1NiJ9.eyJleHAiOiIxMjM0NTYiLCJwZXJtaXNzaW9uIjp7InVzZXJQb2xpY2llcyI6eyJhIjp0cnVlfX19.wkTk0Hp8sUlq2wi2nP4-Ym4Xb7aEUHzyXA1kzk6f0V0',
4998
5058
  };
4999
5059
  const FAKE_MEETING_INFO_LOOKUP_URL = 'meetingLookupUrl';
5000
5060
  const FAKE_PERMISSION_TOKEN = {someField: 'some value'};
@@ -5441,6 +5501,8 @@ describe('plugin-meetings', () => {
5441
5501
  meeting.unsetPeerConnections = sinon.stub().returns(true);
5442
5502
  meeting.logger.error = sinon.stub().returns(true);
5443
5503
  meeting.updateLLMConnection = sinon.stub().returns(Promise.resolve());
5504
+ meeting.transcription = {};
5505
+ meeting.stopTranscription = sinon.stub();
5444
5506
 
5445
5507
  // A meeting needs to be joined to end
5446
5508
  meeting.meetingState = 'ACTIVE';
@@ -5461,6 +5523,7 @@ describe('plugin-meetings', () => {
5461
5523
  assert.calledOnce(meeting?.closePeerConnections);
5462
5524
  assert.calledOnce(meeting?.unsetRemoteStreams);
5463
5525
  assert.calledOnce(meeting?.unsetPeerConnections);
5526
+ assert.calledOnce(meeting?.stopTranscription);
5464
5527
  });
5465
5528
  });
5466
5529
 
@@ -6454,6 +6517,7 @@ describe('plugin-meetings', () => {
6454
6517
 
6455
6518
  describe('CONNECTION_STATE_CHANGED event when state = "Disconnected"', () => {
6456
6519
  beforeEach(() => {
6520
+ Metrics.sendBehavioralMetric = sinon.stub();
6457
6521
  meeting.reconnectionManager = new ReconnectionManager(meeting);
6458
6522
  meeting.reconnectionManager.iceReconnected = sinon.stub().returns(undefined);
6459
6523
  meeting.setNetworkStatus = sinon.stub().returns(undefined);
@@ -6488,7 +6552,6 @@ describe('plugin-meetings', () => {
6488
6552
  meeting.reconnectionManager.waitForIceReconnect = sinon.stub().resolves();
6489
6553
 
6490
6554
  mockDisconnectedEvent();
6491
-
6492
6555
  await testUtils.flushPromises();
6493
6556
 
6494
6557
  assert.calledOnce(meeting.setNetworkStatus);
@@ -7165,16 +7228,6 @@ describe('plugin-meetings', () => {
7165
7228
  EVENT_TRIGGERS.MEETING_INTERPRETATION_UPDATE
7166
7229
  );
7167
7230
  });
7168
-
7169
- it('transcription should start when configured when guest admitted', (done) => {
7170
- meeting.isTranscriptionSupported = sinon.stub().returns(true);
7171
- meeting.receiveTranscription = sinon.stub().returns(true);
7172
- meeting.startTranscription = sinon.stub();
7173
-
7174
- meeting.locusInfo.emit({function: 'test', file: 'test'}, 'SELF_ADMITTED_GUEST', test1);
7175
- assert.calledOnce(meeting.startTranscription);
7176
- done();
7177
- });
7178
7231
  });
7179
7232
 
7180
7233
  describe('#setUpBreakoutsListener', () => {
@@ -7275,36 +7328,6 @@ describe('plugin-meetings', () => {
7275
7328
  });
7276
7329
 
7277
7330
  describe('#setupLocusControlsListener', () => {
7278
- it('transcription should start when meeting transcribe state is updated with active transcribing', (done) => {
7279
- const payload = {caption: true, transcribing: true};
7280
- meeting.startTranscription = sinon.stub();
7281
- meeting.config.receiveTranscription = true;
7282
- meeting.transcription = null;
7283
-
7284
- meeting.locusInfo.emit({function: 'meeting/index', file: 'setupLocusControlsListener'}, 'CONTROLS_MEETING_TRANSCRIBE_UPDATED', payload);
7285
- assert.calledOnce(meeting.startTranscription);
7286
- done();
7287
- });
7288
-
7289
- it('transcription should stop when meeting transcribe state is updated with inactive transcribing', (done) => {
7290
- const payload = {caption: false, transcribing: false};
7291
- meeting.startTranscription = sinon.stub();
7292
- meeting.config.receiveTranscription = true;
7293
- meeting.transcription = {};
7294
-
7295
- meeting.locusInfo.emit({function: 'meeting/index', file: 'setupLocusControlsListener'}, 'CONTROLS_MEETING_TRANSCRIBE_UPDATED', payload);
7296
- assert.notCalled(meeting.startTranscription);
7297
- assert.calledThrice(TriggerProxy.trigger);
7298
- assert.calledWith(
7299
- TriggerProxy.trigger,
7300
- sinon.match.instanceOf(Meeting),
7301
- {file: 'meeting/index', function: 'setupLocusControlsListener'},
7302
- 'meeting:receiveTranscription:stopped',
7303
- payload
7304
- );
7305
- done();
7306
- });
7307
-
7308
7331
  it('listens to the locus breakouts update event', () => {
7309
7332
  const locus = {
7310
7333
  breakout: 'breakout',
@@ -7645,10 +7668,11 @@ describe('plugin-meetings', () => {
7645
7668
  });
7646
7669
 
7647
7670
  describe('#setUpLocusInfoMeetingListener', () => {
7671
+ let cleanUpSpy;
7648
7672
  it('listens to destroy meeting event from locus info ', (done) => {
7649
7673
  TriggerProxy.trigger.reset();
7650
7674
  sinon.stub(meeting.reconnectionManager, 'cleanUp');
7651
- sinon.spy(MeetingUtil, 'cleanUp');
7675
+ cleanUpSpy = sinon.stub(MeetingUtil, 'cleanUp');
7652
7676
 
7653
7677
  meeting.locusInfo.emit({function: 'test', file: 'test'}, EVENTS.DESTROY_MEETING, {
7654
7678
  shouldLeave: false,
@@ -7669,6 +7693,7 @@ describe('plugin-meetings', () => {
7669
7693
  meetingId: meeting.id,
7670
7694
  }
7671
7695
  );
7696
+ cleanUpSpy.restore();
7672
7697
  done();
7673
7698
  });
7674
7699
  });
@@ -7772,13 +7797,12 @@ describe('plugin-meetings', () => {
7772
7797
  it('sets correctly', () => {
7773
7798
  assert.notOk(meeting.permissionTokenPayload);
7774
7799
 
7775
- const permissionTokenPayloadData = {permission: {userPolicies: {a: true}}, exp: '1234'};
7800
+ const permissionTokenPayloadData = {permission: {userPolicies: {a: true}}, exp: '123456'};
7776
7801
 
7777
- const jwtDecodeStub = sinon.stub(jwt, 'decode').returns(permissionTokenPayloadData);
7778
-
7779
- meeting.setPermissionTokenPayload();
7802
+ meeting.setPermissionTokenPayload(
7803
+ 'eyJhbGciOiJIUzI1NiJ9.eyJleHAiOiIxMjM0NTYiLCJwZXJtaXNzaW9uIjp7InVzZXJQb2xpY2llcyI6eyJhIjp0cnVlfX19.wkTk0Hp8sUlq2wi2nP4-Ym4Xb7aEUHzyXA1kzk6f0V0'
7804
+ );
7780
7805
 
7781
- assert.calledOnce(jwtDecodeStub);
7782
7806
  assert.deepEqual(meeting.permissionTokenPayload, permissionTokenPayloadData);
7783
7807
  assert.deepEqual(meeting.permissionTokenReceivedLocalTime, now);
7784
7808
  });
@@ -7966,7 +7990,8 @@ describe('plugin-meetings', () => {
7966
7990
  locusUrl: url1,
7967
7991
  meetingJoinUrl: url2,
7968
7992
  meetingNumber: '12345',
7969
- permissionToken: 'abc',
7993
+ permissionToken:
7994
+ 'eyJhbGciOiJIUzI1NiJ9.eyJleHAiOiIxMjM0NTYiLCJwZXJtaXNzaW9uIjp7InVzZXJQb2xpY2llcyI6eyJhIjp0cnVlfX19.wkTk0Hp8sUlq2wi2nP4-Ym4Xb7aEUHzyXA1kzk6f0V0',
7970
7995
  sipMeetingUri: test1,
7971
7996
  sipUrl: test1,
7972
7997
  owner: test2,
@@ -7979,8 +8004,10 @@ describe('plugin-meetings', () => {
7979
8004
  sipUri: 'locusSipUri',
7980
8005
  meetingNumber: 'locusMeetingId',
7981
8006
  meetingJoinUrl: url2,
8007
+ permissionToken:
8008
+ 'eyJhbGciOiJIUzI1NiJ9.eyJleHAiOiIxMjM0NTYiLCJwZXJtaXNzaW9uIjp7InVzZXJQb2xpY2llcyI6eyJhIjp0cnVlfX19.wkTk0Hp8sUlq2wi2nP4-Ym4Xb7aEUHzyXA1kzk6f0V0',
7982
8009
  owner: 'locusOwner',
7983
- permissionToken: 'abc',
8010
+ selfUserPolicies: {a: true},
7984
8011
  };
7985
8012
 
7986
8013
  checkParseMeetingInfo(expectedInfoToParse);
@@ -7993,7 +8020,8 @@ describe('plugin-meetings', () => {
7993
8020
  locusUrl: url1,
7994
8021
  meetingJoinUrl: url2,
7995
8022
  meetingNumber: '12345',
7996
- permissionToken: 'abc',
8023
+ permissionToken:
8024
+ 'eyJhbGciOiJIUzI1NiJ9.eyJleHAiOiIxMjM0NTYiLCJwZXJtaXNzaW9uIjp7InVzZXJQb2xpY2llcyI6eyJhIjp0cnVlfX19.wkTk0Hp8sUlq2wi2nP4-Ym4Xb7aEUHzyXA1kzk6f0V0',
7997
8025
  sipMeetingUri: test1,
7998
8026
  sipUrl: test1,
7999
8027
  owner: test2,
@@ -8006,8 +8034,10 @@ describe('plugin-meetings', () => {
8006
8034
  sipUri: test1,
8007
8035
  meetingNumber: '12345',
8008
8036
  meetingJoinUrl: url2,
8037
+ permissionToken:
8038
+ 'eyJhbGciOiJIUzI1NiJ9.eyJleHAiOiIxMjM0NTYiLCJwZXJtaXNzaW9uIjp7InVzZXJQb2xpY2llcyI6eyJhIjp0cnVlfX19.wkTk0Hp8sUlq2wi2nP4-Ym4Xb7aEUHzyXA1kzk6f0V0',
8009
8039
  owner: test2,
8010
- permissionToken: 'abc',
8040
+ selfUserPolicies: {a: true},
8011
8041
  };
8012
8042
 
8013
8043
  checkParseMeetingInfo(expectedInfoToParse);
@@ -8021,7 +8051,8 @@ describe('plugin-meetings', () => {
8021
8051
  locusUrl: url1,
8022
8052
  meetingJoinUrl: url2,
8023
8053
  meetingNumber: '12345',
8024
- permissionToken: 'abc',
8054
+ permissionToken:
8055
+ 'eyJhbGciOiJIUzI1NiJ9.eyJleHAiOiIxMjM0NTYiLCJwZXJtaXNzaW9uIjp7InVzZXJQb2xpY2llcyI6eyJhIjp0cnVlfX19.wkTk0Hp8sUlq2wi2nP4-Ym4Xb7aEUHzyXA1kzk6f0V0',
8025
8056
  sipMeetingUri: test1,
8026
8057
  sipUrl: test1,
8027
8058
  owner: test2,
@@ -8035,7 +8066,9 @@ describe('plugin-meetings', () => {
8035
8066
  meetingNumber: '12345',
8036
8067
  meetingJoinUrl: url2,
8037
8068
  owner: test2,
8038
- permissionToken: 'abc',
8069
+ permissionToken:
8070
+ 'eyJhbGciOiJIUzI1NiJ9.eyJleHAiOiIxMjM0NTYiLCJwZXJtaXNzaW9uIjp7InVzZXJQb2xpY2llcyI6eyJhIjp0cnVlfX19.wkTk0Hp8sUlq2wi2nP4-Ym4Xb7aEUHzyXA1kzk6f0V0',
8071
+ selfUserPolicies: {a: true},
8039
8072
  };
8040
8073
 
8041
8074
  checkParseMeetingInfo(expectedInfoToParse);
@@ -8056,6 +8089,8 @@ describe('plugin-meetings', () => {
8056
8089
  },
8057
8090
  ],
8058
8091
  },
8092
+ permissionToken:
8093
+ 'eyJhbGciOiJIUzI1NiJ9.eyJleHAiOiIxMjM0NTYiLCJwZXJtaXNzaW9uIjp7InVzZXJQb2xpY2llcyI6eyJhIjp0cnVlfX19.wkTk0Hp8sUlq2wi2nP4-Ym4Xb7aEUHzyXA1kzk6f0V0',
8059
8094
  };
8060
8095
  meeting.parseMeetingInfo(mockToggleOnData);
8061
8096
  assert.calledOnceWithExactly(parseInterpretationInfo, meeting, mockToggleOnData);
@@ -8731,627 +8766,7 @@ describe('plugin-meetings', () => {
8731
8766
  // Due to import tree issues, hasHints must be stubed within the scope of the `it`.
8732
8767
  const restorableHasHints = ControlsOptionsUtil.hasHints;
8733
8768
  ControlsOptionsUtil.hasHints = sinon.stub().returns(true);
8734
- ControlsOptionsUtil.hasPolicies = sinon.stub().returns(true);
8735
-
8736
- const selfUserPolicies = {a: true};
8737
- meeting.selfUserPolicies = {a: true};
8738
- const userDisplayHints = ['LOCK_CONTROL_UNLOCK'];
8739
- meeting.userDisplayHints = ['LOCK_CONTROL_UNLOCK'];
8740
- meeting.meetingInfo.supportVoIP = true;
8741
-
8742
- meeting.updateMeetingActions();
8743
-
8744
- assert.calledWith(canUserLockSpy, userDisplayHints);
8745
- assert.calledWith(canUserUnlockSpy, userDisplayHints);
8746
- assert.calledWith(canUserStartSpy, userDisplayHints);
8747
- assert.calledWith(canUserStopSpy, userDisplayHints);
8748
- assert.calledWith(canUserPauseSpy, userDisplayHints);
8749
- assert.calledWith(canUserResumeSpy, userDisplayHints);
8750
- assert.calledWith(canSetMuteOnEntrySpy, userDisplayHints);
8751
- assert.calledWith(canUnsetMuteOnEntrySpy, userDisplayHints);
8752
- assert.calledWith(canSetDisallowUnmuteSpy, userDisplayHints);
8753
- assert.calledWith(canUnsetDisallowUnmuteSpy, userDisplayHints);
8754
- assert.calledWith(canUserRaiseHandSpy, userDisplayHints);
8755
- assert.calledWith(bothLeaveAndEndMeetingAvailableSpy, userDisplayHints);
8756
- assert.calledWith(canUserLowerAllHandsSpy, userDisplayHints);
8757
- assert.calledWith(canUserLowerSomeoneElsesHandSpy, userDisplayHints);
8758
- assert.calledWith(waitingForOthersToJoinSpy, userDisplayHints);
8759
- assert.calledWith(canSendReactionsSpy, null, userDisplayHints);
8760
- assert.calledWith(canUserRenameSelfAndObservedSpy, userDisplayHints);
8761
- assert.calledWith(canUserRenameOthersSpy, userDisplayHints);
8762
- assert.calledWith(canShareWhiteBoardSpy, userDisplayHints);
8763
-
8764
- assert.calledWith(ControlsOptionsUtil.hasHints, {
8765
- requiredHints: [DISPLAY_HINTS.MUTE_ALL],
8766
- displayHints: userDisplayHints,
8767
- });
8768
- assert.calledWith(ControlsOptionsUtil.hasHints, {
8769
- requiredHints: [DISPLAY_HINTS.UNMUTE_ALL],
8770
- displayHints: userDisplayHints,
8771
- });
8772
- assert.calledWith(ControlsOptionsUtil.hasHints, {
8773
- requiredHints: [DISPLAY_HINTS.ENABLE_HARD_MUTE],
8774
- displayHints: userDisplayHints,
8775
- });
8776
- assert.calledWith(ControlsOptionsUtil.hasHints, {
8777
- requiredHints: [DISPLAY_HINTS.DISABLE_HARD_MUTE],
8778
- displayHints: userDisplayHints,
8779
- });
8780
- assert.calledWith(ControlsOptionsUtil.hasHints, {
8781
- requiredHints: [DISPLAY_HINTS.ENABLE_MUTE_ON_ENTRY],
8782
- displayHints: userDisplayHints,
8783
- });
8784
- assert.calledWith(ControlsOptionsUtil.hasHints, {
8785
- requiredHints: [DISPLAY_HINTS.DISABLE_MUTE_ON_ENTRY],
8786
- displayHints: userDisplayHints,
8787
- });
8788
- assert.calledWith(ControlsOptionsUtil.hasHints, {
8789
- requiredHints: [DISPLAY_HINTS.ENABLE_REACTIONS],
8790
- displayHints: userDisplayHints,
8791
- });
8792
- assert.calledWith(ControlsOptionsUtil.hasHints, {
8793
- requiredHints: [DISPLAY_HINTS.DISABLE_REACTIONS],
8794
- displayHints: userDisplayHints,
8795
- });
8796
- assert.calledWith(ControlsOptionsUtil.hasHints, {
8797
- requiredHints: [DISPLAY_HINTS.ENABLE_SHOW_DISPLAY_NAME],
8798
- displayHints: userDisplayHints,
8799
- });
8800
- assert.calledWith(ControlsOptionsUtil.hasHints, {
8801
- requiredHints: [DISPLAY_HINTS.DISABLE_SHOW_DISPLAY_NAME],
8802
- displayHints: userDisplayHints,
8803
- });
8804
- assert.calledWith(ControlsOptionsUtil.hasHints, {
8805
- requiredHints: [DISPLAY_HINTS.SHARE_CONTROL],
8806
- displayHints: userDisplayHints,
8807
- });
8808
- assert.calledWith(ControlsOptionsUtil.hasHints, {
8809
- requiredHints: [DISPLAY_HINTS.ENABLE_VIEW_THE_PARTICIPANT_LIST],
8810
- displayHints: userDisplayHints,
8811
- });
8812
- assert.calledWith(ControlsOptionsUtil.hasHints, {
8813
- requiredHints: [DISPLAY_HINTS.DISABLE_VIEW_THE_PARTICIPANT_LIST],
8814
- displayHints: userDisplayHints,
8815
- });
8816
- assert.calledWith(ControlsOptionsUtil.hasHints, {
8817
- requiredHints: [DISPLAY_HINTS.SHARE_FILE],
8818
- displayHints: userDisplayHints,
8819
- });
8820
- assert.calledWith(ControlsOptionsUtil.hasPolicies, {
8821
- requiredPolicies: [SELF_POLICY.SUPPORT_FILE_SHARE],
8822
- policies: selfUserPolicies,
8823
- });
8824
- assert.calledWith(ControlsOptionsUtil.hasHints, {
8825
- requiredHints: [DISPLAY_HINTS.SHARE_APPLICATION],
8826
- displayHints: userDisplayHints,
8827
- });
8828
- assert.calledWith(ControlsOptionsUtil.hasPolicies, {
8829
- requiredPolicies: [SELF_POLICY.SUPPORT_APP_SHARE],
8830
- policies: selfUserPolicies,
8831
- });
8832
- assert.calledWith(ControlsOptionsUtil.hasHints, {
8833
- requiredHints: [DISPLAY_HINTS.SHARE_CAMERA],
8834
- displayHints: userDisplayHints,
8835
- });
8836
- assert.calledWith(ControlsOptionsUtil.hasPolicies, {
8837
- requiredPolicies: [SELF_POLICY.SUPPORT_CAMERA_SHARE],
8838
- policies: selfUserPolicies,
8839
- });
8840
- assert.calledWith(ControlsOptionsUtil.hasHints, {
8841
- requiredHints: [DISPLAY_HINTS.SHARE_DESKTOP],
8842
- displayHints: userDisplayHints,
8843
- });
8844
- assert.calledWith(ControlsOptionsUtil.hasPolicies, {
8845
- requiredPolicies: [SELF_POLICY.SUPPORT_DESKTOP_SHARE],
8846
- policies: selfUserPolicies,
8847
- });
8848
- assert.calledWith(ControlsOptionsUtil.hasHints, {
8849
- requiredHints: [DISPLAY_HINTS.SHARE_CONTENT],
8850
- displayHints: userDisplayHints,
8851
- });
8852
- assert.calledWith(ControlsOptionsUtil.hasPolicies, {
8853
- requiredPolicies: [SELF_POLICY.SUPPORT_VOIP],
8854
- policies: selfUserPolicies,
8855
- });
8856
-
8857
- assert.calledWith(updateMeetingActionsSpy);
8858
- assert.calledWith(setRecordingDisplayHintsSpy, userDisplayHints);
8859
- assert.calledWith(setUserPolicySpy, userDisplayPolicy);
8860
- assert.calledWith(setControlsDisplayHintsSpy, userDisplayHints);
8861
- assert.calledWith(handleDataChannelUrlChangeSpy, datachannelUrl);
8862
- });
8863
- });
8864
-
8865
- describe('#updateMeetingActions', () => {
8866
- let inMeetingActionsSetSpy;
8867
- let canUserLockSpy;
8868
- let canUserUnlockSpy;
8869
- let canUserStartSpy;
8870
- let canUserStopSpy;
8871
- let canUserPauseSpy;
8872
- let canUserResumeSpy;
8873
- let canSetMuteOnEntrySpy;
8874
- let canUnsetMuteOnEntrySpy;
8875
- let canSetDisallowUnmuteSpy;
8876
- let canUnsetDisallowUnmuteSpy;
8877
- let canUserRaiseHandSpy;
8878
- let bothLeaveAndEndMeetingAvailableSpy;
8879
- let canUserLowerAllHandsSpy;
8880
- let canUserLowerSomeoneElsesHandSpy;
8881
- let waitingForOthersToJoinSpy;
8882
- let canSendReactionsSpy;
8883
- let canUserRenameSelfAndObservedSpy;
8884
- let canUserRenameOthersSpy;
8885
- let canShareWhiteBoardSpy;
8886
- // Due to import tree issues, hasHints must be stubed within the scope of the `it`.
8887
-
8888
- beforeEach(() => {
8889
- canUserLockSpy = sinon.spy(MeetingUtil, 'canUserLock');
8890
- canUserUnlockSpy = sinon.spy(MeetingUtil, 'canUserUnlock');
8891
- canUserStartSpy = sinon.spy(RecordingUtil, 'canUserStart');
8892
- canUserStopSpy = sinon.spy(RecordingUtil, 'canUserStop');
8893
- canUserPauseSpy = sinon.spy(RecordingUtil, 'canUserPause');
8894
- canUserResumeSpy = sinon.spy(RecordingUtil, 'canUserResume');
8895
- canSetMuteOnEntrySpy = sinon.spy(ControlsOptionsUtil, 'canSetMuteOnEntry');
8896
- canUnsetMuteOnEntrySpy = sinon.spy(ControlsOptionsUtil, 'canUnsetMuteOnEntry');
8897
- canSetDisallowUnmuteSpy = sinon.spy(ControlsOptionsUtil, 'canSetDisallowUnmute');
8898
- canUnsetDisallowUnmuteSpy = sinon.spy(ControlsOptionsUtil, 'canUnsetDisallowUnmute');
8899
- inMeetingActionsSetSpy = sinon.spy(meeting.inMeetingActions, 'set');
8900
- canUserRaiseHandSpy = sinon.spy(MeetingUtil, 'canUserRaiseHand');
8901
- canUserLowerAllHandsSpy = sinon.spy(MeetingUtil, 'canUserLowerAllHands');
8902
- bothLeaveAndEndMeetingAvailableSpy = sinon.spy(
8903
- MeetingUtil,
8904
- 'bothLeaveAndEndMeetingAvailable'
8905
- );
8906
- canUserLowerSomeoneElsesHandSpy = sinon.spy(MeetingUtil, 'canUserLowerSomeoneElsesHand');
8907
- waitingForOthersToJoinSpy = sinon.spy(MeetingUtil, 'waitingForOthersToJoin');
8908
- canSendReactionsSpy = sinon.spy(MeetingUtil, 'canSendReactions');
8909
- canUserRenameSelfAndObservedSpy = sinon.spy(MeetingUtil, 'canUserRenameSelfAndObserved');
8910
- canUserRenameOthersSpy = sinon.spy(MeetingUtil, 'canUserRenameOthers');
8911
- canShareWhiteBoardSpy = sinon.spy(MeetingUtil, 'canShareWhiteBoard');
8912
- });
8913
-
8914
- afterEach(() => {
8915
- inMeetingActionsSetSpy.restore();
8916
- waitingForOthersToJoinSpy.restore();
8917
- });
8918
-
8919
- forEach(
8920
- [
8921
- {
8922
- actionName: 'canShareApplication',
8923
- expectedEnabled: true,
8924
- arePolicyRestrictionsSupported: false,
8925
- },
8926
- {
8927
- actionName: 'canShareApplication',
8928
- expectedEnabled: false,
8929
- arePolicyRestrictionsSupported: true,
8930
- },
8931
- {
8932
- actionName: 'canShareDesktop',
8933
- arePolicyRestrictionsSupported: false,
8934
- expectedEnabled: true,
8935
- },
8936
- {
8937
- actionName: 'canShareDesktop',
8938
- arePolicyRestrictionsSupported: true,
8939
- expectedEnabled: false,
8940
- },
8941
- {
8942
- actionName: 'canShareContent',
8943
- arePolicyRestrictionsSupported: false,
8944
- expectedEnabled: true,
8945
- },
8946
- {
8947
- actionName: 'canShareContent',
8948
- arePolicyRestrictionsSupported: true,
8949
- expectedEnabled: false,
8950
- },
8951
- {
8952
- actionName: 'canUseVoip',
8953
- expectedEnabled: true,
8954
- arePolicyRestrictionsSupported: false,
8955
- },
8956
- {
8957
- actionName: 'canUseVoip',
8958
- expectedEnabled: false,
8959
- arePolicyRestrictionsSupported: true,
8960
- },
8961
- ],
8962
- ({actionName, arePolicyRestrictionsSupported, expectedEnabled}) => {
8963
- it(`${actionName} is ${expectedEnabled} when the call type is ${arePolicyRestrictionsSupported}`, () => {
8964
- meeting.userDisplayHints = [];
8965
- meeting.meetingInfo = {some: 'info'};
8966
- sinon
8967
- .stub(meeting, 'arePolicyRestrictionsSupported')
8968
- .returns(arePolicyRestrictionsSupported);
8969
-
8970
- meeting.updateMeetingActions();
8971
-
8972
- assert.equal(meeting.inMeetingActions.get()[actionName], expectedEnabled);
8973
- });
8974
- }
8975
- );
8976
-
8977
- forEach(
8978
- [
8979
- {
8980
- actionName: 'canShareFile',
8981
- requiredDisplayHints: [DISPLAY_HINTS.SHARE_FILE],
8982
- requiredPolicies: [SELF_POLICY.SUPPORT_FILE_SHARE],
8983
- },
8984
- {
8985
- actionName: 'canShareApplication',
8986
- requiredDisplayHints: [DISPLAY_HINTS.SHARE_APPLICATION],
8987
- requiredPolicies: [SELF_POLICY.SUPPORT_APP_SHARE],
8988
- },
8989
- {
8990
- actionName: 'canShareCamera',
8991
- requiredDisplayHints: [DISPLAY_HINTS.SHARE_CAMERA],
8992
- requiredPolicies: [SELF_POLICY.SUPPORT_CAMERA_SHARE],
8993
- },
8994
- {
8995
- actionName: 'canBroadcastMessageToBreakout',
8996
- requiredDisplayHints: [DISPLAY_HINTS.BROADCAST_MESSAGE_TO_BREAKOUT],
8997
- requiredPolicies: [SELF_POLICY.SUPPORT_BROADCAST_MESSAGE],
8998
- },
8999
- {
9000
- actionName: 'canShareDesktop',
9001
- requiredDisplayHints: [DISPLAY_HINTS.SHARE_DESKTOP],
9002
- requiredPolicies: [SELF_POLICY.SUPPORT_DESKTOP_SHARE],
9003
- },
9004
- {
9005
- actionName: 'canTransferFile',
9006
- requiredDisplayHints: [],
9007
- requiredPolicies: [SELF_POLICY.SUPPORT_FILE_TRANSFER],
9008
- },
9009
- {
9010
- actionName: 'canShareDesktop',
9011
- requiredDisplayHints: [DISPLAY_HINTS.SHARE_DESKTOP],
9012
- requiredPolicies: [],
9013
- enableUnifiedMeetings: false,
9014
- arePolicyRestrictionsSupported: false,
9015
- },
9016
- {
9017
- actionName: 'canShareApplication',
9018
- requiredDisplayHints: [DISPLAY_HINTS.SHARE_APPLICATION],
9019
- requiredPolicies: [],
9020
- enableUnifiedMeetings: false,
9021
- arePolicyRestrictionsSupported: false,
9022
- },
9023
- {
9024
- actionName: 'canAnnotate',
9025
- requiredDisplayHints: [],
9026
- requiredPolicies: [SELF_POLICY.SUPPORT_ANNOTATION],
9027
- },
9028
- ],
9029
- ({
9030
- actionName,
9031
- requiredDisplayHints,
9032
- requiredPolicies,
9033
- enableUnifiedMeetings,
9034
- meetingInfo,
9035
- arePolicyRestrictionsSupported,
9036
- }) => {
9037
- it(`${actionName} is enabled when the conditions are met`, () => {
9038
- meeting.userDisplayHints = requiredDisplayHints;
9039
- meeting.selfUserPolicies = undefined;
9040
- sinon
9041
- .stub(meeting, 'arePolicyRestrictionsSupported')
9042
- .returns(arePolicyRestrictionsSupported);
9043
-
9044
- meeting.config.experimental.enableUnifiedMeetings = isUndefined(enableUnifiedMeetings)
9045
- ? true
9046
- : enableUnifiedMeetings;
9047
-
9048
- meeting.meetingInfo = isUndefined(meetingInfo) ? {some: 'info'} : meetingInfo;
9049
-
9050
- if (requiredPolicies) {
9051
- meeting.selfUserPolicies = {};
9052
- }
9053
- forEach(requiredPolicies, (policy) => {
9054
- meeting.selfUserPolicies[policy] = true;
9055
- });
9056
-
9057
- meeting.updateMeetingActions();
9058
-
9059
- assert.isTrue(meeting.inMeetingActions.get()[actionName]);
9060
- });
9061
-
9062
- if (requiredDisplayHints.length !== 0) {
9063
- it(`${actionName} is disabled when the required display hints are missing`, () => {
9064
- meeting.userDisplayHints = [];
9065
- meeting.selfUserPolicies = undefined;
9066
-
9067
- meeting.meetingInfo = isUndefined(meetingInfo) ? {some: 'info'} : meetingInfo;
9068
-
9069
- if (requiredPolicies) {
9070
- meeting.selfUserPolicies = {};
9071
- }
9072
- forEach(requiredPolicies, (policy) => {
9073
- meeting.selfUserPolicies[policy] = true;
9074
- });
9075
-
9076
- meeting.updateMeetingActions();
9077
-
9078
- assert.isFalse(meeting.inMeetingActions.get()[actionName]);
9079
- });
9080
- }
9081
-
9082
- it(`${actionName} is disabled when the required policies are missing`, () => {
9083
- meeting.userDisplayHints = requiredDisplayHints;
9084
- meeting.selfUserPolicies = undefined;
9085
-
9086
- if (requiredPolicies) {
9087
- meeting.selfUserPolicies = {};
9088
- }
9089
- meeting.meetingInfo = isUndefined(meetingInfo) ? {some: 'info'} : meetingInfo;
9090
-
9091
- meeting.updateMeetingActions();
9092
-
9093
- assert.isFalse(meeting.inMeetingActions.get()[actionName]);
9094
- });
9095
- }
9096
- );
9097
-
9098
- forEach(
9099
- [
9100
- {
9101
- meetingInfo: {
9102
- video: {
9103
- supportHDV: true,
9104
- supportHQV: true,
9105
- },
9106
- },
9107
- selfUserPolicies: {
9108
- [SELF_POLICY.SUPPORT_HDV]: true,
9109
- [SELF_POLICY.SUPPORT_HQV]: true,
9110
- },
9111
- expectedActions: {
9112
- supportHQV: true,
9113
- supportHDV: true,
9114
- },
9115
- },
9116
- {
9117
- meetingInfo: {
9118
- video: {
9119
- supportHDV: false,
9120
- supportHQV: false,
9121
- },
9122
- },
9123
- selfUserPolicies: {
9124
- [SELF_POLICY.SUPPORT_HDV]: true,
9125
- [SELF_POLICY.SUPPORT_HQV]: true,
9126
- },
9127
- expectedActions: {
9128
- supportHQV: false,
9129
- supportHDV: false,
9130
- },
9131
- },
9132
- {
9133
- meetingInfo: {
9134
- video: {
9135
- supportHDV: true,
9136
- supportHQV: true,
9137
- },
9138
- },
9139
- selfUserPolicies: {
9140
- [SELF_POLICY.SUPPORT_HDV]: false,
9141
- [SELF_POLICY.SUPPORT_HQV]: false,
9142
- },
9143
- expectedActions: {
9144
- supportHQV: false,
9145
- supportHDV: false,
9146
- },
9147
- },
9148
- {
9149
- meetingInfo: undefined,
9150
- selfUserPolicies: {},
9151
- expectedActions: {
9152
- supportHQV: true,
9153
- supportHDV: true,
9154
- },
9155
- },
9156
- {
9157
- meetingInfo: {some: 'data'},
9158
- selfUserPolicies: undefined,
9159
- expectedActions: {
9160
- supportHQV: true,
9161
- supportHDV: true,
9162
- },
9163
- },
9164
- ],
9165
- ({meetingInfo, selfUserPolicies, expectedActions}) => {
9166
- it(`expectedActions are ${JSON.stringify(
9167
- expectedActions
9168
- )} when policies are ${JSON.stringify(
9169
- selfUserPolicies
9170
- )} and meetingInfo is ${JSON.stringify(meetingInfo)}`, () => {
9171
- meeting.meetingInfo = meetingInfo;
9172
- meeting.selfUserPolicies = selfUserPolicies;
9173
-
9174
- meeting.updateMeetingActions();
9175
-
9176
- assert.deepEqual(
9177
- {
9178
- supportHDV: meeting.inMeetingActions.supportHDV,
9179
- supportHQV: meeting.inMeetingActions.supportHQV,
9180
- },
9181
- expectedActions
9182
- );
9183
- });
9184
- }
9185
- );
9186
-
9187
- it('canUseVoip is disabled when the required policies are missing', () => {
9188
- meeting.userDisplayHints = [DISPLAY_HINTS.VOIP_IS_ENABLED];
9189
- meeting.selfUserPolicies = {};
9190
- meeting.meetingInfo.supportVoIP = true;
9191
-
9192
- meeting.updateMeetingActions();
9193
-
9194
- assert.isFalse(meeting.inMeetingActions.get()['canUseVoip']);
9195
- });
9196
-
9197
- it('canUseVoip is enabled based on api info when the conditions are met', () => {
9198
- meeting.userDisplayHints = undefined;
9199
- meeting.selfUserPolicies = {[SELF_POLICY.SUPPORT_VOIP]: true};
9200
- meeting.meetingInfo.supportVoIP = true;
9201
-
9202
- meeting.updateMeetingActions();
9203
-
9204
- assert.isTrue(meeting.inMeetingActions.get()['canUseVoip']);
9205
- });
9206
-
9207
- it('canUseVoip is enabled based on api info when the conditions are met - no display hints', () => {
9208
- meeting.userDisplayHints = [];
9209
- meeting.selfUserPolicies = {[SELF_POLICY.SUPPORT_VOIP]: true};
9210
- meeting.meetingInfo.supportVoIP = true;
9211
-
9212
- meeting.updateMeetingActions();
9213
-
9214
- assert.isTrue(meeting.inMeetingActions.get()['canUseVoip']);
9215
- });
9216
-
9217
- it('canUseVoip is enabled when there is no meeting info', () => {
9218
- meeting.updateMeetingActions();
9219
-
9220
- assert.isTrue(meeting.inMeetingActions.get()['canUseVoip']);
9221
- });
9222
-
9223
- it('canUseVoip is enabled when it is a locus call', () => {
9224
- meeting.meetingInfo = {some: 'info'};
9225
- meeting.type = 'CALL';
9226
-
9227
- meeting.updateMeetingActions();
9228
-
9229
- assert.isTrue(meeting.inMeetingActions.get()['canUseVoip']);
9230
- });
9231
-
9232
- it('canUseVoip is disabled based on api info when supportVoip is false', () => {
9233
- meeting.userDisplayHints = undefined;
9234
- meeting.selfUserPolicies = {[SELF_POLICY.SUPPORT_VOIP]: true};
9235
- meeting.meetingInfo.supportVoIP = false;
9236
-
9237
- meeting.updateMeetingActions();
9238
-
9239
- assert.isFalse(meeting.inMeetingActions.get()['canUseVoip']);
9240
- });
9241
-
9242
- it('canUseVoip is disabled based on api info when the required policies are missing', () => {
9243
- meeting.userDisplayHints = undefined;
9244
- meeting.selfUserPolicies = {};
9245
- meeting.meetingInfo.supportVoIP = true;
9246
-
9247
- meeting.updateMeetingActions();
9248
-
9249
- assert.isFalse(meeting.inMeetingActions.get()['canUseVoip']);
9250
- });
9251
-
9252
- it('canUseVoip is enabled when there are no policies', () => {
9253
- meeting.userDisplayHints = [DISPLAY_HINTS.VOIP_IS_ENABLED];
9254
- meeting.selfUserPolicies = undefined;
9255
- meeting.meetingInfo.supportVoIP = false;
9256
-
9257
- meeting.updateMeetingActions();
9258
-
9259
- assert.isTrue(meeting.inMeetingActions.get()['canUseVoip']);
9260
- });
9261
-
9262
- forEach(
9263
- [
9264
- {
9265
- meetingInfo: {},
9266
- selfUserPolicies: {
9267
- [SELF_POLICY.SUPPORT_VIDEO]: true,
9268
- },
9269
- expectedActions: {
9270
- canDoVideo: true,
9271
- },
9272
- },
9273
- {
9274
- meetingInfo: {},
9275
- selfUserPolicies: {
9276
- [SELF_POLICY.SUPPORT_VIDEO]: false,
9277
- },
9278
- expectedActions: {
9279
- canDoVideo: true,
9280
- },
9281
- },
9282
- {
9283
- meetingInfo: {some: 'data'},
9284
- selfUserPolicies: {
9285
- [SELF_POLICY.SUPPORT_VIDEO]: true,
9286
- },
9287
- expectedActions: {
9288
- canDoVideo: false,
9289
- },
9290
- },
9291
- {
9292
- meetingInfo: {some: 'data'},
9293
- selfUserPolicies: undefined,
9294
- expectedActions: {
9295
- canDoVideo: true,
9296
- },
9297
- },
9298
- {
9299
- meetingInfo: {
9300
- video: {},
9301
- },
9302
- selfUserPolicies: {
9303
- [SELF_POLICY.SUPPORT_VIDEO]: true,
9304
- },
9305
- expectedActions: {
9306
- canDoVideo: true,
9307
- },
9308
- },
9309
- {
9310
- meetingInfo: undefined,
9311
- selfUserPolicies: {},
9312
- expectedActions: {
9313
- canDoVideo: true,
9314
- },
9315
- },
9316
- {
9317
- meetingInfo: {
9318
- video: {},
9319
- },
9320
- selfUserPolicies: {
9321
- [SELF_POLICY.SUPPORT_VIDEO]: false,
9322
- },
9323
- expectedActions: {
9324
- canDoVideo: false,
9325
- },
9326
- },
9327
- ],
9328
- ({meetingInfo, selfUserPolicies, expectedActions}) => {
9329
- it(`has expectedActions ${JSON.stringify(
9330
- expectedActions
9331
- )} when policies are ${JSON.stringify(
9332
- selfUserPolicies
9333
- )} and meetingInfo is ${JSON.stringify(meetingInfo)}`, () => {
9334
- meeting.meetingInfo = meetingInfo;
9335
- meeting.selfUserPolicies = selfUserPolicies;
9336
- meeting.config.experimental.enableUnifiedMeetings = true;
9337
-
9338
- meeting.updateMeetingActions();
9339
-
9340
- assert.deepEqual(
9341
- {
9342
- canDoVideo: meeting.inMeetingActions.canDoVideo,
9343
- },
9344
- expectedActions
9345
- );
9346
- });
9347
- }
9348
- );
9349
-
9350
- it('correctly updates the meeting actions', () => {
9351
- // Due to import tree issues, hasHints must be stubed within the scope of the `it`.
9352
- const restorableHasHints = ControlsOptionsUtil.hasHints;
9353
- ControlsOptionsUtil.hasHints = sinon.stub().returns(true);
9354
- ControlsOptionsUtil.hasPolicies = sinon.stub().returns(true);
8769
+ const hasPoliciesSpy = sinon.stub(ControlsOptionsUtil, 'hasPolicies').returns(true);
9355
8770
 
9356
8771
  const selfUserPolicies = {a: true};
9357
8772
  meeting.selfUserPolicies = {a: true};
@@ -9492,6 +8907,7 @@ describe('plugin-meetings', () => {
9492
8907
  assert.notCalled(TriggerProxy.trigger);
9493
8908
 
9494
8909
  ControlsOptionsUtil.hasHints = restorableHasHints;
8910
+ hasPoliciesSpy.restore();
9495
8911
  });
9496
8912
  });
9497
8913