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