@webex/plugin-meetings 3.12.0-next.19 → 3.12.0-next.190
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.
- package/.sdd/manifest.json +1312 -0
- package/.sdd/templates/.source.json +30 -0
- package/.sdd/templates/component-repo/module-docs/module-spec-quality.md +111 -0
- package/.sdd/templates/component-repo/module-docs/module-spec.template.md +321 -0
- package/.sdd/templates/component-repo/reference-docs/adr/_adr-example.md +59 -0
- package/.sdd/templates/component-repo/reference-docs/patterns/_pattern-example.md +49 -0
- package/.sdd/templates/component-repo/reference-docs/rules/_rule-example.md +42 -0
- package/.sdd/templates/component-repo/standing-docs/AGENTS.template.md +120 -0
- package/.sdd/templates/component-repo/standing-docs/ARCHITECTURE.template.md +206 -0
- package/.sdd/templates/component-repo/standing-docs/CONTRACTS.template.md +90 -0
- package/.sdd/templates/component-repo/standing-docs/DATA_MODEL.template.md +68 -0
- package/.sdd/templates/component-repo/standing-docs/GETTING_STARTED.template.md +111 -0
- package/.sdd/templates/component-repo/standing-docs/GLOSSARY.template.md +57 -0
- package/.sdd/templates/component-repo/standing-docs/REVIEW_CHECKLIST.template.md +69 -0
- package/.sdd/templates/component-repo/standing-docs/RULES.template.md +96 -0
- package/.sdd/templates/component-repo/standing-docs/SECURITY.template.md +84 -0
- package/.sdd/templates/component-repo/standing-docs/SERVICE_STATE.template.md +82 -0
- package/.sdd/templates/component-repo/standing-docs/SPEC_INDEX.template.md +94 -0
- package/.sdd/templates/component-repo/standing-docs/TEST_INDEX.template.md +64 -0
- package/.sdd/templates/component-repo/template-map.json +112 -0
- package/AGENTS.md +135 -0
- package/ai-docs/ARCHITECTURE.md +208 -0
- package/ai-docs/CONTRACTS.md +267 -0
- package/ai-docs/DATA_MODEL.md +64 -0
- package/ai-docs/GETTING_STARTED.md +73 -0
- package/ai-docs/GLOSSARY.md +56 -0
- package/ai-docs/REVIEW_CHECKLIST.md +45 -0
- package/ai-docs/RULES.md +79 -0
- package/ai-docs/SECURITY.md +74 -0
- package/ai-docs/SERVICE_STATE.md +59 -0
- package/ai-docs/SPEC_INDEX.md +85 -0
- package/ai-docs/TEST_INDEX.md +45 -0
- package/ai-docs/adr/0001-migrate-existing-docs-into-sdd.md +61 -0
- package/ai-docs/patterns/defensive-error-propagation.md +55 -0
- package/ai-docs/patterns/event-scope-emission.md +46 -0
- package/ai-docs/patterns/source-to-test-path-mirroring.md +45 -0
- package/ai-docs/patterns/stateless-plugin-request-classes.md +53 -0
- package/ai-docs/patterns/typed-constants-and-enum-values.md +47 -0
- package/assets/README.md +28 -0
- package/assets/e2ee-0.0.1.js +2 -0
- package/assets/e2ee-0.0.1.wasm +0 -0
- package/dist/aiEnableRequest/index.js +15 -2
- package/dist/aiEnableRequest/index.js.map +1 -1
- package/dist/annotation/index.js +55 -19
- package/dist/annotation/index.js.map +1 -1
- package/dist/assets/e2ee-0.0.1.js +2 -0
- package/dist/assets/e2ee-0.0.1.wasm +0 -0
- package/dist/breakouts/breakout.js +8 -3
- package/dist/breakouts/breakout.js.map +1 -1
- package/dist/breakouts/events.js +29 -14
- package/dist/breakouts/events.js.map +1 -1
- package/dist/breakouts/index.js +128 -7
- package/dist/breakouts/index.js.map +1 -1
- package/dist/common/errors/webex-errors.js +54 -5
- package/dist/common/errors/webex-errors.js.map +1 -1
- package/dist/config.js +3 -2
- package/dist/config.js.map +1 -1
- package/dist/constants.js +39 -11
- package/dist/constants.js.map +1 -1
- package/dist/controls-options-manager/index.js +46 -10
- package/dist/controls-options-manager/index.js.map +1 -1
- package/dist/hashTree/constants.js +4 -1
- package/dist/hashTree/constants.js.map +1 -1
- package/dist/hashTree/hashTreeParser.js +1096 -391
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/hashTree/utils.js +20 -0
- package/dist/hashTree/utils.js.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/interceptors/dataChannelAuthToken.js +58 -16
- package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
- package/dist/interceptors/locusRetry.js +24 -9
- package/dist/interceptors/locusRetry.js.map +1 -1
- package/dist/interpretation/index.js +55 -12
- package/dist/interpretation/index.js.map +1 -1
- package/dist/interpretation/interpretation.types.js +7 -0
- package/dist/interpretation/interpretation.types.js.map +1 -0
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/locus-info/controlsUtils.js +4 -1
- package/dist/locus-info/controlsUtils.js.map +1 -1
- package/dist/locus-info/index.js +615 -176
- package/dist/locus-info/index.js.map +1 -1
- package/dist/locus-info/infoUtils.js +36 -5
- package/dist/locus-info/infoUtils.js.map +1 -1
- package/dist/locus-info/types.js +20 -0
- package/dist/locus-info/types.js.map +1 -1
- package/dist/media/MediaConnectionAwaiter.js +229 -166
- package/dist/media/MediaConnectionAwaiter.js.map +1 -1
- package/dist/media/index.js +8 -2
- package/dist/media/index.js.map +1 -1
- package/dist/media/properties.js +4 -5
- package/dist/media/properties.js.map +1 -1
- package/dist/meeting/in-meeting-actions.js +5 -1
- package/dist/meeting/in-meeting-actions.js.map +1 -1
- package/dist/meeting/index.js +1850 -961
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/locusMediaRequest.js +229 -82
- package/dist/meeting/locusMediaRequest.js.map +1 -1
- package/dist/meeting/muteState.js +10 -1
- package/dist/meeting/muteState.js.map +1 -1
- package/dist/meeting/request.js +5 -2
- package/dist/meeting/request.js.map +1 -1
- package/dist/meeting/util.js +42 -4
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting/voicea-meeting.js +2 -1
- package/dist/meeting/voicea-meeting.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +12 -5
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meetings/index.js +304 -129
- package/dist/meetings/index.js.map +1 -1
- package/dist/meetings/meetings.types.js +6 -1
- package/dist/meetings/meetings.types.js.map +1 -1
- package/dist/meetings/request.js +39 -0
- package/dist/meetings/request.js.map +1 -1
- package/dist/meetings/util.js +116 -18
- package/dist/meetings/util.js.map +1 -1
- package/dist/member/index.js +10 -0
- package/dist/member/index.js.map +1 -1
- package/dist/member/types.js.map +1 -1
- package/dist/member/util.js +30 -0
- package/dist/member/util.js.map +1 -1
- package/dist/members/index.js +101 -43
- package/dist/members/index.js.map +1 -1
- package/dist/members/util.js +8 -1
- package/dist/members/util.js.map +1 -1
- package/dist/metrics/constants.js +7 -1
- package/dist/metrics/constants.js.map +1 -1
- package/dist/multistream/codec/constants.js +63 -0
- package/dist/multistream/codec/constants.js.map +1 -0
- package/dist/multistream/mediaRequestManager.js +62 -15
- package/dist/multistream/mediaRequestManager.js.map +1 -1
- package/dist/multistream/receiveSlot.js +9 -0
- package/dist/multistream/receiveSlot.js.map +1 -1
- package/dist/multistream/remoteMediaManager.js +32 -4
- package/dist/multistream/remoteMediaManager.js.map +1 -1
- package/dist/multistream/sendSlotManager.js +11 -1
- package/dist/multistream/sendSlotManager.js.map +1 -1
- package/dist/reachability/clusterReachability.js.map +1 -1
- package/dist/reachability/index.js +121 -83
- package/dist/reachability/index.js.map +1 -1
- package/dist/reachability/reachability.types.js +2 -0
- package/dist/reachability/reachability.types.js.map +1 -1
- package/dist/reachability/util.js +45 -0
- package/dist/reachability/util.js.map +1 -1
- package/dist/reactions/reactions.type.js.map +1 -1
- package/dist/recording-controller/index.js +1 -3
- package/dist/recording-controller/index.js.map +1 -1
- package/dist/roap/turnDiscovery.js +8 -1
- package/dist/roap/turnDiscovery.js.map +1 -1
- package/dist/types/annotation/index.d.ts +19 -0
- package/dist/types/common/errors/webex-errors.d.ts +36 -2
- package/dist/types/config.d.ts +3 -2
- package/dist/types/constants.d.ts +15 -2
- package/dist/types/controls-options-manager/index.d.ts +16 -0
- package/dist/types/hashTree/constants.d.ts +1 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +201 -22
- package/dist/types/hashTree/utils.d.ts +7 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/interceptors/locusRetry.d.ts +4 -4
- package/dist/types/interpretation/interpretation.types.d.ts +10 -0
- package/dist/types/locus-info/index.d.ts +106 -8
- package/dist/types/locus-info/infoUtils.d.ts +8 -0
- package/dist/types/locus-info/types.d.ts +22 -1
- package/dist/types/media/MediaConnectionAwaiter.d.ts +66 -49
- package/dist/types/media/properties.d.ts +6 -2
- package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
- package/dist/types/meeting/index.d.ts +217 -16
- package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
- package/dist/types/meeting/request.d.ts +1 -0
- package/dist/types/meeting/util.d.ts +12 -1
- package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
- package/dist/types/meetings/index.d.ts +40 -19
- package/dist/types/meetings/meetings.types.d.ts +15 -0
- package/dist/types/meetings/request.d.ts +14 -0
- package/dist/types/member/index.d.ts +1 -0
- package/dist/types/member/types.d.ts +1 -0
- package/dist/types/member/util.d.ts +9 -0
- package/dist/types/members/index.d.ts +15 -2
- package/dist/types/members/util.d.ts +1 -5
- package/dist/types/metrics/constants.d.ts +6 -0
- package/dist/types/multistream/codec/constants.d.ts +7 -0
- package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
- package/dist/types/multistream/remoteMediaManager.d.ts +18 -0
- package/dist/types/multistream/sendSlotManager.d.ts +5 -1
- package/dist/types/reachability/clusterReachability.d.ts +3 -3
- package/dist/types/reachability/index.d.ts +10 -3
- package/dist/types/reachability/reachability.types.d.ts +7 -0
- package/dist/types/reachability/util.d.ts +17 -0
- package/dist/types/reactions/reactions.type.d.ts +3 -0
- package/dist/webinar/index.js +441 -252
- package/dist/webinar/index.js.map +1 -1
- package/package.json +26 -24
- package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
- package/src/aiEnableRequest/index.ts +16 -0
- package/src/annotation/ai-docs/annotation-spec.md +236 -0
- package/src/annotation/index.ts +61 -29
- package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
- package/src/breakouts/breakout.ts +3 -1
- package/src/breakouts/events.ts +33 -11
- package/src/breakouts/index.ts +145 -3
- package/src/common/errors/webex-errors.ts +56 -3
- package/src/config.ts +7 -3
- package/src/constants.ts +23 -4
- package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
- package/src/controls-options-manager/index.ts +62 -10
- package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
- package/src/hashTree/constants.ts +7 -0
- package/src/hashTree/hashTreeParser.ts +861 -193
- package/src/hashTree/utils.ts +19 -0
- package/src/index.ts +7 -0
- package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
- package/src/interceptors/dataChannelAuthToken.ts +59 -12
- package/src/interceptors/locusRetry.ts +26 -5
- package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
- package/src/interpretation/index.ts +65 -10
- package/src/interpretation/interpretation.types.ts +11 -0
- package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
- package/src/locus-info/controlsUtils.ts +3 -1
- package/src/locus-info/index.ts +566 -164
- package/src/locus-info/infoUtils.ts +41 -6
- package/src/locus-info/types.ts +26 -1
- package/src/media/MediaConnectionAwaiter.ts +229 -196
- package/src/media/ai-docs/media-spec.md +267 -0
- package/src/media/index.ts +10 -1
- package/src/media/properties.ts +8 -3
- package/src/meeting/ai-docs/meeting-spec.md +404 -0
- package/src/meeting/in-meeting-actions.ts +8 -0
- package/src/meeting/index.ts +1093 -251
- package/src/meeting/locusMediaRequest.ts +106 -6
- package/src/meeting/muteState.ts +10 -1
- package/src/meeting/request.ts +11 -0
- package/src/meeting/util.ts +53 -9
- package/src/meeting/voicea-meeting.ts +1 -1
- package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
- package/src/meeting-info/meeting-info-v2.ts +11 -4
- package/src/meetings/ai-docs/meetings-spec.md +296 -0
- package/src/meetings/index.ts +202 -81
- package/src/meetings/meetings.types.ts +19 -0
- package/src/meetings/request.ts +43 -0
- package/src/meetings/util.ts +117 -4
- package/src/member/ai-docs/member-spec.md +196 -0
- package/src/member/index.ts +10 -0
- package/src/member/types.ts +1 -0
- package/src/member/util.ts +29 -0
- package/src/members/ai-docs/members-spec.md +256 -0
- package/src/members/index.ts +70 -7
- package/src/members/util.ts +12 -4
- package/src/metrics/ai-docs/metrics-spec.md +185 -0
- package/src/metrics/constants.ts +6 -0
- package/src/multistream/ai-docs/multistream-spec.md +295 -0
- package/src/multistream/codec/constants.ts +58 -0
- package/src/multistream/mediaRequestManager.ts +119 -28
- package/src/multistream/receiveSlot.ts +18 -0
- package/src/multistream/remoteMediaManager.ts +23 -1
- package/src/multistream/sendSlotManager.ts +15 -1
- package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
- package/src/reachability/ai-docs/reachability-spec.md +261 -0
- package/src/reachability/clusterReachability.ts +3 -2
- package/src/reachability/index.ts +47 -16
- package/src/reachability/reachability.types.ts +11 -0
- package/src/reachability/util.ts +36 -0
- package/src/reactions/ai-docs/reactions-spec.md +198 -0
- package/src/reactions/reactions.type.ts +3 -0
- package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
- package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
- package/src/recording-controller/index.ts +1 -2
- package/src/roap/ai-docs/roap-spec.md +241 -0
- package/src/roap/turnDiscovery.ts +9 -1
- package/src/webinar/ai-docs/webinar-spec.md +243 -0
- package/src/webinar/index.ts +247 -89
- package/test/unit/spec/aiEnableRequest/index.ts +86 -0
- package/test/unit/spec/annotation/index.ts +214 -182
- package/test/unit/spec/breakouts/breakout.ts +9 -3
- package/test/unit/spec/breakouts/events.ts +120 -2
- package/test/unit/spec/breakouts/index.ts +336 -15
- package/test/unit/spec/common/errors/webex-errors.ts +78 -0
- package/test/unit/spec/controls-options-manager/index.js +139 -32
- package/test/unit/spec/hashTree/hashTreeParser.ts +2360 -239
- package/test/unit/spec/hashTree/utils.ts +37 -0
- package/test/unit/spec/interceptors/dataChannelAuthToken.ts +179 -1
- package/test/unit/spec/interceptors/locusRetry.ts +234 -5
- package/test/unit/spec/interpretation/index.ts +119 -4
- package/test/unit/spec/locus-info/controlsUtils.js +172 -57
- package/test/unit/spec/locus-info/index.js +1014 -58
- package/test/unit/spec/locus-info/infoUtils.js +184 -1
- package/test/unit/spec/media/MediaConnectionAwaiter.ts +479 -17
- package/test/unit/spec/media/index.ts +92 -0
- package/test/unit/spec/media/properties.ts +26 -26
- package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
- package/test/unit/spec/meeting/index.js +3601 -536
- package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
- package/test/unit/spec/meeting/muteState.js +81 -0
- package/test/unit/spec/meeting/request.js +12 -0
- package/test/unit/spec/meeting/utils.js +205 -19
- package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
- package/test/unit/spec/meeting-info/meetinginfov2.js +88 -11
- package/test/unit/spec/meetings/index.js +549 -49
- package/test/unit/spec/meetings/request.js +141 -0
- package/test/unit/spec/meetings/utils.js +402 -51
- package/test/unit/spec/member/index.js +7 -0
- package/test/unit/spec/member/util.js +89 -0
- package/test/unit/spec/members/index.js +216 -0
- package/test/unit/spec/members/request.js +37 -1
- package/test/unit/spec/members/utils.js +63 -0
- package/test/unit/spec/multistream/mediaRequestManager.ts +501 -37
- package/test/unit/spec/multistream/remoteMediaManager.ts +46 -0
- package/test/unit/spec/multistream/sendSlotManager.ts +30 -2
- package/test/unit/spec/reachability/index.ts +128 -46
- package/test/unit/spec/reachability/util.ts +31 -0
- package/test/unit/spec/recording-controller/index.js +9 -8
- package/test/unit/spec/roap/turnDiscovery.ts +20 -0
- package/test/unit/spec/webinar/index.ts +935 -466
|
@@ -5,100 +5,140 @@ import MockWebex from '@webex/test-helper-mock-webex';
|
|
|
5
5
|
import uuid from 'uuid';
|
|
6
6
|
import sinon from 'sinon';
|
|
7
7
|
import {DataChannelTokenType} from '@webex/internal-plugin-llm';
|
|
8
|
-
import {
|
|
8
|
+
import {LOCUS_LLM_EVENT, SHARE_STATUS} from '@webex/plugin-meetings/src/constants';
|
|
9
9
|
|
|
10
10
|
describe('plugin-meetings', () => {
|
|
11
11
|
describe('Webinar', () => {
|
|
12
|
+
let webex;
|
|
13
|
+
let webinar;
|
|
14
|
+
let uuidStub;
|
|
15
|
+
let getUserTokenStub;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Creates a mock LLM channel with all the expected methods
|
|
19
|
+
*/
|
|
20
|
+
function createMockLLMChannel(overrides = {}) {
|
|
21
|
+
return {
|
|
22
|
+
registerAndConnect: sinon.stub().resolves('REGISTER_AND_CONNECT_RESULT'),
|
|
23
|
+
disconnect: sinon.stub().resolves(),
|
|
24
|
+
isConnected: sinon.stub().returns(false),
|
|
25
|
+
isConnecting: sinon.stub().returns(false),
|
|
26
|
+
getLocusUrl: sinon.stub().returns(undefined),
|
|
27
|
+
getDatachannelUrl: sinon.stub().returns(undefined),
|
|
28
|
+
getDatachannelToken: sinon.stub().returns(undefined),
|
|
29
|
+
setDatachannelToken: sinon.stub(),
|
|
30
|
+
getBinding: sinon.stub().returns(undefined),
|
|
31
|
+
setRefreshHandler: sinon.stub(),
|
|
32
|
+
on: sinon.stub(),
|
|
33
|
+
off: sinon.stub(),
|
|
34
|
+
...overrides,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
12
37
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
38
|
+
beforeEach(() => {
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
getUserTokenStub = sinon.stub().resolves('test-token');
|
|
41
|
+
uuidStub = sinon.stub(uuid, 'v4').returns('test-uuid');
|
|
42
|
+
webex = new MockWebex({});
|
|
43
|
+
webex.internal.mercury.on = sinon.stub();
|
|
44
|
+
webinar = new Webinar({}, {parent: webex});
|
|
45
|
+
webinar.locusUrl = 'locusUrl';
|
|
46
|
+
webinar.webcastInstanceUrl = 'webcastInstanceUrl';
|
|
47
|
+
webex.request = sinon.stub().returns(Promise.resolve('REQUEST_RETURN_VALUE'));
|
|
48
|
+
webex.meetings = {};
|
|
49
|
+
webex.credentials.getUserToken = getUserTokenStub;
|
|
50
|
+
webex.meetings.getMeetingByType = sinon.stub();
|
|
51
|
+
webex.internal.voicea.announce = sinon.stub();
|
|
52
|
+
|
|
53
|
+
// Factory pattern: createChannel returns a mock channel
|
|
54
|
+
webex.internal.llm = {
|
|
55
|
+
isDataChannelTokenEnabled: sinon.stub().resolves(false),
|
|
56
|
+
createChannel: sinon.stub().callsFake(() => createMockLLMChannel()),
|
|
57
|
+
};
|
|
17
58
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
webex.credentials.getUserToken = getUserTokenStub;
|
|
30
|
-
webex.meetings.getMeetingByType = sinon.stub();
|
|
31
|
-
webex.internal.voicea.announce = sinon.stub();
|
|
32
|
-
|
|
33
|
-
webex.internal.llm = {
|
|
34
|
-
getDatachannelToken: sinon.stub().returns(undefined),
|
|
35
|
-
setDatachannelToken: sinon.stub(),
|
|
36
|
-
isDataChannelTokenEnabled: sinon.stub().resolves(false),
|
|
37
|
-
isConnected: sinon.stub().returns(false),
|
|
38
|
-
disconnectLLM: sinon.stub().resolves(),
|
|
39
|
-
off: sinon.stub(),
|
|
40
|
-
on: sinon.stub(),
|
|
41
|
-
getLocusUrl: sinon.stub().returns('old-locus-url'),
|
|
42
|
-
getDatachannelUrl: sinon.stub().returns('old-dc-url'),
|
|
43
|
-
registerAndConnect: sinon.stub().resolves('REGISTER_AND_CONNECT_RESULT'),
|
|
44
|
-
};
|
|
45
|
-
});
|
|
59
|
+
// Mock voicea createChannel for practice session
|
|
60
|
+
webex.internal.voicea.createChannel = sinon.stub().callsFake(() => ({
|
|
61
|
+
on: sinon.stub(),
|
|
62
|
+
off: sinon.stub(),
|
|
63
|
+
announce: sinon.stub(),
|
|
64
|
+
turnOnCaptions: sinon.stub().resolves(),
|
|
65
|
+
deregisterEvents: sinon.stub(),
|
|
66
|
+
getIsCaptionBoxOn: sinon.stub().returns(false),
|
|
67
|
+
updateSubchannelSubscriptions: sinon.stub(),
|
|
68
|
+
}));
|
|
69
|
+
});
|
|
46
70
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
71
|
+
afterEach(() => {
|
|
72
|
+
sinon.restore();
|
|
73
|
+
});
|
|
50
74
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
75
|
+
describe('#locusUrlUpdate', () => {
|
|
76
|
+
it('sets the locus url', () => {
|
|
77
|
+
webinar.locusUrlUpdate('newUrl');
|
|
54
78
|
|
|
55
|
-
|
|
56
|
-
});
|
|
79
|
+
assert.equal(webinar.locusUrl, 'newUrl');
|
|
57
80
|
});
|
|
81
|
+
});
|
|
58
82
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
83
|
+
describe('#updateWebcastUrl', () => {
|
|
84
|
+
it('sets the webcast instance url', () => {
|
|
85
|
+
webinar.updateWebcastUrl({resources: {webcastInstance: {url: 'newUrl'}}});
|
|
62
86
|
|
|
63
|
-
|
|
64
|
-
});
|
|
87
|
+
assert.equal(webinar.webcastInstanceUrl, 'newUrl');
|
|
65
88
|
});
|
|
89
|
+
});
|
|
66
90
|
|
|
91
|
+
describe('#updateCanManageWebcast', () => {
|
|
92
|
+
it('sets the webcast instance url when valid', () => {
|
|
93
|
+
webinar.updateWebcastUrl({resources: {webcastInstance: {url: 'newUrl'}}});
|
|
94
|
+
assert.equal(
|
|
95
|
+
webinar.webcastInstanceUrl,
|
|
96
|
+
'newUrl',
|
|
97
|
+
'webcast instance URL should be updated'
|
|
98
|
+
);
|
|
99
|
+
});
|
|
67
100
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
webinar.updateWebcastUrl({});
|
|
76
|
-
assert.isUndefined(webinar.webcastInstanceUrl, 'webcast instance URL should be undefined');
|
|
77
|
-
});
|
|
101
|
+
it('handles missing resources gracefully', () => {
|
|
102
|
+
webinar.updateWebcastUrl({});
|
|
103
|
+
assert.isUndefined(
|
|
104
|
+
webinar.webcastInstanceUrl,
|
|
105
|
+
'webcast instance URL should be undefined'
|
|
106
|
+
);
|
|
107
|
+
});
|
|
78
108
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
109
|
+
it('handles missing webcastInstance gracefully', () => {
|
|
110
|
+
webinar.updateWebcastUrl({resources: {}});
|
|
111
|
+
assert.isUndefined(
|
|
112
|
+
webinar.webcastInstanceUrl,
|
|
113
|
+
'webcast instance URL should be undefined'
|
|
114
|
+
);
|
|
115
|
+
});
|
|
83
116
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
117
|
+
it('handles missing URL gracefully', () => {
|
|
118
|
+
webinar.updateWebcastUrl({resources: {webcastInstance: {}}});
|
|
119
|
+
assert.isUndefined(
|
|
120
|
+
webinar.webcastInstanceUrl,
|
|
121
|
+
'webcast instance URL should be undefined'
|
|
122
|
+
);
|
|
88
123
|
});
|
|
124
|
+
});
|
|
89
125
|
|
|
90
126
|
describe('#updateRoleChanged', () => {
|
|
91
127
|
it('updates roles when promoted from attendee to panelist', () => {
|
|
92
128
|
const payload = {
|
|
93
129
|
oldRoles: ['ATTENDEE'],
|
|
94
|
-
newRoles: ['PANELIST']
|
|
130
|
+
newRoles: ['PANELIST'],
|
|
95
131
|
};
|
|
96
132
|
|
|
97
133
|
const result = webinar.updateRoleChanged(payload);
|
|
98
134
|
|
|
99
135
|
assert.equal(webinar.selfIsPanelist, true, 'self should be a panelist');
|
|
100
136
|
assert.equal(webinar.selfIsAttendee, false, 'self should not be an attendee');
|
|
101
|
-
assert.equal(
|
|
137
|
+
assert.equal(
|
|
138
|
+
webinar.canManageWebcast,
|
|
139
|
+
false,
|
|
140
|
+
'self should not have manage webcast capability'
|
|
141
|
+
);
|
|
102
142
|
assert.equal(result.isPromoted, true, 'should indicate promotion');
|
|
103
143
|
assert.equal(result.isDemoted, false, 'should not indicate demotion');
|
|
104
144
|
});
|
|
@@ -106,14 +146,18 @@ describe('plugin-meetings', () => {
|
|
|
106
146
|
it('updates roles when demoted from panelist to attendee', () => {
|
|
107
147
|
const payload = {
|
|
108
148
|
oldRoles: ['PANELIST'],
|
|
109
|
-
newRoles: ['ATTENDEE']
|
|
149
|
+
newRoles: ['ATTENDEE'],
|
|
110
150
|
};
|
|
111
151
|
|
|
112
152
|
const result = webinar.updateRoleChanged(payload);
|
|
113
153
|
|
|
114
154
|
assert.equal(webinar.selfIsPanelist, false, 'self should not be a panelist');
|
|
115
155
|
assert.equal(webinar.selfIsAttendee, true, 'self should be an attendee');
|
|
116
|
-
assert.equal(
|
|
156
|
+
assert.equal(
|
|
157
|
+
webinar.canManageWebcast,
|
|
158
|
+
false,
|
|
159
|
+
'self should not have manage webcast capability'
|
|
160
|
+
);
|
|
117
161
|
assert.equal(result.isPromoted, false, 'should not indicate promotion');
|
|
118
162
|
assert.equal(result.isDemoted, true, 'should indicate demotion');
|
|
119
163
|
});
|
|
@@ -121,14 +165,18 @@ describe('plugin-meetings', () => {
|
|
|
121
165
|
it('updates roles when attendee just join meeting', () => {
|
|
122
166
|
const payload = {
|
|
123
167
|
oldRoles: [''],
|
|
124
|
-
newRoles: ['ATTENDEE']
|
|
168
|
+
newRoles: ['ATTENDEE'],
|
|
125
169
|
};
|
|
126
170
|
|
|
127
171
|
const result = webinar.updateRoleChanged(payload);
|
|
128
172
|
|
|
129
173
|
assert.equal(webinar.selfIsPanelist, false, 'self should not be a panelist');
|
|
130
174
|
assert.equal(webinar.selfIsAttendee, true, 'self should be an attendee');
|
|
131
|
-
assert.equal(
|
|
175
|
+
assert.equal(
|
|
176
|
+
webinar.canManageWebcast,
|
|
177
|
+
false,
|
|
178
|
+
'self should not have manage webcast capability'
|
|
179
|
+
);
|
|
132
180
|
assert.equal(result.isPromoted, false, 'should not indicate promotion');
|
|
133
181
|
assert.equal(result.isDemoted, true, 'should indicate demotion');
|
|
134
182
|
});
|
|
@@ -136,14 +184,18 @@ describe('plugin-meetings', () => {
|
|
|
136
184
|
it('updates roles when promoted to moderator', () => {
|
|
137
185
|
const payload = {
|
|
138
186
|
oldRoles: ['PANELIST'],
|
|
139
|
-
newRoles: ['MODERATOR']
|
|
187
|
+
newRoles: ['MODERATOR'],
|
|
140
188
|
};
|
|
141
189
|
|
|
142
190
|
const result = webinar.updateRoleChanged(payload);
|
|
143
191
|
|
|
144
192
|
assert.equal(webinar.selfIsPanelist, false, 'self should not be a panelist');
|
|
145
193
|
assert.equal(webinar.selfIsAttendee, false, 'self should not be an attendee');
|
|
146
|
-
assert.equal(
|
|
194
|
+
assert.equal(
|
|
195
|
+
webinar.canManageWebcast,
|
|
196
|
+
true,
|
|
197
|
+
'self should have manage webcast capability'
|
|
198
|
+
);
|
|
147
199
|
assert.equal(result.isPromoted, false, 'should not indicate promotion');
|
|
148
200
|
assert.equal(result.isDemoted, false, 'should not indicate demotion');
|
|
149
201
|
});
|
|
@@ -151,415 +203,743 @@ describe('plugin-meetings', () => {
|
|
|
151
203
|
it('updates roles when unchanged (remains as panelist)', () => {
|
|
152
204
|
const payload = {
|
|
153
205
|
oldRoles: ['PANELIST'],
|
|
154
|
-
newRoles: ['PANELIST']
|
|
206
|
+
newRoles: ['PANELIST'],
|
|
155
207
|
};
|
|
156
208
|
|
|
157
209
|
const result = webinar.updateRoleChanged(payload);
|
|
158
210
|
|
|
159
211
|
assert.equal(webinar.selfIsPanelist, true, 'self should remain a panelist');
|
|
160
212
|
assert.equal(webinar.selfIsAttendee, false, 'self should not be an attendee');
|
|
161
|
-
assert.equal(
|
|
213
|
+
assert.equal(
|
|
214
|
+
webinar.canManageWebcast,
|
|
215
|
+
false,
|
|
216
|
+
'self should not have manage webcast capability'
|
|
217
|
+
);
|
|
162
218
|
assert.equal(result.isPromoted, false, 'should not indicate promotion');
|
|
163
219
|
assert.equal(result.isDemoted, false, 'should not indicate demotion');
|
|
164
220
|
});
|
|
165
221
|
|
|
166
|
-
|
|
167
|
-
|
|
222
|
+
it('handles missing role payload safely', () => {
|
|
223
|
+
const updateStatusByRoleStub = sinon.stub(webinar, 'updateStatusByRole');
|
|
168
224
|
|
|
169
|
-
|
|
225
|
+
const result = webinar.updateRoleChanged(undefined);
|
|
170
226
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
227
|
+
assert.equal(webinar.selfIsPanelist, false);
|
|
228
|
+
assert.equal(webinar.selfIsAttendee, false);
|
|
229
|
+
assert.equal(webinar.canManageWebcast, false);
|
|
230
|
+
assert.deepEqual(result, {isPromoted: false, isDemoted: false});
|
|
231
|
+
assert.calledOnceWithExactly(updateStatusByRoleStub, {
|
|
232
|
+
isPromoted: false,
|
|
233
|
+
isDemoted: false,
|
|
234
|
+
});
|
|
235
|
+
});
|
|
176
236
|
});
|
|
177
|
-
});
|
|
178
237
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
238
|
+
describe('#getValidatedWebinarMeeting', () => {
|
|
239
|
+
it('returns the meeting when its locusUrl matches the webinar locusUrl', () => {
|
|
240
|
+
const meeting = {locusUrl: 'locusUrl'};
|
|
241
|
+
webex.meetings.getMeetingByType = sinon.stub().returns(meeting);
|
|
242
|
+
webinar.locusUrl = 'locusUrl';
|
|
182
243
|
|
|
183
|
-
|
|
244
|
+
assert.equal(webinar.getValidatedWebinarMeeting(), meeting);
|
|
245
|
+
});
|
|
184
246
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
247
|
+
it('returns undefined and warns when the resolved meeting locusUrl does not match', () => {
|
|
248
|
+
const warnStub = sinon.stub(LoggerProxy.logger, 'warn');
|
|
249
|
+
const meeting = {locusUrl: 'other-locus-url'};
|
|
250
|
+
webex.meetings.getMeetingByType = sinon.stub().returns(meeting);
|
|
251
|
+
webinar.locusUrl = 'locusUrl';
|
|
188
252
|
|
|
189
|
-
|
|
190
|
-
|
|
253
|
+
assert.isUndefined(webinar.getValidatedWebinarMeeting());
|
|
254
|
+
assert.calledOnce(warnStub);
|
|
255
|
+
});
|
|
191
256
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
257
|
+
it('returns undefined when no meeting is resolved', () => {
|
|
258
|
+
webex.meetings.getMeetingByType = sinon.stub().returns(undefined);
|
|
259
|
+
|
|
260
|
+
assert.isUndefined(webinar.getValidatedWebinarMeeting());
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it('returns undefined and warns when webinar locusUrl is not yet initialized', () => {
|
|
264
|
+
const warnStub = sinon.stub(LoggerProxy.logger, 'warn');
|
|
265
|
+
const meeting = {locusUrl: 'some-url'};
|
|
266
|
+
webex.meetings.getMeetingByType = sinon.stub().returns(meeting);
|
|
267
|
+
webinar.locusUrl = undefined;
|
|
196
268
|
|
|
197
|
-
|
|
269
|
+
assert.isUndefined(webinar.getValidatedWebinarMeeting());
|
|
270
|
+
assert.calledOnce(warnStub);
|
|
271
|
+
});
|
|
198
272
|
});
|
|
199
273
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
);
|
|
208
|
-
assert.calledOnceWithExactly(
|
|
209
|
-
webex.internal.llm.off,
|
|
210
|
-
`event:relay.event:${LLM_PRACTICE_SESSION}`,
|
|
211
|
-
meeting.processRelayEvent
|
|
212
|
-
);
|
|
274
|
+
describe('#cleanUp', () => {
|
|
275
|
+
it('delegates to cleanupPSDataChannel', () => {
|
|
276
|
+
const cleanupPSDataChannelStub = sinon.stub(webinar, 'cleanupPSDataChannel').resolves();
|
|
277
|
+
|
|
278
|
+
webinar.cleanUp();
|
|
279
|
+
|
|
280
|
+
assert.calledOnceWithExactly(cleanupPSDataChannelStub);
|
|
281
|
+
});
|
|
213
282
|
});
|
|
214
283
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
284
|
+
describe('#getPracticeSessionBinding', () => {
|
|
285
|
+
it('returns binding when practice session channel exists and is connected', () => {
|
|
286
|
+
const mockChannel = createMockLLMChannel({
|
|
287
|
+
getBinding: sinon.stub().returns('test-binding-123'),
|
|
288
|
+
});
|
|
289
|
+
webinar._practiceSessionLLMChannel = mockChannel;
|
|
290
|
+
|
|
291
|
+
const binding = webinar.getPracticeSessionBinding();
|
|
292
|
+
|
|
293
|
+
assert.equal(binding, 'test-binding-123');
|
|
294
|
+
assert.calledOnce(mockChannel.getBinding);
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
it('returns undefined when no practice session channel exists', () => {
|
|
298
|
+
webinar._practiceSessionLLMChannel = undefined;
|
|
218
299
|
|
|
219
|
-
|
|
300
|
+
const binding = webinar.getPracticeSessionBinding();
|
|
220
301
|
|
|
221
|
-
|
|
222
|
-
|
|
302
|
+
assert.isUndefined(binding);
|
|
303
|
+
});
|
|
223
304
|
});
|
|
224
305
|
|
|
225
|
-
|
|
226
|
-
|
|
306
|
+
describe('#getPracticeSessionLocusUrl', () => {
|
|
307
|
+
it('returns locus URL when practice session channel exists', () => {
|
|
308
|
+
const mockChannel = createMockLLMChannel({
|
|
309
|
+
getLocusUrl: sinon.stub().returns('https://locus.example.com/practice'),
|
|
310
|
+
});
|
|
311
|
+
webinar._practiceSessionLLMChannel = mockChannel;
|
|
227
312
|
|
|
228
|
-
|
|
313
|
+
const locusUrl = webinar.getPracticeSessionLocusUrl();
|
|
229
314
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
315
|
+
assert.equal(locusUrl, 'https://locus.example.com/practice');
|
|
316
|
+
assert.calledOnce(mockChannel.getLocusUrl);
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
it('returns undefined when no practice session channel exists', () => {
|
|
320
|
+
webinar._practiceSessionLLMChannel = undefined;
|
|
321
|
+
|
|
322
|
+
const locusUrl = webinar.getPracticeSessionLocusUrl();
|
|
323
|
+
|
|
324
|
+
assert.isUndefined(locusUrl);
|
|
325
|
+
});
|
|
233
326
|
});
|
|
234
|
-
});
|
|
235
327
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
let processRelayEvent;
|
|
328
|
+
describe('#ensurePracticeSessionDatachannelToken', () => {
|
|
329
|
+
let meeting;
|
|
239
330
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
info: {practiceSessionDatachannelUrl: 'dc-url'},
|
|
248
|
-
},
|
|
249
|
-
};
|
|
331
|
+
beforeEach(() => {
|
|
332
|
+
meeting = {
|
|
333
|
+
refreshDataChannelToken: sinon.stub().resolves({
|
|
334
|
+
body: {datachannelToken: 'refreshed-token'},
|
|
335
|
+
}),
|
|
336
|
+
};
|
|
337
|
+
});
|
|
250
338
|
|
|
251
|
-
|
|
339
|
+
it('returns undefined when data channel token is not enabled', async () => {
|
|
340
|
+
webex.internal.llm.isDataChannelTokenEnabled.resolves(false);
|
|
252
341
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
342
|
+
const token = await webinar.ensurePracticeSessionDatachannelToken(meeting);
|
|
343
|
+
|
|
344
|
+
assert.isUndefined(token);
|
|
345
|
+
assert.notCalled(meeting.refreshDataChannelToken);
|
|
256
346
|
});
|
|
257
347
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
348
|
+
it('returns cached token from channel when available', async () => {
|
|
349
|
+
webex.internal.llm.isDataChannelTokenEnabled.resolves(true);
|
|
350
|
+
const mockChannel = createMockLLMChannel({
|
|
351
|
+
getDatachannelToken: sinon.stub().returns('cached-channel-token'),
|
|
352
|
+
});
|
|
353
|
+
webinar._practiceSessionLLMChannel = mockChannel;
|
|
354
|
+
|
|
355
|
+
const token = await webinar.ensurePracticeSessionDatachannelToken(meeting);
|
|
356
|
+
|
|
357
|
+
assert.equal(token, 'cached-channel-token');
|
|
358
|
+
assert.notCalled(meeting.refreshDataChannelToken);
|
|
262
359
|
});
|
|
263
360
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
webex.internal.voicea.getIsCaptionBoxOn = sinon.stub().returns(false);
|
|
268
|
-
webex.internal.voicea.updateSubchannelSubscriptions = sinon.stub();
|
|
269
|
-
});
|
|
361
|
+
it('returns pending token when available', async () => {
|
|
362
|
+
webex.internal.llm.isDataChannelTokenEnabled.resolves(true);
|
|
363
|
+
webinar._pendingPracticeSessionDatachannelToken = 'pending-token';
|
|
270
364
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
return undefined;
|
|
277
|
-
});
|
|
278
|
-
meeting.refreshDataChannelToken = sinon.stub().resolves({
|
|
279
|
-
body: {
|
|
280
|
-
datachannelToken: 'ps-token-from-refresh',
|
|
281
|
-
dataChannelTokenType: DataChannelTokenType.PracticeSession,
|
|
282
|
-
},
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
await webinar.updatePSDataChannel();
|
|
286
|
-
|
|
287
|
-
assert.calledOnceWithExactly(meeting.refreshDataChannelToken);
|
|
288
|
-
assert.calledWithExactly(
|
|
289
|
-
webex.internal.llm.setDatachannelToken,
|
|
290
|
-
'ps-token-from-refresh',
|
|
291
|
-
DataChannelTokenType.PracticeSession
|
|
292
|
-
);
|
|
293
|
-
assert.calledWith(
|
|
294
|
-
webex.internal.llm.registerAndConnect,
|
|
295
|
-
'locus-url',
|
|
296
|
-
'dc-url',
|
|
297
|
-
'ps-token-from-refresh',
|
|
298
|
-
LLM_PRACTICE_SESSION
|
|
299
|
-
);
|
|
300
|
-
});
|
|
365
|
+
const token = await webinar.ensurePracticeSessionDatachannelToken(meeting);
|
|
366
|
+
|
|
367
|
+
assert.equal(token, 'pending-token');
|
|
368
|
+
assert.notCalled(meeting.refreshDataChannelToken);
|
|
369
|
+
});
|
|
301
370
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
371
|
+
it('refreshes token when no cached token exists', async () => {
|
|
372
|
+
webex.internal.llm.isDataChannelTokenEnabled.resolves(true);
|
|
373
|
+
webinar._practiceSessionLLMChannel = undefined;
|
|
374
|
+
webinar._pendingPracticeSessionDatachannelToken = undefined;
|
|
305
375
|
|
|
306
|
-
|
|
307
|
-
meeting.refreshDataChannelToken = sinon.stub().returns(
|
|
308
|
-
new Promise((resolve) => {
|
|
309
|
-
resolveRefresh = resolve;
|
|
310
|
-
})
|
|
311
|
-
);
|
|
376
|
+
const token = await webinar.ensurePracticeSessionDatachannelToken(meeting);
|
|
312
377
|
|
|
313
|
-
|
|
378
|
+
assert.equal(token, 'refreshed-token');
|
|
379
|
+
assert.calledOnce(meeting.refreshDataChannelToken);
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
it('stores refreshed token on channel when channel exists', async () => {
|
|
383
|
+
webex.internal.llm.isDataChannelTokenEnabled.resolves(true);
|
|
384
|
+
const mockChannel = createMockLLMChannel({
|
|
385
|
+
getDatachannelToken: sinon.stub().returns(undefined),
|
|
386
|
+
setDatachannelToken: sinon.stub(),
|
|
387
|
+
});
|
|
388
|
+
webinar._practiceSessionLLMChannel = mockChannel;
|
|
314
389
|
|
|
315
|
-
|
|
390
|
+
await webinar.ensurePracticeSessionDatachannelToken(meeting);
|
|
316
391
|
|
|
317
|
-
|
|
318
|
-
body: {
|
|
319
|
-
datachannelToken: 'stale-ps-token',
|
|
320
|
-
dataChannelTokenType: DataChannelTokenType.PracticeSession,
|
|
321
|
-
},
|
|
392
|
+
assert.calledOnceWithExactly(mockChannel.setDatachannelToken, 'refreshed-token');
|
|
322
393
|
});
|
|
323
394
|
|
|
324
|
-
|
|
395
|
+
it('stores refreshed token as pending when no channel exists', async () => {
|
|
396
|
+
webex.internal.llm.isDataChannelTokenEnabled.resolves(true);
|
|
397
|
+
webinar._practiceSessionLLMChannel = undefined;
|
|
398
|
+
webinar._pendingPracticeSessionDatachannelToken = undefined;
|
|
325
399
|
|
|
326
|
-
|
|
327
|
-
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
328
|
-
});
|
|
400
|
+
await webinar.ensurePracticeSessionDatachannelToken(meeting);
|
|
329
401
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
const cleanupPSDataChannelStub = sinon.stub(webinar, 'cleanupPSDataChannel').resolves();
|
|
402
|
+
assert.equal(webinar._pendingPracticeSessionDatachannelToken, 'refreshed-token');
|
|
403
|
+
});
|
|
333
404
|
|
|
334
|
-
|
|
405
|
+
it('returns undefined and logs warning when refresh fails', async () => {
|
|
406
|
+
webex.internal.llm.isDataChannelTokenEnabled.resolves(true);
|
|
407
|
+
webinar._practiceSessionLLMChannel = undefined;
|
|
408
|
+
webinar._pendingPracticeSessionDatachannelToken = undefined;
|
|
409
|
+
meeting.refreshDataChannelToken.rejects(new Error('refresh failed'));
|
|
410
|
+
const warnStub = sinon.stub(LoggerProxy.logger, 'warn');
|
|
335
411
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
412
|
+
const token = await webinar.ensurePracticeSessionDatachannelToken(meeting);
|
|
413
|
+
|
|
414
|
+
assert.isUndefined(token);
|
|
415
|
+
assert.calledOnce(warnStub);
|
|
416
|
+
});
|
|
340
417
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
418
|
+
it('returns undefined when refresh returns no token', async () => {
|
|
419
|
+
webex.internal.llm.isDataChannelTokenEnabled.resolves(true);
|
|
420
|
+
webinar._practiceSessionLLMChannel = undefined;
|
|
421
|
+
webinar._pendingPracticeSessionDatachannelToken = undefined;
|
|
422
|
+
meeting.refreshDataChannelToken.resolves({body: {}});
|
|
344
423
|
|
|
345
|
-
|
|
424
|
+
const token = await webinar.ensurePracticeSessionDatachannelToken(meeting);
|
|
346
425
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
426
|
+
assert.isUndefined(token);
|
|
427
|
+
});
|
|
350
428
|
});
|
|
351
429
|
|
|
352
|
-
|
|
353
|
-
|
|
430
|
+
describe('#cleanupPSDataChannel', () => {
|
|
431
|
+
let mockPSChannel;
|
|
432
|
+
let meeting;
|
|
433
|
+
let mockVoiceaChannel;
|
|
354
434
|
|
|
355
|
-
|
|
435
|
+
beforeEach(() => {
|
|
436
|
+
webinar.meetingId = 'meeting-id';
|
|
437
|
+
mockPSChannel = createMockLLMChannel();
|
|
438
|
+
webinar._practiceSessionLLMChannel = mockPSChannel;
|
|
439
|
+
mockVoiceaChannel = {
|
|
440
|
+
switchLLMChannel: sinon.stub().resolves(),
|
|
441
|
+
getKeepTranscriptionSubscribed: sinon.stub().returns(false),
|
|
442
|
+
};
|
|
443
|
+
meeting = {
|
|
444
|
+
id: 'meeting-id',
|
|
445
|
+
locusUrl: 'locusUrl',
|
|
446
|
+
processRelayEvent: sinon.stub(),
|
|
447
|
+
processLocusLLMEvent: sinon.stub(),
|
|
448
|
+
handleLLMOnline: sinon.stub(),
|
|
449
|
+
llmChannel: createMockLLMChannel(),
|
|
450
|
+
voiceaChannel: mockVoiceaChannel,
|
|
451
|
+
startTranscriptionIfNeeded: sinon.stub(),
|
|
452
|
+
annotation: {registerChannel: sinon.stub()},
|
|
453
|
+
trigger: sinon.stub(),
|
|
454
|
+
transcription: {captions: []},
|
|
455
|
+
};
|
|
456
|
+
webex.meetings.getMeetingByType = sinon.stub().returns(meeting);
|
|
457
|
+
});
|
|
356
458
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
});
|
|
459
|
+
it('disconnects the practice session channel and removes listeners', async () => {
|
|
460
|
+
await webinar.cleanupPSDataChannel();
|
|
360
461
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
462
|
+
assert.calledOnceWithExactly(mockPSChannel.disconnect, {
|
|
463
|
+
code: 3050,
|
|
464
|
+
reason: 'done (permanent)',
|
|
465
|
+
});
|
|
466
|
+
assert.calledWithExactly(
|
|
467
|
+
mockPSChannel.off,
|
|
468
|
+
'event:relay.event',
|
|
469
|
+
meeting.processRelayEvent
|
|
470
|
+
);
|
|
471
|
+
assert.calledWithExactly(
|
|
472
|
+
mockPSChannel.off,
|
|
473
|
+
LOCUS_LLM_EVENT,
|
|
474
|
+
meeting.processLocusLLMEvent
|
|
475
|
+
);
|
|
476
|
+
assert.calledWithExactly(mockPSChannel.off, 'online', meeting.handleLLMOnline);
|
|
477
|
+
assert.isUndefined(webinar._practiceSessionLLMChannel);
|
|
478
|
+
});
|
|
366
479
|
|
|
367
|
-
|
|
480
|
+
it('switches annotation back to meeting default channel after cleanup', async () => {
|
|
481
|
+
await webinar.cleanupPSDataChannel();
|
|
368
482
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
372
|
-
});
|
|
483
|
+
assert.calledOnceWithExactly(meeting.annotation.registerChannel, meeting.llmChannel);
|
|
484
|
+
});
|
|
373
485
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
assert.calledOnce(webex.internal.llm.registerAndConnect);
|
|
378
|
-
assert.calledWith(
|
|
379
|
-
webex.internal.llm.registerAndConnect,
|
|
380
|
-
'locus-url',
|
|
381
|
-
'dc-url',
|
|
382
|
-
'ps-token',
|
|
383
|
-
LLM_PRACTICE_SESSION
|
|
384
|
-
);
|
|
385
|
-
assert.calledOnceWithExactly(webex.internal.voicea.announce);
|
|
386
|
-
assert.equal(result, 'REGISTER_AND_CONNECT_RESULT');
|
|
387
|
-
});
|
|
486
|
+
it('removes listeners even when disconnect throws', async () => {
|
|
487
|
+
const disconnectError = new Error('disconnect failed');
|
|
488
|
+
mockPSChannel.disconnect.rejects(disconnectError);
|
|
388
489
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
await webinar.updatePSDataChannel();
|
|
396
|
-
|
|
397
|
-
assert.calledWithExactly(
|
|
398
|
-
webex.internal.llm.getDatachannelToken,
|
|
399
|
-
DataChannelTokenType.PracticeSession
|
|
400
|
-
);
|
|
401
|
-
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
402
|
-
assert.calledWith(
|
|
403
|
-
webex.internal.llm.registerAndConnect,
|
|
404
|
-
'locus-url',
|
|
405
|
-
'dc-url',
|
|
406
|
-
'cached-token',
|
|
407
|
-
LLM_PRACTICE_SESSION
|
|
408
|
-
);
|
|
409
|
-
});
|
|
490
|
+
let caughtError;
|
|
491
|
+
try {
|
|
492
|
+
await webinar.cleanupPSDataChannel();
|
|
493
|
+
} catch (error) {
|
|
494
|
+
caughtError = error;
|
|
495
|
+
}
|
|
410
496
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
497
|
+
assert.equal(caughtError, disconnectError);
|
|
498
|
+
assert.calledWithExactly(
|
|
499
|
+
mockPSChannel.off,
|
|
500
|
+
'event:relay.event',
|
|
501
|
+
meeting.processRelayEvent
|
|
502
|
+
);
|
|
503
|
+
assert.calledWithExactly(
|
|
504
|
+
mockPSChannel.off,
|
|
505
|
+
LOCUS_LLM_EVENT,
|
|
506
|
+
meeting.processLocusLLMEvent
|
|
507
|
+
);
|
|
508
|
+
assert.isUndefined(webinar._practiceSessionLLMChannel);
|
|
509
|
+
});
|
|
414
510
|
|
|
415
|
-
|
|
511
|
+
it('removes a pending online listener if one exists', async () => {
|
|
512
|
+
const listener = sinon.stub();
|
|
513
|
+
webinar._pendingOnlineListener = listener;
|
|
416
514
|
|
|
417
|
-
|
|
418
|
-
assert.calledOnce(webex.internal.llm.registerAndConnect);
|
|
419
|
-
});
|
|
515
|
+
await webinar.cleanupPSDataChannel();
|
|
420
516
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
assert.calledWith(
|
|
425
|
-
webex.internal.llm.off,
|
|
426
|
-
`event:relay.event:${LLM_PRACTICE_SESSION}`,
|
|
427
|
-
processRelayEvent
|
|
428
|
-
);
|
|
429
|
-
assert.calledWith(
|
|
430
|
-
webex.internal.llm.on,
|
|
431
|
-
`event:relay.event:${LLM_PRACTICE_SESSION}`,
|
|
432
|
-
processRelayEvent
|
|
433
|
-
);
|
|
434
|
-
});
|
|
517
|
+
assert.calledWith(meeting.llmChannel.off, 'online', listener);
|
|
518
|
+
assert.isNull(webinar._pendingOnlineListener);
|
|
519
|
+
});
|
|
435
520
|
|
|
436
|
-
|
|
437
|
-
|
|
521
|
+
it('no-ops when no practice session channel exists', async () => {
|
|
522
|
+
webinar._practiceSessionLLMChannel = undefined;
|
|
438
523
|
|
|
439
|
-
|
|
524
|
+
await webinar.cleanupPSDataChannel();
|
|
440
525
|
|
|
441
|
-
|
|
442
|
-
|
|
526
|
+
assert.notCalled(mockPSChannel.disconnect);
|
|
527
|
+
assert.calledOnceWithExactly(mockVoiceaChannel.switchLLMChannel, meeting.llmChannel);
|
|
528
|
+
assert.calledOnceWithExactly(meeting.startTranscriptionIfNeeded);
|
|
529
|
+
});
|
|
443
530
|
|
|
444
|
-
|
|
445
|
-
|
|
531
|
+
it('switches voicea channel back to main meeting LLM channel when main channel is connected', async () => {
|
|
532
|
+
meeting.llmChannel.isConnected.returns(true);
|
|
446
533
|
|
|
447
|
-
|
|
534
|
+
await webinar.cleanupPSDataChannel();
|
|
448
535
|
|
|
449
|
-
|
|
450
|
-
|
|
536
|
+
assert.calledOnceWithExactly(mockVoiceaChannel.switchLLMChannel, meeting.llmChannel);
|
|
537
|
+
assert.calledOnceWithExactly(meeting.startTranscriptionIfNeeded);
|
|
538
|
+
});
|
|
451
539
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
webex.internal.llm.isConnected = sinon.stub().returns(false);
|
|
540
|
+
it('switches voicea to main channel even when not connected (defers caption restoration)', async () => {
|
|
541
|
+
meeting.llmChannel.isConnected.returns(false);
|
|
455
542
|
|
|
456
|
-
|
|
543
|
+
await webinar.cleanupPSDataChannel();
|
|
457
544
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
545
|
+
// Should still switch voicea to main channel - switchLLMChannel handles
|
|
546
|
+
// the deferred case by registering an 'online' listener
|
|
547
|
+
assert.calledOnceWithExactly(mockVoiceaChannel.switchLLMChannel, meeting.llmChannel);
|
|
548
|
+
// Should still disconnect the practice session channel
|
|
549
|
+
assert.calledOnce(mockPSChannel.disconnect);
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
it('switches voicea to final main channel after disconnect when main channel was replaced during practice disconnect', async () => {
|
|
553
|
+
// Main channel connected initially
|
|
554
|
+
meeting.llmChannel.isConnected.returns(true);
|
|
555
|
+
|
|
556
|
+
const newLLMChannel = {
|
|
557
|
+
isConnected: sinon.stub().returns(true),
|
|
558
|
+
on: sinon.stub(),
|
|
559
|
+
off: sinon.stub(),
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
// Simulate main channel being replaced during practice disconnect
|
|
563
|
+
mockPSChannel.disconnect.callsFake(async () => {
|
|
564
|
+
meeting.llmChannel = newLLMChannel;
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
await webinar.cleanupPSDataChannel();
|
|
568
|
+
|
|
569
|
+
// With reconciler pattern: single switch point after disconnect picks up the new channel
|
|
570
|
+
// (reconciler handles the actual rebinding internally)
|
|
571
|
+
assert.calledOnce(mockVoiceaChannel.switchLLMChannel);
|
|
572
|
+
assert.calledWith(mockVoiceaChannel.switchLLMChannel, newLLMChannel);
|
|
573
|
+
});
|
|
466
574
|
|
|
467
|
-
|
|
468
|
-
|
|
575
|
+
it('does not switch voicea channel when meeting has no voiceaChannel', async () => {
|
|
576
|
+
meeting.voiceaChannel = undefined;
|
|
469
577
|
|
|
470
|
-
|
|
471
|
-
await webinar.updatePSDataChannel();
|
|
472
|
-
await webinar.updatePSDataChannel();
|
|
578
|
+
await webinar.cleanupPSDataChannel();
|
|
473
579
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
580
|
+
// Should not throw - cleanup should continue without voicea switch
|
|
581
|
+
assert.calledOnce(mockPSChannel.disconnect);
|
|
582
|
+
});
|
|
477
583
|
});
|
|
478
584
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
585
|
+
describe('#updatePSDataChannel', () => {
|
|
586
|
+
let meeting;
|
|
587
|
+
let mockPSChannel;
|
|
588
|
+
let mockVoiceaChannel;
|
|
482
589
|
|
|
483
|
-
|
|
590
|
+
beforeEach(() => {
|
|
591
|
+
webinar.meetingId = 'meeting-id';
|
|
592
|
+
mockPSChannel = createMockLLMChannel({
|
|
593
|
+
isConnected: sinon.stub().returns(false),
|
|
594
|
+
getLocusUrl: sinon.stub().returns('old-locus-url'),
|
|
595
|
+
getDatachannelUrl: sinon.stub().returns('old-dc-url'),
|
|
596
|
+
getDatachannelToken: sinon.stub().callsFake((tokenType) => {
|
|
597
|
+
if (tokenType === DataChannelTokenType.PracticeSession) return 'ps-token';
|
|
598
|
+
return undefined;
|
|
599
|
+
}),
|
|
600
|
+
});
|
|
601
|
+
mockVoiceaChannel = {
|
|
602
|
+
switchLLMChannel: sinon.stub().resolves(),
|
|
603
|
+
getKeepTranscriptionSubscribed: sinon.stub().returns(false),
|
|
604
|
+
};
|
|
484
605
|
|
|
485
|
-
|
|
486
|
-
|
|
606
|
+
// Default session channel on the meeting
|
|
607
|
+
const mockDefaultChannel = createMockLLMChannel({
|
|
608
|
+
isConnected: sinon.stub().returns(true),
|
|
609
|
+
});
|
|
487
610
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
611
|
+
meeting = {
|
|
612
|
+
id: 'meeting-id',
|
|
613
|
+
locusUrl: 'locusUrl',
|
|
614
|
+
isJoined: sinon.stub().returns(true),
|
|
615
|
+
processRelayEvent: sinon.stub(),
|
|
616
|
+
processLocusLLMEvent: sinon.stub(),
|
|
617
|
+
handleLLMOnline: sinon.stub(),
|
|
618
|
+
startTranscriptionIfNeeded: sinon.stub(),
|
|
619
|
+
llmChannel: mockDefaultChannel,
|
|
620
|
+
voiceaChannel: mockVoiceaChannel,
|
|
621
|
+
annotation: {registerChannel: sinon.stub()},
|
|
622
|
+
locusInfo: {
|
|
623
|
+
url: 'locus-url',
|
|
624
|
+
info: {practiceSessionDatachannelUrl: 'dc-url'},
|
|
625
|
+
},
|
|
626
|
+
refreshDataChannelToken: sinon.stub().resolves({
|
|
627
|
+
body: {
|
|
628
|
+
datachannelToken: 'ps-token',
|
|
629
|
+
dataChannelTokenType: DataChannelTokenType.PracticeSession,
|
|
630
|
+
},
|
|
631
|
+
}),
|
|
632
|
+
voiceaListenerCallbacks: {},
|
|
633
|
+
trigger: sinon.stub(),
|
|
634
|
+
transcription: {captions: []},
|
|
635
|
+
};
|
|
636
|
+
|
|
637
|
+
webex.meetings.getMeetingByType = sinon.stub().returns(meeting);
|
|
638
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockPSChannel);
|
|
639
|
+
|
|
640
|
+
// Ensure connect path is eligible
|
|
641
|
+
webinar.selfIsPanelist = true;
|
|
642
|
+
webinar.practiceSessionEnabled = true;
|
|
491
643
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
return sessionId !== LLM_PRACTICE_SESSION;
|
|
644
|
+
// Set a pending token so the channel can connect without requiring token refresh
|
|
645
|
+
webinar._pendingPracticeSessionDatachannelToken = 'ps-token';
|
|
495
646
|
});
|
|
496
647
|
|
|
497
|
-
|
|
498
|
-
|
|
648
|
+
it('refreshes practice-session token before register when cached token is missing', async () => {
|
|
649
|
+
webex.internal.llm.isDataChannelTokenEnabled.resolves(true);
|
|
650
|
+
webinar._pendingPracticeSessionDatachannelToken = undefined; // Clear the pending token
|
|
499
651
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
652
|
+
await webinar.updatePSDataChannel();
|
|
653
|
+
|
|
654
|
+
assert.calledOnceWithExactly(meeting.refreshDataChannelToken);
|
|
655
|
+
assert.calledWith(
|
|
656
|
+
mockPSChannel.registerAndConnect,
|
|
657
|
+
'locus-url',
|
|
658
|
+
'dc-url',
|
|
659
|
+
'ps-token' // Token from refreshDataChannelToken
|
|
660
|
+
);
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
it('does not reconnect if practice-session eligibility changes during async token refresh', async () => {
|
|
664
|
+
webex.internal.llm.isDataChannelTokenEnabled.resolves(true);
|
|
665
|
+
mockPSChannel.getDatachannelToken.returns(undefined);
|
|
505
666
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
667
|
+
let resolveRefresh;
|
|
668
|
+
meeting.refreshDataChannelToken = sinon.stub().returns(
|
|
669
|
+
new Promise((resolve) => {
|
|
670
|
+
resolveRefresh = resolve;
|
|
671
|
+
})
|
|
672
|
+
);
|
|
509
673
|
|
|
510
|
-
|
|
674
|
+
const updatePromise = webinar.updatePSDataChannel();
|
|
511
675
|
|
|
512
|
-
|
|
513
|
-
const onlineCall = webex.internal.llm.on.args.find(([event]) => event === 'online');
|
|
514
|
-
assert.isDefined(onlineCall);
|
|
676
|
+
webinar.practiceSessionEnabled = false;
|
|
515
677
|
|
|
516
|
-
|
|
517
|
-
|
|
678
|
+
resolveRefresh({
|
|
679
|
+
body: {
|
|
680
|
+
datachannelToken: 'stale-ps-token',
|
|
681
|
+
dataChannelTokenType: DataChannelTokenType.PracticeSession,
|
|
682
|
+
},
|
|
683
|
+
});
|
|
518
684
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
685
|
+
const result = await updatePromise;
|
|
686
|
+
|
|
687
|
+
assert.isUndefined(result);
|
|
688
|
+
assert.notCalled(mockPSChannel.registerAndConnect);
|
|
522
689
|
});
|
|
523
690
|
|
|
524
|
-
|
|
525
|
-
|
|
691
|
+
it('no-ops when practice session join eligibility is false', async () => {
|
|
692
|
+
webinar.practiceSessionEnabled = false;
|
|
693
|
+
const cleanupPSDataChannelStub = sinon.stub(webinar, 'cleanupPSDataChannel').resolves();
|
|
526
694
|
|
|
527
|
-
|
|
528
|
-
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
529
|
-
});
|
|
695
|
+
const result = await webinar.updatePSDataChannel();
|
|
530
696
|
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
return sessionId !== LLM_PRACTICE_SESSION;
|
|
697
|
+
assert.isUndefined(result);
|
|
698
|
+
assert.calledOnceWithExactly(cleanupPSDataChannelStub);
|
|
699
|
+
assert.notCalled(mockPSChannel.registerAndConnect);
|
|
535
700
|
});
|
|
536
701
|
|
|
537
|
-
|
|
702
|
+
it('no-ops when meeting is not joined', async () => {
|
|
703
|
+
meeting.isJoined.returns(false);
|
|
704
|
+
const cleanupPSDataChannelStub = sinon.stub(webinar, 'cleanupPSDataChannel').resolves();
|
|
538
705
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
706
|
+
const result = await webinar.updatePSDataChannel();
|
|
707
|
+
|
|
708
|
+
assert.isUndefined(result);
|
|
709
|
+
assert.calledOnceWithExactly(cleanupPSDataChannelStub);
|
|
710
|
+
assert.notCalled(mockPSChannel.registerAndConnect);
|
|
711
|
+
});
|
|
712
|
+
|
|
713
|
+
it('no-ops when practiceSessionDatachannelUrl is missing', async () => {
|
|
714
|
+
meeting.locusInfo.info.practiceSessionDatachannelUrl = undefined;
|
|
715
|
+
|
|
716
|
+
const result = await webinar.updatePSDataChannel();
|
|
717
|
+
|
|
718
|
+
assert.isUndefined(result);
|
|
719
|
+
assert.notCalled(webex.internal.llm.createChannel);
|
|
720
|
+
});
|
|
721
|
+
|
|
722
|
+
it('no-ops when already connected to the same endpoints', async () => {
|
|
723
|
+
// Set up existing channel already connected to same endpoints
|
|
724
|
+
const existingChannel = createMockLLMChannel({
|
|
725
|
+
isConnected: sinon.stub().returns(true),
|
|
726
|
+
getLocusUrl: sinon.stub().returns('locus-url'),
|
|
727
|
+
getDatachannelUrl: sinon.stub().returns('dc-url'),
|
|
728
|
+
});
|
|
729
|
+
webinar._practiceSessionLLMChannel = existingChannel;
|
|
730
|
+
const cleanupPSDataChannelStub = sinon.stub(webinar, 'cleanupPSDataChannel').resolves();
|
|
731
|
+
|
|
732
|
+
const result = await webinar.updatePSDataChannel();
|
|
733
|
+
|
|
734
|
+
assert.isUndefined(result);
|
|
735
|
+
assert.notCalled(cleanupPSDataChannelStub);
|
|
736
|
+
assert.notCalled(webex.internal.llm.createChannel);
|
|
737
|
+
});
|
|
738
|
+
|
|
739
|
+
it('connects when eligible', async () => {
|
|
740
|
+
const result = await webinar.updatePSDataChannel();
|
|
741
|
+
|
|
742
|
+
assert.calledOnce(webex.internal.llm.createChannel);
|
|
743
|
+
assert.calledWith(mockPSChannel.registerAndConnect, 'locus-url', 'dc-url', 'ps-token');
|
|
744
|
+
assert.equal(result, 'REGISTER_AND_CONNECT_RESULT');
|
|
745
|
+
});
|
|
746
|
+
|
|
747
|
+
it('sets up refresh handler on the channel', async () => {
|
|
748
|
+
await webinar.updatePSDataChannel();
|
|
749
|
+
|
|
750
|
+
assert.calledOnce(mockPSChannel.setRefreshHandler);
|
|
751
|
+
// The refresh handler should call meeting.refreshDataChannelToken
|
|
752
|
+
const refreshHandler = mockPSChannel.setRefreshHandler.firstCall.args[0];
|
|
753
|
+
refreshHandler();
|
|
754
|
+
assert.calledOnce(meeting.refreshDataChannelToken);
|
|
755
|
+
});
|
|
756
|
+
|
|
757
|
+
it('registers event listeners on the practice session channel', async () => {
|
|
758
|
+
await webinar.updatePSDataChannel();
|
|
759
|
+
|
|
760
|
+
assert.calledWith(mockPSChannel.on, 'event:relay.event', meeting.processRelayEvent);
|
|
761
|
+
assert.calledWith(mockPSChannel.on, LOCUS_LLM_EVENT, meeting.processLocusLLMEvent);
|
|
762
|
+
assert.calledWith(mockPSChannel.on, 'online', meeting.handleLLMOnline);
|
|
763
|
+
});
|
|
764
|
+
|
|
765
|
+
it('switches annotation to practice session channel after connect', async () => {
|
|
766
|
+
await webinar.updatePSDataChannel();
|
|
767
|
+
|
|
768
|
+
assert.calledOnceWithExactly(meeting.annotation.registerChannel, mockPSChannel);
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
it('cleans up the existing practice session channel before reconnecting to new endpoints', async () => {
|
|
772
|
+
// Set up existing channel connected to different endpoints
|
|
773
|
+
const existingChannel = createMockLLMChannel({
|
|
774
|
+
isConnected: sinon.stub().returns(true),
|
|
775
|
+
getLocusUrl: sinon.stub().returns('old-locus-url'),
|
|
776
|
+
getDatachannelUrl: sinon.stub().returns('old-dc-url'),
|
|
777
|
+
});
|
|
778
|
+
webinar._practiceSessionLLMChannel = existingChannel;
|
|
779
|
+
const cleanupPSDataChannelStub = sinon.stub(webinar, 'cleanupPSDataChannel').resolves();
|
|
780
|
+
|
|
781
|
+
await webinar.updatePSDataChannel();
|
|
782
|
+
|
|
783
|
+
assert.calledOnceWithExactly(cleanupPSDataChannelStub);
|
|
784
|
+
assert.calledOnce(mockPSChannel.registerAndConnect);
|
|
785
|
+
});
|
|
786
|
+
|
|
787
|
+
it('switches voicea channel to practice session LLM channel after connect', async () => {
|
|
788
|
+
await webinar.updatePSDataChannel();
|
|
789
|
+
|
|
790
|
+
assert.calledOnceWithExactly(mockVoiceaChannel.switchLLMChannel, mockPSChannel);
|
|
791
|
+
assert.calledOnceWithExactly(meeting.startTranscriptionIfNeeded);
|
|
792
|
+
});
|
|
793
|
+
|
|
794
|
+
it('does not call switchLLMChannel when meeting has no voiceaChannel', async () => {
|
|
795
|
+
meeting.voiceaChannel = undefined;
|
|
796
|
+
|
|
797
|
+
await webinar.updatePSDataChannel();
|
|
798
|
+
|
|
799
|
+
// Should complete without error
|
|
800
|
+
assert.calledOnce(mockPSChannel.registerAndConnect);
|
|
801
|
+
});
|
|
802
|
+
|
|
803
|
+
it('defers connect when default session is not yet connected', async () => {
|
|
804
|
+
// Default session is not connected initially
|
|
805
|
+
meeting.llmChannel.isConnected.returns(false);
|
|
806
|
+
|
|
807
|
+
const result = await webinar.updatePSDataChannel();
|
|
808
|
+
|
|
809
|
+
// Should return undefined immediately (deferred)
|
|
810
|
+
assert.isUndefined(result);
|
|
811
|
+
// Should register an 'online' listener but NOT call registerAndConnect yet
|
|
812
|
+
assert.calledWith(meeting.llmChannel.on, 'online', sinon.match.func);
|
|
813
|
+
assert.notCalled(mockPSChannel.registerAndConnect);
|
|
814
|
+
// Should store the pending listener
|
|
815
|
+
assert.isNotNull(webinar._pendingOnlineListener);
|
|
816
|
+
});
|
|
817
|
+
|
|
818
|
+
it('does not register duplicate online listeners on repeated calls', async () => {
|
|
819
|
+
meeting.llmChannel.isConnected.returns(false);
|
|
820
|
+
|
|
821
|
+
await webinar.updatePSDataChannel();
|
|
822
|
+
await webinar.updatePSDataChannel();
|
|
823
|
+
await webinar.updatePSDataChannel();
|
|
824
|
+
|
|
825
|
+
// Only one 'online' listener should have been registered
|
|
826
|
+
const onlineCalls = meeting.llmChannel.on.args.filter(([event]) => event === 'online');
|
|
827
|
+
assert.equal(onlineCalls.length, 1, 'should register exactly one online listener');
|
|
828
|
+
});
|
|
829
|
+
|
|
830
|
+
it('re-invokes updatePSDataChannel when default session comes online', async () => {
|
|
831
|
+
meeting.llmChannel.isConnected.returns(false);
|
|
832
|
+
|
|
833
|
+
const updatePSDataChannelSpy = sinon.spy(webinar, 'updatePSDataChannel');
|
|
834
|
+
|
|
835
|
+
// First call defers
|
|
836
|
+
await webinar.updatePSDataChannel();
|
|
837
|
+
|
|
838
|
+
// Capture the 'online' listener
|
|
839
|
+
const onlineCall = meeting.llmChannel.on.args.find(([event]) => event === 'online');
|
|
840
|
+
assert.isDefined(onlineCall, 'should have registered an online listener');
|
|
841
|
+
|
|
842
|
+
// Now simulate default session coming online
|
|
843
|
+
meeting.llmChannel.isConnected.returns(true);
|
|
844
|
+
|
|
845
|
+
// Fire the captured listener
|
|
846
|
+
onlineCall[1]();
|
|
847
|
+
|
|
848
|
+
// The listener should have cleared itself, removed itself, and re-called updatePSDataChannel
|
|
849
|
+
assert.isNull(webinar._pendingOnlineListener);
|
|
850
|
+
assert.calledWith(meeting.llmChannel.off, 'online', sinon.match.func);
|
|
851
|
+
assert.equal(updatePSDataChannelSpy.callCount, 2);
|
|
852
|
+
});
|
|
853
|
+
|
|
854
|
+
it('does not reconnect with stale data if demoted before default session comes online', async () => {
|
|
855
|
+
meeting.llmChannel.isConnected.returns(false);
|
|
856
|
+
|
|
857
|
+
await webinar.updatePSDataChannel();
|
|
858
|
+
|
|
859
|
+
// Capture the 'online' listener
|
|
860
|
+
const onlineCall = meeting.llmChannel.on.args.find(([event]) => event === 'online');
|
|
861
|
+
assert.isDefined(onlineCall);
|
|
862
|
+
|
|
863
|
+
// Simulate demotion while waiting
|
|
864
|
+
webinar.selfIsPanelist = false;
|
|
865
|
+
|
|
866
|
+
// Now default session comes online
|
|
867
|
+
meeting.llmChannel.isConnected.returns(true);
|
|
868
|
+
|
|
869
|
+
// Fire the listener — re-invokes updatePSDataChannel which will see isPracticeSession = false
|
|
870
|
+
onlineCall[1]();
|
|
871
|
+
|
|
872
|
+
// Should NOT have called registerAndConnect since the user is no longer eligible
|
|
873
|
+
assert.notCalled(mockPSChannel.registerAndConnect);
|
|
874
|
+
});
|
|
875
|
+
|
|
876
|
+
it('proceeds immediately when default session is already connected', async () => {
|
|
877
|
+
meeting.llmChannel.isConnected.returns(true);
|
|
878
|
+
|
|
879
|
+
const result = await webinar.updatePSDataChannel();
|
|
880
|
+
|
|
881
|
+
assert.calledOnce(mockPSChannel.registerAndConnect);
|
|
882
|
+
assert.equal(result, 'REGISTER_AND_CONNECT_RESULT');
|
|
883
|
+
});
|
|
884
|
+
|
|
885
|
+
it('clears channel reference when registerAndConnect rejects', async () => {
|
|
886
|
+
const registerError = new Error('register failed');
|
|
887
|
+
mockPSChannel.registerAndConnect.rejects(registerError);
|
|
888
|
+
|
|
889
|
+
try {
|
|
890
|
+
await webinar.updatePSDataChannel();
|
|
891
|
+
assert.fail('Expected updatePSDataChannel to reject when registerAndConnect fails');
|
|
892
|
+
} catch (error) {
|
|
893
|
+
assert.equal(error, registerError);
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
assert.isUndefined(webinar._practiceSessionLLMChannel);
|
|
897
|
+
});
|
|
898
|
+
|
|
899
|
+
it('stores pending token on channel when one exists', async () => {
|
|
900
|
+
webinar._pendingPracticeSessionDatachannelToken = 'pending-token';
|
|
901
|
+
|
|
902
|
+
await webinar.updatePSDataChannel();
|
|
903
|
+
|
|
904
|
+
assert.calledOnceWithExactly(mockPSChannel.setDatachannelToken, 'pending-token');
|
|
905
|
+
assert.isUndefined(webinar._pendingPracticeSessionDatachannelToken);
|
|
906
|
+
});
|
|
907
|
+
|
|
908
|
+
it('disconnects and returns undefined when channel replaced mid-connect', async () => {
|
|
909
|
+
// Simulate a race condition where another updatePSDataChannel call replaces the channel
|
|
910
|
+
// while registerAndConnect is in progress
|
|
911
|
+
const replacementChannel = createMockLLMChannel();
|
|
912
|
+
mockPSChannel.registerAndConnect = sinon.stub().callsFake(async () => {
|
|
913
|
+
// Mid-connect, another call replaces the channel
|
|
914
|
+
webinar._practiceSessionLLMChannel = replacementChannel;
|
|
915
|
+
return 'CONNECT_RESULT';
|
|
916
|
+
});
|
|
917
|
+
|
|
918
|
+
const result = await webinar.updatePSDataChannel();
|
|
919
|
+
|
|
920
|
+
// Original channel should be disconnected (replaced scenario)
|
|
921
|
+
assert.calledOnceWithExactly(mockPSChannel.disconnect, {code: 3050, reason: 'replaced'});
|
|
922
|
+
// Should return undefined since the channel was replaced
|
|
923
|
+
assert.isUndefined(result);
|
|
924
|
+
});
|
|
546
925
|
});
|
|
547
926
|
|
|
548
927
|
describe('#updateStatusByRole', () => {
|
|
549
928
|
let updateMediaShares;
|
|
550
929
|
beforeEach(() => {
|
|
551
|
-
updateMediaShares = sinon.stub()
|
|
930
|
+
updateMediaShares = sinon.stub();
|
|
552
931
|
webinar.webex.meetings = {
|
|
553
932
|
getMeetingByType: sinon.stub().returns({
|
|
554
933
|
id: 'meeting-id',
|
|
934
|
+
locusUrl: 'locusUrl',
|
|
555
935
|
isJoined: sinon.stub().returns(false),
|
|
556
936
|
updateLLMConnection: sinon.stub(),
|
|
557
937
|
shareStatus: SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE,
|
|
558
938
|
locusInfo: {
|
|
559
939
|
mediaShares: 'mediaShares',
|
|
560
|
-
updateMediaShares: updateMediaShares
|
|
561
|
-
}
|
|
562
|
-
})
|
|
940
|
+
updateMediaShares: updateMediaShares,
|
|
941
|
+
},
|
|
942
|
+
}),
|
|
563
943
|
};
|
|
564
944
|
});
|
|
565
945
|
|
|
@@ -568,7 +948,6 @@ describe('plugin-meetings', () => {
|
|
|
568
948
|
});
|
|
569
949
|
|
|
570
950
|
it('trigger updateMediaShares if promoted', () => {
|
|
571
|
-
|
|
572
951
|
const roleChange = {isPromoted: true, isDemoted: false};
|
|
573
952
|
|
|
574
953
|
webinar.updateStatusByRole(roleChange);
|
|
@@ -577,7 +956,6 @@ describe('plugin-meetings', () => {
|
|
|
577
956
|
});
|
|
578
957
|
|
|
579
958
|
it('Not trigger updateMediaShares if no role change', () => {
|
|
580
|
-
|
|
581
959
|
const roleChange = {isPromoted: false, isDemoted: false};
|
|
582
960
|
|
|
583
961
|
webinar.updateStatusByRole(roleChange);
|
|
@@ -585,7 +963,6 @@ describe('plugin-meetings', () => {
|
|
|
585
963
|
assert.notCalled(updateMediaShares);
|
|
586
964
|
});
|
|
587
965
|
it('trigger updateMediaShares if is promoted', () => {
|
|
588
|
-
|
|
589
966
|
const roleChange = {isPromoted: true, isDemoted: false};
|
|
590
967
|
|
|
591
968
|
webinar.updateStatusByRole(roleChange);
|
|
@@ -594,7 +971,6 @@ describe('plugin-meetings', () => {
|
|
|
594
971
|
});
|
|
595
972
|
|
|
596
973
|
it('trigger updateMediaShares if is attendee with whiteboard share', () => {
|
|
597
|
-
|
|
598
974
|
const roleChange = {isPromoted: false, isDemoted: true};
|
|
599
975
|
|
|
600
976
|
webinar.updateStatusByRole(roleChange);
|
|
@@ -603,18 +979,18 @@ describe('plugin-meetings', () => {
|
|
|
603
979
|
});
|
|
604
980
|
|
|
605
981
|
it('Not trigger updateMediaShares if is attendee with screen share', () => {
|
|
606
|
-
|
|
607
982
|
webinar.webex.meetings = {
|
|
608
983
|
getMeetingByType: sinon.stub().returns({
|
|
609
984
|
id: 'meeting-id',
|
|
985
|
+
locusUrl: 'locusUrl',
|
|
610
986
|
isJoined: sinon.stub().returns(false),
|
|
611
987
|
updateLLMConnection: sinon.stub(),
|
|
612
988
|
shareStatus: SHARE_STATUS.REMOTE_SHARE_ACTIVE,
|
|
613
989
|
locusInfo: {
|
|
614
990
|
mediaShares: 'mediaShares',
|
|
615
|
-
updateMediaShares: updateMediaShares
|
|
616
|
-
}
|
|
617
|
-
})
|
|
991
|
+
updateMediaShares: updateMediaShares,
|
|
992
|
+
},
|
|
993
|
+
}),
|
|
618
994
|
};
|
|
619
995
|
|
|
620
996
|
const roleChange = {isPromoted: false, isDemoted: true};
|
|
@@ -624,28 +1000,34 @@ describe('plugin-meetings', () => {
|
|
|
624
1000
|
assert.notCalled(updateMediaShares);
|
|
625
1001
|
});
|
|
626
1002
|
|
|
627
|
-
|
|
628
|
-
|
|
1003
|
+
it('updates PS data channel based on join eligibility', () => {
|
|
1004
|
+
const updatePSDataChannelStub = sinon.stub(webinar, 'updatePSDataChannel').resolves();
|
|
629
1005
|
|
|
630
|
-
|
|
1006
|
+
webinar.updateStatusByRole({isPromoted: false, isDemoted: false});
|
|
631
1007
|
|
|
632
|
-
|
|
633
|
-
|
|
1008
|
+
assert.calledOnceWithExactly(updatePSDataChannelStub);
|
|
1009
|
+
});
|
|
634
1010
|
});
|
|
635
1011
|
|
|
636
|
-
describe(
|
|
1012
|
+
describe('#setPracticeSessionState', () => {
|
|
637
1013
|
[true, false].forEach((enabled) => {
|
|
638
|
-
it(`sends a PATCH request to ${
|
|
1014
|
+
it(`sends a PATCH request to ${
|
|
1015
|
+
enabled ? 'enable' : 'disable'
|
|
1016
|
+
} the practice session`, async () => {
|
|
639
1017
|
const result = await webinar.setPracticeSessionState(enabled);
|
|
640
1018
|
assert.calledOnce(webex.request);
|
|
641
1019
|
assert.calledWith(webex.request, {
|
|
642
|
-
method:
|
|
1020
|
+
method: 'PATCH',
|
|
643
1021
|
uri: `${webinar.locusUrl}/controls`,
|
|
644
1022
|
body: {
|
|
645
|
-
practiceSession: {
|
|
646
|
-
}
|
|
1023
|
+
practiceSession: {enabled},
|
|
1024
|
+
},
|
|
647
1025
|
});
|
|
648
|
-
assert.equal(
|
|
1026
|
+
assert.equal(
|
|
1027
|
+
result,
|
|
1028
|
+
'REQUEST_RETURN_VALUE',
|
|
1029
|
+
'should return the resolved value from the request'
|
|
1030
|
+
);
|
|
649
1031
|
});
|
|
650
1032
|
});
|
|
651
1033
|
|
|
@@ -659,7 +1041,11 @@ describe('plugin-meetings', () => {
|
|
|
659
1041
|
} catch (error) {
|
|
660
1042
|
assert.equal(error.message, 'API_ERROR', 'should throw the correct error');
|
|
661
1043
|
assert.calledOnce(errorLogger);
|
|
662
|
-
assert.calledWith(
|
|
1044
|
+
assert.calledWith(
|
|
1045
|
+
errorLogger,
|
|
1046
|
+
'Meeting:webinar#setPracticeSessionState failed',
|
|
1047
|
+
sinon.match.instanceOf(Error)
|
|
1048
|
+
);
|
|
663
1049
|
}
|
|
664
1050
|
|
|
665
1051
|
errorLogger.restore();
|
|
@@ -706,37 +1092,37 @@ describe('plugin-meetings', () => {
|
|
|
706
1092
|
|
|
707
1093
|
assert.equal(webinar.practiceSessionEnabled, false);
|
|
708
1094
|
});
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
1095
|
+
it('triggers PS data channel update using computed eligibility', () => {
|
|
1096
|
+
webinar.selfIsPanelist = true;
|
|
1097
|
+
const updatePSDataChannelStub = sinon.stub(webinar, 'updatePSDataChannel').resolves();
|
|
712
1098
|
|
|
713
|
-
|
|
1099
|
+
webinar.updatePracticeSessionStatus({enabled: true});
|
|
714
1100
|
|
|
715
|
-
|
|
716
|
-
|
|
1101
|
+
assert.calledOnceWithExactly(updatePSDataChannelStub);
|
|
1102
|
+
});
|
|
717
1103
|
});
|
|
718
1104
|
|
|
719
|
-
describe(
|
|
1105
|
+
describe('#startWebcast', () => {
|
|
720
1106
|
const meeting = {
|
|
721
1107
|
locusId: 'locusId',
|
|
722
1108
|
correlationId: 'correlationId',
|
|
723
|
-
}
|
|
1109
|
+
};
|
|
724
1110
|
const layout = {
|
|
725
1111
|
videoLayout: 'Prominent',
|
|
726
1112
|
contentLayout: 'Prominent',
|
|
727
1113
|
syncStageLayout: false,
|
|
728
1114
|
syncStageInMeeting: false,
|
|
729
|
-
}
|
|
1115
|
+
};
|
|
730
1116
|
it(`sends a PUT request to start the webcast`, async () => {
|
|
731
1117
|
const result = await webinar.startWebcast(meeting, layout);
|
|
732
1118
|
assert.calledOnce(webex.request);
|
|
733
1119
|
assert.calledWith(webex.request, {
|
|
734
|
-
method:
|
|
1120
|
+
method: 'PUT',
|
|
735
1121
|
uri: `${webinar.webcastInstanceUrl}/streaming`,
|
|
736
1122
|
headers: {
|
|
737
1123
|
authorization: 'test-token',
|
|
738
1124
|
trackingId: 'webex-js-sdk_test-uuid',
|
|
739
|
-
'Content-Type': 'application/json'
|
|
1125
|
+
'Content-Type': 'application/json',
|
|
740
1126
|
},
|
|
741
1127
|
body: {
|
|
742
1128
|
action: 'start',
|
|
@@ -745,9 +1131,13 @@ describe('plugin-meetings', () => {
|
|
|
745
1131
|
correlationId: meeting.correlationId,
|
|
746
1132
|
},
|
|
747
1133
|
layout,
|
|
748
|
-
}
|
|
1134
|
+
},
|
|
749
1135
|
});
|
|
750
|
-
assert.equal(
|
|
1136
|
+
assert.equal(
|
|
1137
|
+
result,
|
|
1138
|
+
'REQUEST_RETURN_VALUE',
|
|
1139
|
+
'should return the resolved value from the request'
|
|
1140
|
+
);
|
|
751
1141
|
});
|
|
752
1142
|
|
|
753
1143
|
it('should handle undefined meeting parameter', async () => {
|
|
@@ -757,9 +1147,16 @@ describe('plugin-meetings', () => {
|
|
|
757
1147
|
await webinar.startWebcast(undefined, layout);
|
|
758
1148
|
assert.fail('startWebcast should throw an error');
|
|
759
1149
|
} catch (error) {
|
|
760
|
-
assert.equal(
|
|
1150
|
+
assert.equal(
|
|
1151
|
+
error.message,
|
|
1152
|
+
'Meeting parameter does not meet expectations',
|
|
1153
|
+
'should throw the correct error'
|
|
1154
|
+
);
|
|
761
1155
|
assert.calledOnce(errorLogger);
|
|
762
|
-
assert.calledWith(
|
|
1156
|
+
assert.calledWith(
|
|
1157
|
+
errorLogger,
|
|
1158
|
+
`Meeting:webinar#startWebcast failed --> meeting parameter : ${undefined}`
|
|
1159
|
+
);
|
|
763
1160
|
} finally {
|
|
764
1161
|
errorLogger.restore();
|
|
765
1162
|
}
|
|
@@ -775,30 +1172,38 @@ describe('plugin-meetings', () => {
|
|
|
775
1172
|
} catch (error) {
|
|
776
1173
|
assert.equal(error.message, 'API_ERROR', 'should throw the correct error');
|
|
777
1174
|
assert.calledOnce(errorLogger);
|
|
778
|
-
assert.calledWith(
|
|
1175
|
+
assert.calledWith(
|
|
1176
|
+
errorLogger,
|
|
1177
|
+
'Meeting:webinar#startWebcast failed',
|
|
1178
|
+
sinon.match.instanceOf(Error)
|
|
1179
|
+
);
|
|
779
1180
|
} finally {
|
|
780
1181
|
errorLogger.restore();
|
|
781
1182
|
}
|
|
782
1183
|
});
|
|
783
1184
|
});
|
|
784
1185
|
|
|
785
|
-
describe(
|
|
1186
|
+
describe('#stopWebcast', () => {
|
|
786
1187
|
it(`sends a PUT request to stop the webcast`, async () => {
|
|
787
1188
|
const result = await webinar.stopWebcast();
|
|
788
1189
|
assert.calledOnce(webex.request);
|
|
789
1190
|
assert.calledWith(webex.request, {
|
|
790
|
-
method:
|
|
1191
|
+
method: 'PUT',
|
|
791
1192
|
uri: `${webinar.webcastInstanceUrl}/streaming`,
|
|
792
1193
|
headers: {
|
|
793
1194
|
authorization: 'test-token',
|
|
794
1195
|
trackingId: 'webex-js-sdk_test-uuid',
|
|
795
|
-
'Content-Type': 'application/json'
|
|
1196
|
+
'Content-Type': 'application/json',
|
|
796
1197
|
},
|
|
797
1198
|
body: {
|
|
798
1199
|
action: 'stop',
|
|
799
|
-
}
|
|
1200
|
+
},
|
|
800
1201
|
});
|
|
801
|
-
assert.equal(
|
|
1202
|
+
assert.equal(
|
|
1203
|
+
result,
|
|
1204
|
+
'REQUEST_RETURN_VALUE',
|
|
1205
|
+
'should return the resolved value from the request'
|
|
1206
|
+
);
|
|
802
1207
|
});
|
|
803
1208
|
|
|
804
1209
|
it('handles API call failures gracefully', async () => {
|
|
@@ -811,27 +1216,34 @@ describe('plugin-meetings', () => {
|
|
|
811
1216
|
} catch (error) {
|
|
812
1217
|
assert.equal(error.message, 'API_ERROR', 'should throw the correct error');
|
|
813
1218
|
assert.calledOnce(errorLogger);
|
|
814
|
-
assert.calledWith(
|
|
1219
|
+
assert.calledWith(
|
|
1220
|
+
errorLogger,
|
|
1221
|
+
'Meeting:webinar#stopWebcast failed',
|
|
1222
|
+
sinon.match.instanceOf(Error)
|
|
1223
|
+
);
|
|
815
1224
|
} finally {
|
|
816
1225
|
errorLogger.restore();
|
|
817
1226
|
}
|
|
818
1227
|
});
|
|
819
1228
|
});
|
|
820
1229
|
|
|
821
|
-
|
|
822
|
-
describe("#queryWebcastLayout", () => {
|
|
1230
|
+
describe('#queryWebcastLayout', () => {
|
|
823
1231
|
it(`sends a GET request to query the webcast layout`, async () => {
|
|
824
1232
|
const result = await webinar.queryWebcastLayout();
|
|
825
1233
|
assert.calledOnce(webex.request);
|
|
826
1234
|
assert.calledWith(webex.request, {
|
|
827
|
-
method:
|
|
1235
|
+
method: 'GET',
|
|
828
1236
|
uri: `${webinar.webcastInstanceUrl}/layout`,
|
|
829
1237
|
headers: {
|
|
830
1238
|
authorization: 'test-token',
|
|
831
1239
|
trackingId: 'webex-js-sdk_test-uuid',
|
|
832
1240
|
},
|
|
833
1241
|
});
|
|
834
|
-
assert.equal(
|
|
1242
|
+
assert.equal(
|
|
1243
|
+
result,
|
|
1244
|
+
'REQUEST_RETURN_VALUE',
|
|
1245
|
+
'should return the resolved value from the request'
|
|
1246
|
+
);
|
|
835
1247
|
});
|
|
836
1248
|
|
|
837
1249
|
it('handles API call failures gracefully', async () => {
|
|
@@ -844,36 +1256,44 @@ describe('plugin-meetings', () => {
|
|
|
844
1256
|
} catch (error) {
|
|
845
1257
|
assert.equal(error.message, 'API_ERROR', 'should throw the correct error');
|
|
846
1258
|
assert.calledOnce(errorLogger);
|
|
847
|
-
assert.calledWith(
|
|
1259
|
+
assert.calledWith(
|
|
1260
|
+
errorLogger,
|
|
1261
|
+
'Meeting:webinar#queryWebcastLayout failed',
|
|
1262
|
+
sinon.match.instanceOf(Error)
|
|
1263
|
+
);
|
|
848
1264
|
} finally {
|
|
849
1265
|
errorLogger.restore();
|
|
850
1266
|
}
|
|
851
1267
|
});
|
|
852
1268
|
});
|
|
853
1269
|
|
|
854
|
-
describe(
|
|
1270
|
+
describe('#updateWebcastLayout', () => {
|
|
855
1271
|
const layout = {
|
|
856
1272
|
videoLayout: 'Prominent',
|
|
857
1273
|
contentLayout: 'Prominent',
|
|
858
1274
|
syncStageLayout: false,
|
|
859
1275
|
syncStageInMeeting: false,
|
|
860
|
-
}
|
|
1276
|
+
};
|
|
861
1277
|
it(`sends a PUT request to update the webcast layout`, async () => {
|
|
862
1278
|
const result = await webinar.updateWebcastLayout(layout);
|
|
863
1279
|
assert.calledOnce(webex.request);
|
|
864
1280
|
assert.calledWith(webex.request, {
|
|
865
|
-
method:
|
|
1281
|
+
method: 'PUT',
|
|
866
1282
|
uri: `${webinar.webcastInstanceUrl}/layout`,
|
|
867
1283
|
headers: {
|
|
868
1284
|
authorization: 'test-token',
|
|
869
1285
|
trackingId: 'webex-js-sdk_test-uuid',
|
|
870
|
-
'Content-Type': 'application/json'
|
|
1286
|
+
'Content-Type': 'application/json',
|
|
871
1287
|
},
|
|
872
1288
|
body: {
|
|
873
|
-
...layout
|
|
874
|
-
}
|
|
1289
|
+
...layout,
|
|
1290
|
+
},
|
|
875
1291
|
});
|
|
876
|
-
assert.equal(
|
|
1292
|
+
assert.equal(
|
|
1293
|
+
result,
|
|
1294
|
+
'REQUEST_RETURN_VALUE',
|
|
1295
|
+
'should return the resolved value from the request'
|
|
1296
|
+
);
|
|
877
1297
|
});
|
|
878
1298
|
|
|
879
1299
|
it('handles API call failures gracefully', async () => {
|
|
@@ -886,30 +1306,40 @@ describe('plugin-meetings', () => {
|
|
|
886
1306
|
} catch (error) {
|
|
887
1307
|
assert.equal(error.message, 'API_ERROR', 'should throw the correct error');
|
|
888
1308
|
assert.calledOnce(errorLogger);
|
|
889
|
-
assert.calledWith(
|
|
1309
|
+
assert.calledWith(
|
|
1310
|
+
errorLogger,
|
|
1311
|
+
'Meeting:webinar#updateWebcastLayout failed',
|
|
1312
|
+
sinon.match.instanceOf(Error)
|
|
1313
|
+
);
|
|
890
1314
|
} finally {
|
|
891
1315
|
errorLogger.restore();
|
|
892
1316
|
}
|
|
893
1317
|
});
|
|
894
1318
|
});
|
|
895
1319
|
|
|
896
|
-
describe(
|
|
1320
|
+
describe('#searchWebcastAttendees', () => {
|
|
897
1321
|
const queryString = 'queryString';
|
|
898
1322
|
const specialCharsQuery = 'query@string!';
|
|
899
1323
|
const emptyQuery = '';
|
|
900
1324
|
|
|
901
|
-
it(
|
|
1325
|
+
it('sends a GET request to search the webcast attendees', async () => {
|
|
902
1326
|
const result = await webinar.searchWebcastAttendees(queryString);
|
|
903
1327
|
assert.calledOnce(webex.request);
|
|
904
1328
|
assert.calledWith(webex.request, {
|
|
905
|
-
method:
|
|
906
|
-
uri: `${webinar.webcastInstanceUrl}/attendees?keyword=${encodeURIComponent(
|
|
1329
|
+
method: 'GET',
|
|
1330
|
+
uri: `${webinar.webcastInstanceUrl}/attendees?keyword=${encodeURIComponent(
|
|
1331
|
+
queryString
|
|
1332
|
+
)}`,
|
|
907
1333
|
headers: {
|
|
908
1334
|
authorization: 'test-token',
|
|
909
1335
|
trackingId: 'webex-js-sdk_test-uuid',
|
|
910
1336
|
},
|
|
911
1337
|
});
|
|
912
|
-
assert.equal(
|
|
1338
|
+
assert.equal(
|
|
1339
|
+
result,
|
|
1340
|
+
'REQUEST_RETURN_VALUE',
|
|
1341
|
+
'should return the resolved value from the request'
|
|
1342
|
+
);
|
|
913
1343
|
});
|
|
914
1344
|
|
|
915
1345
|
it('handles API call failures gracefully', async () => {
|
|
@@ -922,55 +1352,74 @@ describe('plugin-meetings', () => {
|
|
|
922
1352
|
} catch (error) {
|
|
923
1353
|
assert.equal(error.message, 'API_ERROR', 'should throw the correct error');
|
|
924
1354
|
assert.calledOnce(errorLogger);
|
|
925
|
-
assert.calledWith(
|
|
1355
|
+
assert.calledWith(
|
|
1356
|
+
errorLogger,
|
|
1357
|
+
'Meeting:webinar#searchWebcastAttendees failed',
|
|
1358
|
+
sinon.match.instanceOf(Error)
|
|
1359
|
+
);
|
|
926
1360
|
} finally {
|
|
927
1361
|
errorLogger.restore();
|
|
928
1362
|
}
|
|
929
1363
|
});
|
|
930
1364
|
|
|
931
|
-
it(
|
|
1365
|
+
it('should handle empty query string', async () => {
|
|
932
1366
|
const result = await webinar.searchWebcastAttendees(emptyQuery);
|
|
933
1367
|
assert.calledOnce(webex.request);
|
|
934
1368
|
assert.calledWith(webex.request, {
|
|
935
|
-
method:
|
|
936
|
-
uri: `${webinar.webcastInstanceUrl}/attendees?keyword=${encodeURIComponent(
|
|
1369
|
+
method: 'GET',
|
|
1370
|
+
uri: `${webinar.webcastInstanceUrl}/attendees?keyword=${encodeURIComponent(
|
|
1371
|
+
emptyQuery
|
|
1372
|
+
)}`,
|
|
937
1373
|
headers: {
|
|
938
1374
|
authorization: 'test-token',
|
|
939
1375
|
trackingId: 'webex-js-sdk_test-uuid',
|
|
940
1376
|
},
|
|
941
1377
|
});
|
|
942
|
-
assert.equal(
|
|
1378
|
+
assert.equal(
|
|
1379
|
+
result,
|
|
1380
|
+
'REQUEST_RETURN_VALUE',
|
|
1381
|
+
'should return the resolved value from the request'
|
|
1382
|
+
);
|
|
943
1383
|
});
|
|
944
1384
|
|
|
945
|
-
it(
|
|
1385
|
+
it('should handle query string with special characters', async () => {
|
|
946
1386
|
const result = await webinar.searchWebcastAttendees(specialCharsQuery);
|
|
947
1387
|
assert.calledOnce(webex.request);
|
|
948
1388
|
assert.calledWith(webex.request, {
|
|
949
|
-
method:
|
|
950
|
-
uri: `${webinar.webcastInstanceUrl}/attendees?keyword=${encodeURIComponent(
|
|
1389
|
+
method: 'GET',
|
|
1390
|
+
uri: `${webinar.webcastInstanceUrl}/attendees?keyword=${encodeURIComponent(
|
|
1391
|
+
specialCharsQuery
|
|
1392
|
+
)}`,
|
|
951
1393
|
headers: {
|
|
952
1394
|
authorization: 'test-token',
|
|
953
1395
|
trackingId: 'webex-js-sdk_test-uuid',
|
|
954
1396
|
},
|
|
955
1397
|
});
|
|
956
|
-
assert.equal(
|
|
1398
|
+
assert.equal(
|
|
1399
|
+
result,
|
|
1400
|
+
'REQUEST_RETURN_VALUE',
|
|
1401
|
+
'should return the resolved value from the request'
|
|
1402
|
+
);
|
|
957
1403
|
});
|
|
958
1404
|
});
|
|
959
1405
|
|
|
960
|
-
|
|
961
|
-
describe("#viewAllWebcastAttendees", () => {
|
|
1406
|
+
describe('#viewAllWebcastAttendees', () => {
|
|
962
1407
|
it(`sends a GET request to view all the webcast attendees`, async () => {
|
|
963
1408
|
const result = await webinar.viewAllWebcastAttendees();
|
|
964
1409
|
assert.calledOnce(webex.request);
|
|
965
1410
|
assert.calledWith(webex.request, {
|
|
966
|
-
method:
|
|
1411
|
+
method: 'GET',
|
|
967
1412
|
uri: `${webinar.webcastInstanceUrl}/attendees`,
|
|
968
1413
|
headers: {
|
|
969
1414
|
authorization: 'test-token',
|
|
970
1415
|
trackingId: 'webex-js-sdk_test-uuid',
|
|
971
1416
|
},
|
|
972
1417
|
});
|
|
973
|
-
assert.equal(
|
|
1418
|
+
assert.equal(
|
|
1419
|
+
result,
|
|
1420
|
+
'REQUEST_RETURN_VALUE',
|
|
1421
|
+
'should return the resolved value from the request'
|
|
1422
|
+
);
|
|
974
1423
|
});
|
|
975
1424
|
|
|
976
1425
|
it('handles API call failures gracefully', async () => {
|
|
@@ -983,27 +1432,35 @@ describe('plugin-meetings', () => {
|
|
|
983
1432
|
} catch (error) {
|
|
984
1433
|
assert.equal(error.message, 'API_ERROR', 'should throw the correct error');
|
|
985
1434
|
assert.calledOnce(errorLogger);
|
|
986
|
-
assert.calledWith(
|
|
1435
|
+
assert.calledWith(
|
|
1436
|
+
errorLogger,
|
|
1437
|
+
'Meeting:webinar#viewAllWebcastAttendees failed',
|
|
1438
|
+
sinon.match.instanceOf(Error)
|
|
1439
|
+
);
|
|
987
1440
|
} finally {
|
|
988
1441
|
errorLogger.restore();
|
|
989
1442
|
}
|
|
990
1443
|
});
|
|
991
1444
|
});
|
|
992
1445
|
|
|
993
|
-
describe(
|
|
994
|
-
const participantId = 'participantId'
|
|
1446
|
+
describe('#expelWebcastAttendee', () => {
|
|
1447
|
+
const participantId = 'participantId';
|
|
995
1448
|
it(`sends a DELETE request to expel the webcast attendee`, async () => {
|
|
996
1449
|
const result = await webinar.expelWebcastAttendee(participantId);
|
|
997
1450
|
assert.calledOnce(webex.request);
|
|
998
1451
|
assert.calledWith(webex.request, {
|
|
999
|
-
method:
|
|
1452
|
+
method: 'DELETE',
|
|
1000
1453
|
uri: `${webinar.webcastInstanceUrl}/attendees/${participantId}`,
|
|
1001
1454
|
headers: {
|
|
1002
1455
|
authorization: 'test-token',
|
|
1003
1456
|
trackingId: 'webex-js-sdk_test-uuid',
|
|
1004
1457
|
},
|
|
1005
1458
|
});
|
|
1006
|
-
assert.equal(
|
|
1459
|
+
assert.equal(
|
|
1460
|
+
result,
|
|
1461
|
+
'REQUEST_RETURN_VALUE',
|
|
1462
|
+
'should return the resolved value from the request'
|
|
1463
|
+
);
|
|
1007
1464
|
});
|
|
1008
1465
|
|
|
1009
1466
|
it('handles API call failures gracefully', async () => {
|
|
@@ -1016,14 +1473,18 @@ describe('plugin-meetings', () => {
|
|
|
1016
1473
|
} catch (error) {
|
|
1017
1474
|
assert.equal(error.message, 'API_ERROR', 'should throw the correct error');
|
|
1018
1475
|
assert.calledOnce(errorLogger);
|
|
1019
|
-
assert.calledWith(
|
|
1476
|
+
assert.calledWith(
|
|
1477
|
+
errorLogger,
|
|
1478
|
+
'Meeting:webinar#expelWebcastAttendee failed',
|
|
1479
|
+
sinon.match.instanceOf(Error)
|
|
1480
|
+
);
|
|
1020
1481
|
} finally {
|
|
1021
1482
|
errorLogger.restore();
|
|
1022
1483
|
}
|
|
1023
1484
|
});
|
|
1024
1485
|
});
|
|
1025
1486
|
|
|
1026
|
-
describe(
|
|
1487
|
+
describe('#searchLargeScaleWebinarAttendees', () => {
|
|
1027
1488
|
const attendeeSearchUrl = 'https://locusUrl/attendees/search';
|
|
1028
1489
|
const params = {
|
|
1029
1490
|
queryString: 'queryString',
|
|
@@ -1035,16 +1496,17 @@ describe('plugin-meetings', () => {
|
|
|
1035
1496
|
webinar.webex.meetings = {
|
|
1036
1497
|
getMeetingByType: sinon.stub().returns({
|
|
1037
1498
|
id: 'meeting-id',
|
|
1499
|
+
locusUrl: 'locusUrl',
|
|
1038
1500
|
locusInfo: {
|
|
1039
|
-
links:{
|
|
1501
|
+
links: {
|
|
1040
1502
|
resources: {
|
|
1041
1503
|
attendeeSearch: {
|
|
1042
|
-
url: attendeeSearchUrl
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
})
|
|
1504
|
+
url: attendeeSearchUrl,
|
|
1505
|
+
},
|
|
1506
|
+
},
|
|
1507
|
+
},
|
|
1508
|
+
},
|
|
1509
|
+
}),
|
|
1048
1510
|
};
|
|
1049
1511
|
});
|
|
1050
1512
|
|
|
@@ -1052,22 +1514,27 @@ describe('plugin-meetings', () => {
|
|
|
1052
1514
|
webinar.webex.meetings = {
|
|
1053
1515
|
getMeetingByType: sinon.stub().returns({
|
|
1054
1516
|
id: 'meeting-id',
|
|
1517
|
+
locusUrl: 'locusUrl',
|
|
1055
1518
|
locusInfo: {
|
|
1056
|
-
links:{
|
|
1519
|
+
links: {
|
|
1057
1520
|
resources: {
|
|
1058
1521
|
attendeeSearch: {
|
|
1059
|
-
url: null
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
})
|
|
1522
|
+
url: null,
|
|
1523
|
+
},
|
|
1524
|
+
},
|
|
1525
|
+
},
|
|
1526
|
+
},
|
|
1527
|
+
}),
|
|
1065
1528
|
};
|
|
1066
1529
|
try {
|
|
1067
1530
|
await webinar.searchLargeScaleWebinarAttendees(params);
|
|
1068
1531
|
assert.fail('searchLargeScaleWebinarAttendees should throw an error');
|
|
1069
1532
|
} catch (error) {
|
|
1070
|
-
assert.equal(
|
|
1533
|
+
assert.equal(
|
|
1534
|
+
error.message,
|
|
1535
|
+
'Meeting:webinar5k#Attendee search url is not available',
|
|
1536
|
+
'should throw the correct error'
|
|
1537
|
+
);
|
|
1071
1538
|
}
|
|
1072
1539
|
});
|
|
1073
1540
|
|
|
@@ -1076,7 +1543,9 @@ describe('plugin-meetings', () => {
|
|
|
1076
1543
|
assert.calledOnce(webex.request);
|
|
1077
1544
|
assert.calledWith(webex.request, {
|
|
1078
1545
|
method: 'GET',
|
|
1079
|
-
uri: `${attendeeSearchUrl}?search_text=${encodeURIComponent(
|
|
1546
|
+
uri: `${attendeeSearchUrl}?search_text=${encodeURIComponent(
|
|
1547
|
+
params.queryString
|
|
1548
|
+
)}&limit=50`,
|
|
1080
1549
|
headers: {
|
|
1081
1550
|
authorization: 'test-token',
|
|
1082
1551
|
trackingId: 'webex-js-sdk_test-uuid',
|
|
@@ -1128,5 +1597,5 @@ describe('plugin-meetings', () => {
|
|
|
1128
1597
|
}
|
|
1129
1598
|
});
|
|
1130
1599
|
});
|
|
1131
|
-
})
|
|
1600
|
+
});
|
|
1132
1601
|
})
|