@webex/plugin-meetings 3.12.0 → 3.13.0-next.2
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 +4 -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/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 +322 -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/config.d.ts +4 -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/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 +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 +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/config.ts +8 -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/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 +296 -0
- package/src/meetings/index.ts +224 -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/controls-options-manager/index.js +244 -29
- package/test/unit/spec/controls-options-manager/util.js +165 -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/meetinginfov2.js +88 -11
- package/test/unit/spec/meetings/index.js +586 -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
|
@@ -7,14 +7,34 @@ import LLMChannel from '@webex/internal-plugin-llm';
|
|
|
7
7
|
|
|
8
8
|
import AnnotationService from '../../../../src/annotation/index';
|
|
9
9
|
import {ANNOTATION_RELAY_TYPES, ANNOTATION_REQUEST_TYPE, EVENT_TRIGGERS} from '../../../../src/annotation/constants';
|
|
10
|
-
import {LLM_PRACTICE_SESSION} from '../../../../src/constants';
|
|
11
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Creates a mock LLM channel for testing
|
|
13
|
+
* @param {Object} [options] - Options for the mock channel
|
|
14
|
+
* @param {boolean} [options.isConnected=true] - Whether the channel is connected
|
|
15
|
+
* @param {string} [options.binding] - The binding string
|
|
16
|
+
* @returns {Object} Mock channel
|
|
17
|
+
*/
|
|
18
|
+
function createMockLLMChannel(options: {isConnected?: boolean; binding?: string} = {}) {
|
|
19
|
+
const mockWebSocket = new MockWebSocket();
|
|
20
|
+
const {isConnected = true, binding = 'binding'} = options;
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
isConnected: sinon.stub().returns(isConnected),
|
|
24
|
+
getSocket: sinon.stub().returns(mockWebSocket),
|
|
25
|
+
getBinding: sinon.stub().returns(binding),
|
|
26
|
+
getLocusUrl: sinon.stub().returns('locusUrl'),
|
|
27
|
+
on: sinon.stub(),
|
|
28
|
+
off: sinon.stub(),
|
|
29
|
+
socket: mockWebSocket,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
12
32
|
|
|
13
33
|
describe('live-annotation', () => {
|
|
14
34
|
const locusUrl = 'https://locus.wbx2.com/locus/api/v1/loci/163c1787-c1f5-47cc-95eb-ab2d660999e6';
|
|
15
35
|
|
|
16
36
|
describe('annotation', () => {
|
|
17
|
-
let webex, annotationService;
|
|
37
|
+
let webex, annotationService, mockChannel;
|
|
18
38
|
|
|
19
39
|
beforeEach(() => {
|
|
20
40
|
webex = new MockWebex({
|
|
@@ -25,26 +45,56 @@ describe('live-annotation', () => {
|
|
|
25
45
|
},
|
|
26
46
|
});
|
|
27
47
|
|
|
28
|
-
|
|
29
48
|
annotationService = webex.internal.annotation;
|
|
30
|
-
annotationService.connect = sinon.stub().resolves(true);
|
|
31
|
-
annotationService.webex.internal.llm.isConnected = sinon.stub().returns(true);
|
|
32
|
-
annotationService.webex.internal.llm.getSocket = sinon.stub().returns(undefined);
|
|
33
|
-
annotationService.webex.internal.llm.getBinding = sinon.stub().returns(undefined);
|
|
34
|
-
annotationService.webex.internal.llm.getLocusUrl = sinon.stub().returns(locusUrl);
|
|
35
49
|
annotationService.approvalUrl = 'url/approval';
|
|
36
50
|
annotationService.locusUrl = locusUrl;
|
|
37
51
|
|
|
52
|
+
mockChannel = createMockLLMChannel();
|
|
38
53
|
|
|
39
54
|
webex.request = sinon.stub().returns(Promise.resolve('REQUEST_RETURN_VALUE'));
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
afterEach(() => {
|
|
58
|
+
annotationService.unregisterChannel();
|
|
59
|
+
sinon.restore();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
describe('#registerChannel', () => {
|
|
63
|
+
it('registers an LLM channel and subscribes to relay events', () => {
|
|
64
|
+
annotationService.registerChannel(mockChannel);
|
|
65
|
+
|
|
66
|
+
assert.calledOnceWithExactly(mockChannel.on, 'event:relay.event', sinon.match.func);
|
|
67
|
+
assert.equal(annotationService.channel, mockChannel);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('unregisters existing channel before registering new one', () => {
|
|
71
|
+
const oldChannel = createMockLLMChannel();
|
|
72
|
+
annotationService.registerChannel(oldChannel);
|
|
73
|
+
|
|
74
|
+
const newChannel = createMockLLMChannel();
|
|
75
|
+
annotationService.registerChannel(newChannel);
|
|
76
|
+
|
|
77
|
+
assert.calledOnceWithExactly(oldChannel.off, 'event:relay.event', sinon.match.func);
|
|
78
|
+
assert.calledOnceWithExactly(newChannel.on, 'event:relay.event', sinon.match.func);
|
|
79
|
+
assert.equal(annotationService.channel, newChannel);
|
|
45
80
|
});
|
|
46
81
|
});
|
|
47
82
|
|
|
83
|
+
describe('#unregisterChannel', () => {
|
|
84
|
+
it('unregisters the current channel', () => {
|
|
85
|
+
annotationService.registerChannel(mockChannel);
|
|
86
|
+
annotationService.unregisterChannel();
|
|
87
|
+
|
|
88
|
+
assert.calledOnceWithExactly(mockChannel.off, 'event:relay.event', sinon.match.func);
|
|
89
|
+
assert.equal(annotationService.channel, undefined);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('does nothing if no channel is registered', () => {
|
|
93
|
+
annotationService.unregisterChannel();
|
|
94
|
+
// Should not throw
|
|
95
|
+
assert.equal(annotationService.channel, undefined);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
48
98
|
|
|
49
99
|
describe('event message processing', () => {
|
|
50
100
|
beforeEach(async () => {
|
|
@@ -57,10 +107,8 @@ describe('live-annotation', () => {
|
|
|
57
107
|
annotationService.eventCommandProcessor({});
|
|
58
108
|
assert.notCalled(spy);
|
|
59
109
|
|
|
60
|
-
|
|
61
110
|
annotationService.eventCommandProcessor({
|
|
62
|
-
data: {
|
|
63
|
-
}
|
|
111
|
+
data: {}
|
|
64
112
|
});
|
|
65
113
|
assert.notCalled(spy);
|
|
66
114
|
|
|
@@ -94,11 +142,9 @@ describe('live-annotation', () => {
|
|
|
94
142
|
}
|
|
95
143
|
}
|
|
96
144
|
});
|
|
97
|
-
assert.notCalled(spy)
|
|
145
|
+
assert.notCalled(spy);
|
|
98
146
|
});
|
|
99
147
|
|
|
100
|
-
|
|
101
|
-
|
|
102
148
|
it('eventCommandProcessor call success', () => {
|
|
103
149
|
const spy = sinon.spy();
|
|
104
150
|
annotationService.on(EVENT_TRIGGERS.ANNOTATION_COMMAND, spy);
|
|
@@ -123,80 +169,82 @@ describe('live-annotation', () => {
|
|
|
123
169
|
});
|
|
124
170
|
|
|
125
171
|
it('eventDataProcessor call failed', () => {
|
|
126
|
-
|
|
127
|
-
const spy = sinon.spy(annotationService, "processStrokeMessage");
|
|
172
|
+
const spy = sinon.spy(annotationService, 'processStrokeMessage');
|
|
128
173
|
|
|
129
174
|
annotationService.eventDataProcessor();
|
|
130
|
-
|
|
131
175
|
assert.notCalled(spy);
|
|
132
176
|
|
|
133
177
|
annotationService.eventDataProcessor({data: {}});
|
|
134
|
-
|
|
135
178
|
assert.notCalled(spy);
|
|
136
179
|
|
|
137
180
|
annotationService.eventDataProcessor({data: {relayType: 'NOT:annotation.client'}});
|
|
138
|
-
|
|
139
181
|
assert.notCalled(spy);
|
|
140
182
|
});
|
|
141
183
|
|
|
142
|
-
|
|
143
184
|
it('eventDataProcessor call success', () => {
|
|
185
|
+
const spy = sinon.spy(annotationService, 'processStrokeMessage');
|
|
144
186
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
187
|
+
annotationService.eventDataProcessor({
|
|
188
|
+
data: {
|
|
189
|
+
relayType: 'annotation.client',
|
|
190
|
+
request: {value: {encryptionKeyUrl: 'encryptionKeyUrl'}}
|
|
191
|
+
}
|
|
192
|
+
});
|
|
148
193
|
|
|
149
194
|
assert.calledOnceWithExactly(spy, {
|
|
150
195
|
relayType: 'annotation.client',
|
|
151
|
-
request: {
|
|
152
|
-
}
|
|
153
|
-
|
|
196
|
+
request: {value: {encryptionKeyUrl: 'encryptionKeyUrl'}}
|
|
197
|
+
});
|
|
154
198
|
});
|
|
155
199
|
|
|
156
|
-
|
|
157
200
|
it('processStrokeMessage', async () => {
|
|
158
201
|
const spy = sinon.spy();
|
|
159
202
|
annotationService.on(EVENT_TRIGGERS.ANNOTATION_STROKE_DATA, spy);
|
|
160
203
|
|
|
161
|
-
await annotationService.processStrokeMessage({
|
|
204
|
+
await annotationService.processStrokeMessage({
|
|
205
|
+
request: {value: {encryptionKeyUrl: 'encryptionKeyUrl', content: 'content'}}
|
|
206
|
+
});
|
|
162
207
|
|
|
163
208
|
assert.calledOnceWithExactly(spy, {
|
|
164
|
-
payload:{request:{value:{encryptionKeyUrl: 'encryptionKeyUrl', content: 'decryptedContent'}}}
|
|
209
|
+
payload: {request: {value: {encryptionKeyUrl: 'encryptionKeyUrl', content: 'decryptedContent'}}},
|
|
165
210
|
});
|
|
166
|
-
|
|
167
211
|
});
|
|
168
|
-
|
|
169
212
|
});
|
|
170
213
|
|
|
171
|
-
describe('event
|
|
214
|
+
describe('event registration via registerChannel', () => {
|
|
215
|
+
it('registers relay event handler when channel is registered', () => {
|
|
216
|
+
annotationService.registerChannel(mockChannel);
|
|
172
217
|
|
|
173
|
-
|
|
218
|
+
assert.calledOnceWithExactly(mockChannel.on, 'event:relay.event', sinon.match.func);
|
|
219
|
+
});
|
|
174
220
|
|
|
175
|
-
|
|
221
|
+
it('processes events through the registered handler', () => {
|
|
222
|
+
annotationService.decryptContent = sinon.stub().returns(Promise.resolve('decryptedContent'));
|
|
223
|
+
annotationService.registerChannel(mockChannel);
|
|
176
224
|
|
|
177
|
-
|
|
225
|
+
// Get the handler that was registered
|
|
226
|
+
const handler = mockChannel.on.getCall(0).args[1];
|
|
178
227
|
|
|
179
|
-
|
|
180
|
-
|
|
228
|
+
const spy = sinon.spy(annotationService, 'processStrokeMessage');
|
|
229
|
+
handler({
|
|
230
|
+
data: {
|
|
231
|
+
relayType: 'annotation.client',
|
|
232
|
+
request: {value: {encryptionKeyUrl: 'key'}}
|
|
233
|
+
}
|
|
234
|
+
});
|
|
181
235
|
|
|
182
|
-
|
|
236
|
+
assert.calledOnce(spy);
|
|
237
|
+
});
|
|
183
238
|
|
|
184
|
-
|
|
239
|
+
it('listens to mercury events via listenToEvents', () => {
|
|
240
|
+
const spy = sinon.spy(annotationService.webex.internal.mercury, 'on');
|
|
185
241
|
|
|
186
242
|
annotationService.listenToEvents();
|
|
187
243
|
|
|
188
|
-
assert.
|
|
189
|
-
assert.calledWithExactly(
|
|
190
|
-
spy.secondCall,
|
|
191
|
-
`event:relay.event:${LLM_PRACTICE_SESSION}`,
|
|
192
|
-
sinon.match.func,
|
|
193
|
-
sinon.match.object
|
|
194
|
-
);
|
|
244
|
+
assert.calledOnceWithExactly(spy, 'event:locus.approval_request', sinon.match.func, sinon.match.object);
|
|
195
245
|
});
|
|
196
|
-
|
|
197
246
|
});
|
|
198
247
|
|
|
199
|
-
|
|
200
248
|
describe('encrypt/decrypt Content', () => {
|
|
201
249
|
beforeEach(async () => {
|
|
202
250
|
annotationService.webex.internal.encryption.encryptText = sinon.stub().returns(Promise.resolve('RETURN_VALUE'));
|
|
@@ -204,67 +252,72 @@ describe('live-annotation', () => {
|
|
|
204
252
|
});
|
|
205
253
|
|
|
206
254
|
it('encryptContent', async () => {
|
|
207
|
-
const result = await annotationService.encryptContent(
|
|
208
|
-
assert.calledOnceWithExactly(webex.internal.encryption.encryptText,
|
|
209
|
-
assert.equal(result, 'RETURN_VALUE')
|
|
255
|
+
const result = await annotationService.encryptContent('encryptionKeyUrl', 'content');
|
|
256
|
+
assert.calledOnceWithExactly(webex.internal.encryption.encryptText, 'encryptionKeyUrl', 'content');
|
|
257
|
+
assert.equal(result, 'RETURN_VALUE');
|
|
210
258
|
});
|
|
211
259
|
|
|
212
|
-
it('decryptContent', async() => {
|
|
213
|
-
const result =
|
|
214
|
-
assert.calledOnceWithExactly(webex.internal.encryption.decryptText,
|
|
215
|
-
assert.equal(result, 'RETURN_VALUE')
|
|
260
|
+
it('decryptContent', async () => {
|
|
261
|
+
const result = await annotationService.decryptContent('decryptionKeyUrl', 'content');
|
|
262
|
+
assert.calledOnceWithExactly(webex.internal.encryption.decryptText, 'decryptionKeyUrl', 'content');
|
|
263
|
+
assert.equal(result, 'RETURN_VALUE');
|
|
216
264
|
});
|
|
217
|
-
|
|
218
265
|
});
|
|
219
266
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
beforeEach(async () => {
|
|
225
|
-
annotationService.webex.internal.llm.socket = new MockWebSocket();
|
|
226
|
-
annotationService.webex.internal.llm.isConnected = sinon.stub().returns(false);
|
|
267
|
+
describe('publish Stroke Data with no channel registered', () => {
|
|
268
|
+
it('does not send when no channel is registered', async () => {
|
|
269
|
+
annotationService.sendStrokeData({});
|
|
270
|
+
// Should not throw, just return early
|
|
227
271
|
});
|
|
272
|
+
});
|
|
228
273
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
274
|
+
describe('publish Stroke Data with channel not connected', () => {
|
|
275
|
+
it('does not send when channel is not connected', async () => {
|
|
276
|
+
const disconnectedChannel = createMockLLMChannel({isConnected: false});
|
|
277
|
+
annotationService.registerChannel(disconnectedChannel);
|
|
233
278
|
|
|
279
|
+
annotationService.sendStrokeData({});
|
|
280
|
+
assert.notCalled(disconnectedChannel.socket.send);
|
|
281
|
+
});
|
|
234
282
|
});
|
|
235
283
|
|
|
236
284
|
describe('sendStrokeData', () => {
|
|
237
285
|
let strokeData;
|
|
238
286
|
|
|
239
287
|
beforeEach(async () => {
|
|
240
|
-
annotationService.
|
|
288
|
+
annotationService.registerChannel(mockChannel);
|
|
289
|
+
annotationService.webex.internal.encryption.encryptText = sinon.stub().returns(Promise.resolve('encryptedContent'));
|
|
290
|
+
|
|
241
291
|
strokeData = {
|
|
242
292
|
content: {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}],
|
|
249
|
-
|
|
293
|
+
contentsBuffer: [{
|
|
294
|
+
contentArray: [{
|
|
295
|
+
curveId: '58dcf45c-1fc5-46bf-a902-053621dd8977',
|
|
296
|
+
curvePoints: [592.593, 352.963, 3.400, 596.710, 352.963, 3.400],
|
|
297
|
+
stride: 3
|
|
298
|
+
}],
|
|
299
|
+
type: 'curve',
|
|
300
|
+
name: 'contentUpdate'
|
|
301
|
+
}],
|
|
302
|
+
action: 'contentUpdate',
|
|
303
|
+
sender: {name: 'perfect', id: '4dd5eaf9-4cf8-4f0f-a1d6-014bf5d00741'}
|
|
250
304
|
},
|
|
251
|
-
deviceId:
|
|
305
|
+
deviceId: '525ead98-6c93-4fcb-899d-517305c47513',
|
|
252
306
|
requesterId: '525ead98-6c93-4fcb-899d-517305c47513',
|
|
253
|
-
toUserId:
|
|
307
|
+
toUserId: '987ead98-6c93-4fcb-899d-517305c47503',
|
|
254
308
|
shareInstanceId: '7fa6fe07-dcb1-41ad-973d-7bcf65fab55d',
|
|
255
|
-
encryptionKeyUrl:
|
|
309
|
+
encryptionKeyUrl: 'encryptionKeyUrl',
|
|
256
310
|
version: '1',
|
|
257
311
|
};
|
|
258
312
|
});
|
|
259
313
|
|
|
260
|
-
|
|
261
314
|
it('works on publish Stroke Data', async () => {
|
|
262
315
|
annotationService.publishEncrypted(strokeData.content, strokeData);
|
|
263
316
|
|
|
264
317
|
const sendObject = {
|
|
265
318
|
id: sinon.match.string,
|
|
266
319
|
type: 'publishRequest',
|
|
267
|
-
recipients: {route:
|
|
320
|
+
recipients: [{route: 'binding'}],
|
|
268
321
|
headers: {to: '987ead98-6c93-4fcb-899d-517305c47503'},
|
|
269
322
|
data: {
|
|
270
323
|
eventType: 'relay.event',
|
|
@@ -274,7 +327,7 @@ describe('live-annotation', () => {
|
|
|
274
327
|
type: ANNOTATION_REQUEST_TYPE.ANNOTATION_MESSAGE,
|
|
275
328
|
content: strokeData.content,
|
|
276
329
|
version: '1',
|
|
277
|
-
seq:sinon.match.number,
|
|
330
|
+
seq: sinon.match.number,
|
|
278
331
|
deviceId: sinon.match.string,
|
|
279
332
|
requesterId: sinon.match.string,
|
|
280
333
|
shareInstanceId: strokeData.shareInstanceId,
|
|
@@ -288,66 +341,48 @@ describe('live-annotation', () => {
|
|
|
288
341
|
filterMessage: false,
|
|
289
342
|
};
|
|
290
343
|
|
|
291
|
-
assert.calledOnceWithExactly(
|
|
344
|
+
assert.calledOnceWithExactly(mockChannel.socket.send, sendObject);
|
|
292
345
|
});
|
|
293
346
|
|
|
294
|
-
it('
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
annotationService.
|
|
298
|
-
sessionId === LLM_PRACTICE_SESSION
|
|
299
|
-
);
|
|
300
|
-
annotationService.webex.internal.llm.getSocket
|
|
301
|
-
.withArgs(LLM_PRACTICE_SESSION)
|
|
302
|
-
.returns(practiceSocket);
|
|
303
|
-
annotationService.webex.internal.llm.getBinding
|
|
304
|
-
.withArgs(LLM_PRACTICE_SESSION)
|
|
305
|
-
.returns('practice-binding');
|
|
347
|
+
it('does not send if socket is not available', () => {
|
|
348
|
+
const channelWithoutSocket = createMockLLMChannel();
|
|
349
|
+
channelWithoutSocket.getSocket.returns(undefined);
|
|
350
|
+
annotationService.registerChannel(channelWithoutSocket);
|
|
306
351
|
|
|
307
352
|
annotationService.publishEncrypted(strokeData.content, strokeData);
|
|
308
353
|
|
|
309
|
-
assert.
|
|
310
|
-
assert.notCalled(annotationService.webex.internal.llm.socket.send);
|
|
311
|
-
|
|
312
|
-
const sent = practiceSocket.send.getCall(0).args[0];
|
|
313
|
-
assert.equal(sent.recipients.route, 'practice-binding');
|
|
354
|
+
assert.notCalled(channelWithoutSocket.socket.send);
|
|
314
355
|
});
|
|
315
356
|
|
|
316
|
-
it('
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
annotationService.
|
|
320
|
-
annotationService.webex.internal.llm.getSocket
|
|
321
|
-
.withArgs(LLM_PRACTICE_SESSION)
|
|
322
|
-
.returns(practiceSocket);
|
|
323
|
-
annotationService.webex.internal.llm.getBinding
|
|
324
|
-
.withArgs(LLM_PRACTICE_SESSION)
|
|
325
|
-
.returns('practice-binding');
|
|
326
|
-
annotationService.webex.internal.llm.getBinding.returns('default-binding');
|
|
357
|
+
it('does not send if binding is not available', () => {
|
|
358
|
+
const channelWithoutBinding = createMockLLMChannel({binding: undefined});
|
|
359
|
+
channelWithoutBinding.getBinding.returns(undefined);
|
|
360
|
+
annotationService.registerChannel(channelWithoutBinding);
|
|
327
361
|
|
|
328
362
|
annotationService.publishEncrypted(strokeData.content, strokeData);
|
|
329
363
|
|
|
330
|
-
assert.notCalled(
|
|
331
|
-
assert.calledOnce(annotationService.webex.internal.llm.socket.send);
|
|
332
|
-
|
|
333
|
-
const sent = annotationService.webex.internal.llm.socket.send.getCall(0).args[0];
|
|
334
|
-
assert.equal(sent.recipients.route, 'default-binding');
|
|
364
|
+
assert.notCalled(channelWithoutBinding.socket.send);
|
|
335
365
|
});
|
|
336
366
|
|
|
337
|
-
|
|
367
|
+
it('encrypts content before publishing', async () => {
|
|
368
|
+
await annotationService.sendStrokeData(strokeData);
|
|
338
369
|
|
|
370
|
+
assert.calledOnceWithExactly(
|
|
371
|
+
webex.internal.encryption.encryptText,
|
|
372
|
+
strokeData.encryptionKeyUrl,
|
|
373
|
+
strokeData.content
|
|
374
|
+
);
|
|
375
|
+
});
|
|
376
|
+
});
|
|
339
377
|
|
|
340
378
|
describe('Locus API collection', () => {
|
|
341
|
-
|
|
342
379
|
describe('send approve request', () => {
|
|
343
|
-
it('makes
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
};
|
|
350
|
-
|
|
380
|
+
it('makes send request approved annotation as expected', async () => {
|
|
381
|
+
const requestData = {
|
|
382
|
+
toUserId: '4dd5eaf9-4cf8-4f0f-a1d6-014bf5d00741',
|
|
383
|
+
toDeviceUrl: 'https://wdm-a.wbx2.com/wdm/api/v1/devices/a3018aa9-70cb-4142-ae9a-f03db4fe1057',
|
|
384
|
+
shareInstanceId: '9428c492-da14-476f-a36c-b377ee8c4009',
|
|
385
|
+
};
|
|
351
386
|
|
|
352
387
|
const result = await annotationService.approveAnnotation(requestData);
|
|
353
388
|
assert.calledOnceWithExactly(webex.request, {
|
|
@@ -364,22 +399,20 @@ describe('live-annotation', () => {
|
|
|
364
399
|
}
|
|
365
400
|
});
|
|
366
401
|
|
|
367
|
-
assert.equal(result, 'REQUEST_RETURN_VALUE')
|
|
402
|
+
assert.equal(result, 'REQUEST_RETURN_VALUE');
|
|
368
403
|
});
|
|
369
404
|
});
|
|
370
405
|
|
|
371
406
|
describe('cancel Approve request', () => {
|
|
372
407
|
it('makes the cancel Approve request annotation as expected', async () => {
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
const result = await annotationService.cancelApproveAnnotation(requestData,approval);
|
|
408
|
+
const requestData = {
|
|
409
|
+
toUserId: '4dd5eaf9-4cf8-4f0f-a1d6-014bf5d00741',
|
|
410
|
+
toDeviceUrl: 'https://wdm-a.wbx2.com/wdm/api/v1/devices/a3018aa9-70cb-4142-ae9a-f03db4fe1057',
|
|
411
|
+
shareInstanceId: '9428c492-da14-476f-a36c-b377ee8c4009',
|
|
412
|
+
};
|
|
413
|
+
const approval = {url: 'url/cancel'};
|
|
414
|
+
|
|
415
|
+
const result = await annotationService.cancelApproveAnnotation(requestData, approval);
|
|
383
416
|
assert.calledOnceWithExactly(webex.request, {
|
|
384
417
|
method: 'PUT',
|
|
385
418
|
url: 'url/cancel',
|
|
@@ -390,21 +423,17 @@ describe('live-annotation', () => {
|
|
|
390
423
|
}
|
|
391
424
|
});
|
|
392
425
|
|
|
393
|
-
assert.equal(result, 'REQUEST_RETURN_VALUE')
|
|
426
|
+
assert.equal(result, 'REQUEST_RETURN_VALUE');
|
|
394
427
|
});
|
|
395
428
|
});
|
|
396
429
|
|
|
397
|
-
|
|
398
|
-
|
|
399
430
|
describe('close annotation', () => {
|
|
400
431
|
it('makes the close annotation as expected', async () => {
|
|
401
|
-
const
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
};
|
|
407
|
-
|
|
432
|
+
const requestData = {
|
|
433
|
+
toUserId: '4dd5eaf9-4cf8-4f0f-a1d6-014bf5d00741',
|
|
434
|
+
toDeviceUrl: 'https://wdm-a.wbx2.com/wdm/api/v1/devices/a3018aa9-70cb-4142-ae9a-f03db4fe1057',
|
|
435
|
+
shareInstanceId: '9428c492-da14-476f-a36c-b377ee8c4009',
|
|
436
|
+
};
|
|
408
437
|
|
|
409
438
|
const result = await annotationService.closeAnnotation(requestData);
|
|
410
439
|
assert.calledOnceWithExactly(webex.request, {
|
|
@@ -421,16 +450,15 @@ describe('live-annotation', () => {
|
|
|
421
450
|
}
|
|
422
451
|
});
|
|
423
452
|
|
|
424
|
-
assert.equal(result, 'REQUEST_RETURN_VALUE')
|
|
453
|
+
assert.equal(result, 'REQUEST_RETURN_VALUE');
|
|
425
454
|
});
|
|
426
455
|
});
|
|
427
456
|
|
|
428
|
-
|
|
429
457
|
describe('declined annotation', () => {
|
|
430
458
|
it('makes the declined annotation as expected', async () => {
|
|
431
459
|
const approval = {
|
|
432
460
|
url: 'approvalUrl'
|
|
433
|
-
}
|
|
461
|
+
};
|
|
434
462
|
const result = await annotationService.declineRequest(approval);
|
|
435
463
|
assert.calledOnceWithExactly(webex.request, {
|
|
436
464
|
method: 'PUT',
|
|
@@ -441,7 +469,7 @@ describe('live-annotation', () => {
|
|
|
441
469
|
}
|
|
442
470
|
});
|
|
443
471
|
|
|
444
|
-
assert.equal(result, 'REQUEST_RETURN_VALUE')
|
|
472
|
+
assert.equal(result, 'REQUEST_RETURN_VALUE');
|
|
445
473
|
});
|
|
446
474
|
});
|
|
447
475
|
|
|
@@ -449,7 +477,7 @@ describe('live-annotation', () => {
|
|
|
449
477
|
it('makes the accepted annotation as expected', async () => {
|
|
450
478
|
const approval = {
|
|
451
479
|
url: 'approvalUrl'
|
|
452
|
-
}
|
|
480
|
+
};
|
|
453
481
|
const result = await annotationService.acceptRequest(approval);
|
|
454
482
|
assert.calledOnceWithExactly(webex.request, {
|
|
455
483
|
method: 'PUT',
|
|
@@ -460,66 +488,70 @@ describe('live-annotation', () => {
|
|
|
460
488
|
}
|
|
461
489
|
});
|
|
462
490
|
|
|
463
|
-
assert.equal(result, 'REQUEST_RETURN_VALUE')
|
|
491
|
+
assert.equal(result, 'REQUEST_RETURN_VALUE');
|
|
464
492
|
});
|
|
465
493
|
});
|
|
466
494
|
});
|
|
467
495
|
|
|
468
496
|
describe('#deregisterEvents', () => {
|
|
469
|
-
let llmOn;
|
|
470
|
-
let llmOff;
|
|
471
497
|
let mercuryOn;
|
|
472
498
|
let mercuryOff;
|
|
473
499
|
|
|
474
500
|
beforeEach(() => {
|
|
475
|
-
llmOn = sinon.spy(webex.internal.llm, 'on');
|
|
476
|
-
llmOff = sinon.spy(webex.internal.llm, 'off');
|
|
477
501
|
mercuryOn = sinon.spy(webex.internal.mercury, 'on');
|
|
478
502
|
mercuryOff = sinon.spy(webex.internal.mercury, 'off');
|
|
479
503
|
});
|
|
480
504
|
|
|
481
|
-
it('cleans up events', () => {
|
|
505
|
+
it('cleans up mercury events and unregisters channel', () => {
|
|
506
|
+
annotationService.registerChannel(mockChannel);
|
|
482
507
|
annotationService.locusUrlUpdate(locusUrl);
|
|
508
|
+
|
|
483
509
|
assert.calledWith(
|
|
484
510
|
mercuryOn,
|
|
485
511
|
'event:locus.approval_request',
|
|
486
512
|
annotationService.eventCommandProcessor,
|
|
487
513
|
annotationService
|
|
488
514
|
);
|
|
489
|
-
assert.calledWith(
|
|
490
|
-
llmOn,
|
|
491
|
-
'event:relay.event',
|
|
492
|
-
annotationService.eventDataProcessor,
|
|
493
|
-
annotationService
|
|
494
|
-
);
|
|
495
|
-
assert.calledWith(
|
|
496
|
-
llmOn,
|
|
497
|
-
`event:relay.event:${LLM_PRACTICE_SESSION}`,
|
|
498
|
-
annotationService.eventDataProcessor,
|
|
499
|
-
annotationService
|
|
500
|
-
);
|
|
501
515
|
assert.match(annotationService.hasSubscribedToEvents, true);
|
|
502
516
|
|
|
503
517
|
annotationService.deregisterEvents();
|
|
504
|
-
|
|
505
|
-
assert.calledWith(
|
|
506
|
-
llmOff,
|
|
507
|
-
`event:relay.event:${LLM_PRACTICE_SESSION}`,
|
|
508
|
-
annotationService.eventDataProcessor
|
|
509
|
-
);
|
|
518
|
+
|
|
510
519
|
assert.calledWith(
|
|
511
520
|
mercuryOff,
|
|
512
521
|
'event:locus.approval_request',
|
|
513
522
|
annotationService.eventCommandProcessor
|
|
514
523
|
);
|
|
524
|
+
assert.calledOnceWithExactly(mockChannel.off, 'event:relay.event', sinon.match.func);
|
|
525
|
+
assert.equal(annotationService.channel, undefined);
|
|
515
526
|
assert.match(annotationService.hasSubscribedToEvents, false);
|
|
516
527
|
});
|
|
517
528
|
|
|
518
|
-
it('does not call
|
|
529
|
+
it('does not call off if events have not been registered', () => {
|
|
519
530
|
annotationService.deregisterEvents();
|
|
520
|
-
assert.notCalled(llmOff);
|
|
521
531
|
assert.notCalled(mercuryOff);
|
|
522
532
|
});
|
|
523
533
|
});
|
|
534
|
+
|
|
535
|
+
describe('#locusUrlUpdate', () => {
|
|
536
|
+
it('updates locusUrl and calls listenToEvents', () => {
|
|
537
|
+
const newLocusUrl = 'https://new-locus-url.com';
|
|
538
|
+
const listenSpy = sinon.spy(annotationService, 'listenToEvents');
|
|
539
|
+
|
|
540
|
+
annotationService.locusUrlUpdate(newLocusUrl);
|
|
541
|
+
|
|
542
|
+
assert.equal(annotationService.locusUrl, newLocusUrl);
|
|
543
|
+
assert.calledOnce(listenSpy);
|
|
544
|
+
});
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
describe('#approvalUrlUpdate', () => {
|
|
548
|
+
it('updates approvalUrl', () => {
|
|
549
|
+
const newApprovalUrl = 'https://new-approval-url.com';
|
|
550
|
+
|
|
551
|
+
annotationService.approvalUrlUpdate(newApprovalUrl);
|
|
552
|
+
|
|
553
|
+
assert.equal(annotationService.approvalUrl, newApprovalUrl);
|
|
554
|
+
});
|
|
555
|
+
});
|
|
524
556
|
});
|
|
525
557
|
});
|