@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
|
@@ -3,9 +3,10 @@ import sinon from 'sinon';
|
|
|
3
3
|
import {cloneDeep, forEach} from 'lodash';
|
|
4
4
|
import {assert} from '@webex/test-helper-chai';
|
|
5
5
|
import MockWebex from '@webex/test-helper-mock-webex';
|
|
6
|
+
import {webexTrackingIdSequenceNumbers} from '@webex/webex-core';
|
|
6
7
|
import testUtils from '../../../utils/testUtils';
|
|
7
8
|
import Meetings from '@webex/plugin-meetings';
|
|
8
|
-
import LocusInfo, {createLocusFromHashTreeMessage} from '@webex/plugin-meetings/src/locus-info';
|
|
9
|
+
import LocusInfo, {createLocusFromHashTreeMessage, findMeetingForHashTreeMessage} from '@webex/plugin-meetings/src/locus-info';
|
|
9
10
|
import SelfUtils from '@webex/plugin-meetings/src/locus-info/selfUtils';
|
|
10
11
|
import InfoUtils from '@webex/plugin-meetings/src/locus-info/infoUtils';
|
|
11
12
|
import EmbeddedAppsUtils from '@webex/plugin-meetings/src/locus-info/embeddedAppsUtils';
|
|
@@ -13,6 +14,7 @@ import MediaSharesUtils from '@webex/plugin-meetings/src/locus-info//mediaShares
|
|
|
13
14
|
import LocusDeltaParser from '@webex/plugin-meetings/src/locus-info/parser';
|
|
14
15
|
import Metrics from '@webex/plugin-meetings/src/metrics';
|
|
15
16
|
import * as HashTreeParserModule from '@webex/plugin-meetings/src/hashTree/hashTreeParser';
|
|
17
|
+
import MeetingsUtil from '@webex/plugin-meetings/src/meetings/util';
|
|
16
18
|
|
|
17
19
|
import {
|
|
18
20
|
LOCUSINFO,
|
|
@@ -30,6 +32,7 @@ import {
|
|
|
30
32
|
|
|
31
33
|
import {self, selfWithInactivity} from './selfConstant';
|
|
32
34
|
import {MEETING_REMOVED_REASON} from '@webex/plugin-meetings/src/constants';
|
|
35
|
+
import BEHAVIORAL_METRICS from '@webex/plugin-meetings/src/metrics/constants';
|
|
33
36
|
import LoggerProxy from '@webex/plugin-meetings/src/common/logs/logger-proxy';
|
|
34
37
|
|
|
35
38
|
describe('plugin-meetings', () => {
|
|
@@ -55,7 +58,7 @@ describe('plugin-meetings', () => {
|
|
|
55
58
|
|
|
56
59
|
beforeEach(() => {
|
|
57
60
|
mockMeeting = {};
|
|
58
|
-
locusInfo = new LocusInfo(updateMeeting, webex, meetingId);
|
|
61
|
+
locusInfo = new LocusInfo({updateMeeting}, webex, meetingId);
|
|
59
62
|
|
|
60
63
|
locusInfo.init(locus);
|
|
61
64
|
|
|
@@ -105,6 +108,7 @@ describe('plugin-meetings', () => {
|
|
|
105
108
|
});
|
|
106
109
|
|
|
107
110
|
const createHashTreeMessage = (visibleDataSets) => ({
|
|
111
|
+
locusUrl: 'http://locus-url.com',
|
|
108
112
|
locusStateElements: [
|
|
109
113
|
{
|
|
110
114
|
htMeta: {elementId: {type: 'metadata'}},
|
|
@@ -115,6 +119,7 @@ describe('plugin-meetings', () => {
|
|
|
115
119
|
});
|
|
116
120
|
|
|
117
121
|
const createLocusWithVisibleDataSets = (visibleDataSets) => ({
|
|
122
|
+
url: 'http://locus-url.com',
|
|
118
123
|
self: {visibleDataSets},
|
|
119
124
|
participants: [],
|
|
120
125
|
links: {
|
|
@@ -138,14 +143,16 @@ describe('plugin-meetings', () => {
|
|
|
138
143
|
sinon.match({
|
|
139
144
|
initialLocus: {
|
|
140
145
|
locus: null,
|
|
141
|
-
dataSets:
|
|
146
|
+
dataSets: hashTreeMessage.dataSets,
|
|
142
147
|
},
|
|
143
148
|
metadata: {
|
|
144
149
|
htMeta: hashTreeMessage.locusStateElements[0].htMeta,
|
|
145
150
|
visibleDataSets,
|
|
146
151
|
},
|
|
147
152
|
webexRequest: sinon.match.func,
|
|
148
|
-
|
|
153
|
+
callbacks: sinon.match({
|
|
154
|
+
locusInfoUpdateCallback: sinon.match.func,
|
|
155
|
+
}),
|
|
149
156
|
debugId: sinon.match.string,
|
|
150
157
|
})
|
|
151
158
|
);
|
|
@@ -155,6 +162,71 @@ describe('plugin-meetings', () => {
|
|
|
155
162
|
assert.isTrue(locusInfo.emitChange);
|
|
156
163
|
});
|
|
157
164
|
|
|
165
|
+
it('passes a generateTrackingId callback that reuses the tracking-id interceptor sequence', async () => {
|
|
166
|
+
webex.sessionId = 'test-session';
|
|
167
|
+
const hashTreeMessage = createHashTreeMessage(['dataset1']);
|
|
168
|
+
|
|
169
|
+
await locusInfo.initialSetup({trigger: 'locus-message', hashTreeMessage});
|
|
170
|
+
|
|
171
|
+
const {generateTrackingId} = HashTreeParserStub.firstCall.args[0].callbacks;
|
|
172
|
+
|
|
173
|
+
// The interceptor for this webex is present in the exposed map -> reuse its sequence.
|
|
174
|
+
const fakeInterceptor = {webex, sequence: 7};
|
|
175
|
+
webexTrackingIdSequenceNumbers.set(fakeInterceptor, 0);
|
|
176
|
+
|
|
177
|
+
try {
|
|
178
|
+
assert.equal(generateTrackingId(), 'test-session_7');
|
|
179
|
+
} finally {
|
|
180
|
+
webexTrackingIdSequenceNumbers.delete(fakeInterceptor);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it('passes a generateTrackingId callback that falls back to a uuid when no interceptor is registered', async () => {
|
|
185
|
+
webex.sessionId = 'test-session';
|
|
186
|
+
const hashTreeMessage = createHashTreeMessage(['dataset1']);
|
|
187
|
+
|
|
188
|
+
await locusInfo.initialSetup({trigger: 'locus-message', hashTreeMessage});
|
|
189
|
+
|
|
190
|
+
const {generateTrackingId} = HashTreeParserStub.firstCall.args[0].callbacks;
|
|
191
|
+
|
|
192
|
+
assert.match(
|
|
193
|
+
generateTrackingId(),
|
|
194
|
+
/^test-session_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/
|
|
195
|
+
);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
it('passes an isLlmExpected callback that is true when current device is joined', async () => {
|
|
199
|
+
locusInfo.parsedLocus.self = {
|
|
200
|
+
state: 'LEFT',
|
|
201
|
+
joinedWith: {state: 'JOINED'},
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
await locusInfo.initialSetup({
|
|
205
|
+
trigger: 'locus-message',
|
|
206
|
+
hashTreeMessage: createHashTreeMessage(['dataset1']),
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
const {isLlmExpected} = HashTreeParserStub.firstCall.args[0].callbacks;
|
|
210
|
+
|
|
211
|
+
assert.equal(isLlmExpected(), true);
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
it('passes an isLlmExpected callback that is false when self is joined but current device is not joined', async () => {
|
|
215
|
+
locusInfo.parsedLocus.self = {
|
|
216
|
+
state: 'JOINED',
|
|
217
|
+
joinedWith: {state: 'LEFT'},
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
await locusInfo.initialSetup({
|
|
221
|
+
trigger: 'locus-message',
|
|
222
|
+
hashTreeMessage: createHashTreeMessage(['dataset1']),
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
const {isLlmExpected} = HashTreeParserStub.firstCall.args[0].callbacks;
|
|
226
|
+
|
|
227
|
+
assert.equal(isLlmExpected(), false);
|
|
228
|
+
});
|
|
229
|
+
|
|
158
230
|
it('should not initialize the hash tree when triggered from a non-hash tree locus message', async () => {
|
|
159
231
|
const locus = {url: 'http://locus-url.com', participants: []};
|
|
160
232
|
|
|
@@ -195,7 +267,9 @@ describe('plugin-meetings', () => {
|
|
|
195
267
|
},
|
|
196
268
|
metadata,
|
|
197
269
|
webexRequest: sinon.match.func,
|
|
198
|
-
|
|
270
|
+
callbacks: sinon.match({
|
|
271
|
+
locusInfoUpdateCallback: sinon.match.func,
|
|
272
|
+
}),
|
|
199
273
|
debugId: sinon.match.string,
|
|
200
274
|
})
|
|
201
275
|
);
|
|
@@ -218,6 +292,47 @@ describe('plugin-meetings', () => {
|
|
|
218
292
|
assert.isTrue(locusInfo.emitChange);
|
|
219
293
|
});
|
|
220
294
|
|
|
295
|
+
it('calls onLocusSynced callback passed as second argument with full locus from join response', async () => {
|
|
296
|
+
const syncedLocus = {url: 'http://locus-url.com', participants: []};
|
|
297
|
+
const onLocusSynced = sinon.stub();
|
|
298
|
+
|
|
299
|
+
await locusInfo.initialSetup(
|
|
300
|
+
{
|
|
301
|
+
trigger: 'join-response',
|
|
302
|
+
locus: syncedLocus,
|
|
303
|
+
},
|
|
304
|
+
onLocusSynced
|
|
305
|
+
);
|
|
306
|
+
|
|
307
|
+
assert.calledOnceWithExactly(onLocusSynced, syncedLocus);
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
it('swallows onLocusSynced callback errors and logs warn', async () => {
|
|
311
|
+
const syncedLocus = {url: 'http://locus-url.com', participants: []};
|
|
312
|
+
const callbackError = new Error('onLocusSynced failed');
|
|
313
|
+
const onLocusSynced = sinon.stub().throws(callbackError);
|
|
314
|
+
const loggerWarnStub = LoggerProxy.logger.warn?.isSinonProxy
|
|
315
|
+
? LoggerProxy.logger.warn
|
|
316
|
+
: sinon.stub(LoggerProxy.logger, 'warn');
|
|
317
|
+
|
|
318
|
+
loggerWarnStub.resetHistory();
|
|
319
|
+
|
|
320
|
+
await locusInfo.initialSetup(
|
|
321
|
+
{
|
|
322
|
+
trigger: 'join-response',
|
|
323
|
+
locus: syncedLocus,
|
|
324
|
+
},
|
|
325
|
+
onLocusSynced
|
|
326
|
+
);
|
|
327
|
+
|
|
328
|
+
assert.calledOnceWithExactly(onLocusSynced, syncedLocus);
|
|
329
|
+
assert.calledOnce(loggerWarnStub);
|
|
330
|
+
assert.match(
|
|
331
|
+
loggerWarnStub.firstCall.args[0],
|
|
332
|
+
/Locus-info:index#initialSetup --> onLocusSynced callback failed/
|
|
333
|
+
);
|
|
334
|
+
});
|
|
335
|
+
|
|
221
336
|
it('should initialize the hash tree parser correctly when triggered from a get loci response containing visible datasets', async () => {
|
|
222
337
|
const visibleDataSets = ['dataset1', 'dataset2'];
|
|
223
338
|
const locus = createLocusWithVisibleDataSets(visibleDataSets);
|
|
@@ -235,7 +350,9 @@ describe('plugin-meetings', () => {
|
|
|
235
350
|
dataSets: [],
|
|
236
351
|
},
|
|
237
352
|
webexRequest: sinon.match.func,
|
|
238
|
-
|
|
353
|
+
callbacks: sinon.match({
|
|
354
|
+
locusInfoUpdateCallback: sinon.match.func,
|
|
355
|
+
}),
|
|
239
356
|
debugId: sinon.match.string,
|
|
240
357
|
metadata: null,
|
|
241
358
|
})
|
|
@@ -288,6 +405,7 @@ describe('plugin-meetings', () => {
|
|
|
288
405
|
describe('should setup correct locusInfoUpdateCallback when creating HashTreeParser', () => {
|
|
289
406
|
const OBJECTS_UPDATED = HashTreeParserModule.LocusInfoUpdateType.OBJECTS_UPDATED;
|
|
290
407
|
const MEETING_ENDED = HashTreeParserModule.LocusInfoUpdateType.MEETING_ENDED;
|
|
408
|
+
const LOCUS_NOT_FOUND = HashTreeParserModule.LocusInfoUpdateType.LOCUS_NOT_FOUND;
|
|
291
409
|
|
|
292
410
|
let locusInfoUpdateCallback;
|
|
293
411
|
let onDeltaLocusStub;
|
|
@@ -299,6 +417,7 @@ describe('plugin-meetings', () => {
|
|
|
299
417
|
await locusInfo.initialSetup({
|
|
300
418
|
trigger: 'locus-message',
|
|
301
419
|
hashTreeMessage: {
|
|
420
|
+
locusUrl: 'fake-locus-url',
|
|
302
421
|
locusStateElements: [
|
|
303
422
|
{
|
|
304
423
|
htMeta: {elementId: {type: 'Metadata'}},
|
|
@@ -309,7 +428,7 @@ describe('plugin-meetings', () => {
|
|
|
309
428
|
},
|
|
310
429
|
});
|
|
311
430
|
|
|
312
|
-
locusInfoUpdateCallback = HashTreeParserStub.firstCall.args[0].locusInfoUpdateCallback;
|
|
431
|
+
locusInfoUpdateCallback = HashTreeParserStub.firstCall.args[0].callbacks.locusInfoUpdateCallback;
|
|
313
432
|
|
|
314
433
|
assert.isDefined(locusInfoUpdateCallback);
|
|
315
434
|
|
|
@@ -357,6 +476,13 @@ describe('plugin-meetings', () => {
|
|
|
357
476
|
locusInfo.url = 'fake-locus-url';
|
|
358
477
|
locusInfo.htMeta = {elementId: {type: 'locus', id: 'fake-ht-locus-id', version: 1}};
|
|
359
478
|
|
|
479
|
+
const createdHashTreeParser = locusInfo.hashTreeParsers.get('fake-locus-url');
|
|
480
|
+
|
|
481
|
+
assert.isDefined(createdHashTreeParser);
|
|
482
|
+
// this flag would have been set to true on the first callback triggered by initialSetup() wa called earlier
|
|
483
|
+
// it's not because we're mocking HashTreeParser, so we have to set it manually here
|
|
484
|
+
createdHashTreeParser.initializedFromHashTree = true;
|
|
485
|
+
|
|
360
486
|
// setup the default expected locus info state that each test builds upon
|
|
361
487
|
expectedLocusInfo = {
|
|
362
488
|
controls: {id: 'fake-controls'},
|
|
@@ -385,7 +511,7 @@ describe('plugin-meetings', () => {
|
|
|
385
511
|
},
|
|
386
512
|
],
|
|
387
513
|
meetings: {id: 'fake-meetings'},
|
|
388
|
-
jsSdkMeta: {removedParticipantIds: []},
|
|
514
|
+
jsSdkMeta: {removedParticipantIds: [], forceReplaceMembers: false},
|
|
389
515
|
participants: [], // empty means there were no participant updates
|
|
390
516
|
replaces: {id: 'fake-replaces'},
|
|
391
517
|
self: {id: 'fake-self'},
|
|
@@ -403,7 +529,7 @@ describe('plugin-meetings', () => {
|
|
|
403
529
|
};
|
|
404
530
|
|
|
405
531
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
406
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
532
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
407
533
|
updatedObjects: [{htMeta: {elementId: {type: 'self'}}, data: newSelf}],
|
|
408
534
|
});
|
|
409
535
|
|
|
@@ -430,7 +556,7 @@ describe('plugin-meetings', () => {
|
|
|
430
556
|
locusInfo.info.isWebinar = true;
|
|
431
557
|
|
|
432
558
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
433
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
559
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
434
560
|
updatedObjects: [{htMeta: {elementId: {type: 'self'}}, data: newSelf}],
|
|
435
561
|
});
|
|
436
562
|
|
|
@@ -463,7 +589,7 @@ describe('plugin-meetings', () => {
|
|
|
463
589
|
locusInfo.info.isWebinar = true;
|
|
464
590
|
|
|
465
591
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
466
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
592
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
467
593
|
updatedObjects: [{htMeta: {elementId: {type: 'self'}}, data: newSelf}],
|
|
468
594
|
});
|
|
469
595
|
|
|
@@ -491,7 +617,7 @@ describe('plugin-meetings', () => {
|
|
|
491
617
|
};
|
|
492
618
|
|
|
493
619
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
494
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
620
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
495
621
|
updatedObjects: [{htMeta: {elementId: {type: 'fullState'}}, data: newFullState}],
|
|
496
622
|
});
|
|
497
623
|
|
|
@@ -509,7 +635,7 @@ describe('plugin-meetings', () => {
|
|
|
509
635
|
};
|
|
510
636
|
|
|
511
637
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
512
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
638
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
513
639
|
updatedObjects: [{htMeta: {elementId: {type: 'info'}}, data: newInfo}],
|
|
514
640
|
});
|
|
515
641
|
|
|
@@ -527,7 +653,7 @@ describe('plugin-meetings', () => {
|
|
|
527
653
|
};
|
|
528
654
|
|
|
529
655
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
530
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
656
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
531
657
|
updatedObjects: [{htMeta: {elementId: {type: 'links'}}, data: newLinks}],
|
|
532
658
|
});
|
|
533
659
|
|
|
@@ -547,7 +673,7 @@ describe('plugin-meetings', () => {
|
|
|
547
673
|
};
|
|
548
674
|
|
|
549
675
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
550
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
676
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
551
677
|
updatedObjects: [{htMeta: newLocusHtMeta, data: newLocus}],
|
|
552
678
|
});
|
|
553
679
|
|
|
@@ -565,7 +691,7 @@ describe('plugin-meetings', () => {
|
|
|
565
691
|
...newLocus,
|
|
566
692
|
htMeta: newLocusHtMeta,
|
|
567
693
|
participants: [], // empty means there were no participant updates
|
|
568
|
-
jsSdkMeta: {removedParticipantIds: []}, // no participants were removed
|
|
694
|
+
jsSdkMeta: {removedParticipantIds: [], forceReplaceMembers: false}, // no participants were removed
|
|
569
695
|
});
|
|
570
696
|
});
|
|
571
697
|
|
|
@@ -580,7 +706,7 @@ describe('plugin-meetings', () => {
|
|
|
580
706
|
};
|
|
581
707
|
|
|
582
708
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
583
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
709
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
584
710
|
updatedObjects: [
|
|
585
711
|
{
|
|
586
712
|
htMeta: newLocusHtMeta,
|
|
@@ -611,7 +737,7 @@ describe('plugin-meetings', () => {
|
|
|
611
737
|
mediaShares: expectedLocusInfo.mediaShares,
|
|
612
738
|
embeddedApps: expectedLocusInfo.embeddedApps,
|
|
613
739
|
participants: [], // empty means there were no participant updates
|
|
614
|
-
jsSdkMeta: {removedParticipantIds: []}, // no participants were removed
|
|
740
|
+
jsSdkMeta: {removedParticipantIds: [], forceReplaceMembers: false}, // no participants were removed
|
|
615
741
|
...newLocus,
|
|
616
742
|
htMeta: newLocusHtMeta,
|
|
617
743
|
});
|
|
@@ -627,7 +753,7 @@ describe('plugin-meetings', () => {
|
|
|
627
753
|
};
|
|
628
754
|
|
|
629
755
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
630
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
756
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
631
757
|
updatedObjects: [
|
|
632
758
|
// first, a removal of LOCUS object
|
|
633
759
|
{htMeta: {elementId: {type: 'locus'}}, data: null},
|
|
@@ -650,7 +776,7 @@ describe('plugin-meetings', () => {
|
|
|
650
776
|
...newLocus,
|
|
651
777
|
htMeta: newLocusHtMeta,
|
|
652
778
|
participants: [], // empty means there were no participant updates
|
|
653
|
-
jsSdkMeta: {removedParticipantIds: []}, // no participants were removed
|
|
779
|
+
jsSdkMeta: {removedParticipantIds: [], forceReplaceMembers: false}, // no participants were removed
|
|
654
780
|
});
|
|
655
781
|
});
|
|
656
782
|
|
|
@@ -661,7 +787,7 @@ describe('plugin-meetings', () => {
|
|
|
661
787
|
const newLocusHtMeta = {elementId: {type: 'locus', version: 99}};
|
|
662
788
|
|
|
663
789
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
664
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
790
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
665
791
|
updatedObjects: [
|
|
666
792
|
// first, an update
|
|
667
793
|
{htMeta: newLocusHtMeta, data: newLocus},
|
|
@@ -690,7 +816,7 @@ describe('plugin-meetings', () => {
|
|
|
690
816
|
};
|
|
691
817
|
|
|
692
818
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
693
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
819
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
694
820
|
updatedObjects: [
|
|
695
821
|
// first, an update
|
|
696
822
|
{htMeta: {elementId: {type: 'locus'}}, data: newLocus1},
|
|
@@ -720,7 +846,7 @@ describe('plugin-meetings', () => {
|
|
|
720
846
|
};
|
|
721
847
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
722
848
|
// with 1 participant added, 1 updated, and 1 removed
|
|
723
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
849
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
724
850
|
updatedObjects: [
|
|
725
851
|
{htMeta: {elementId: {type: 'participant', id: 'fake-ht-participant-1'}}, data: null},
|
|
726
852
|
{
|
|
@@ -738,7 +864,7 @@ describe('plugin-meetings', () => {
|
|
|
738
864
|
assert.calledOnceWithExactly(onDeltaLocusStub, {
|
|
739
865
|
...expectedLocusInfo,
|
|
740
866
|
participants: [newParticipant, updatedParticipant2],
|
|
741
|
-
jsSdkMeta: {removedParticipantIds: ['fake-participant-1']},
|
|
867
|
+
jsSdkMeta: {removedParticipantIds: ['fake-participant-1'], forceReplaceMembers: false},
|
|
742
868
|
});
|
|
743
869
|
// and that the hashTreeObjectId2ParticipantId map was updated correctly
|
|
744
870
|
assert.isUndefined(locusInfo.hashTreeObjectId2ParticipantId.get('fake-ht-participant-1'));
|
|
@@ -764,7 +890,7 @@ describe('plugin-meetings', () => {
|
|
|
764
890
|
};
|
|
765
891
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
766
892
|
// with 1 participant added, 1 updated, and 1 removed
|
|
767
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
893
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
768
894
|
updatedObjects: [
|
|
769
895
|
{htMeta: {elementId: {type: 'mediashare', id: 'fake-ht-mediaShare-1'}}, data: null},
|
|
770
896
|
{
|
|
@@ -797,7 +923,7 @@ describe('plugin-meetings', () => {
|
|
|
797
923
|
};
|
|
798
924
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
799
925
|
// with 1 embedded app added, 1 updated, and 1 removed
|
|
800
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
926
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
801
927
|
updatedObjects: [
|
|
802
928
|
{htMeta: {elementId: {type: 'embeddedapp', id: 'fake-ht-embeddedApp-1'}}, data: null},
|
|
803
929
|
{
|
|
@@ -834,7 +960,7 @@ describe('plugin-meetings', () => {
|
|
|
834
960
|
};
|
|
835
961
|
|
|
836
962
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
837
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
963
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
838
964
|
updatedObjects: [
|
|
839
965
|
{
|
|
840
966
|
htMeta: {elementId: {type: 'mediashare', id: 'fake-ht-mediaShare-2'}},
|
|
@@ -873,7 +999,7 @@ describe('plugin-meetings', () => {
|
|
|
873
999
|
};
|
|
874
1000
|
|
|
875
1001
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
876
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
1002
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
877
1003
|
updatedObjects: [
|
|
878
1004
|
{
|
|
879
1005
|
htMeta: {elementId: {type: 'controlentry', id: 'control-1'}},
|
|
@@ -901,7 +1027,7 @@ describe('plugin-meetings', () => {
|
|
|
901
1027
|
|
|
902
1028
|
it('should process locus update correctly when CONTROL object is received with no data', () => {
|
|
903
1029
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
904
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
1030
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
905
1031
|
updatedObjects: [
|
|
906
1032
|
{
|
|
907
1033
|
htMeta: {elementId: {type: 'controlentry', id: 'some-control-id'}},
|
|
@@ -925,7 +1051,7 @@ describe('plugin-meetings', () => {
|
|
|
925
1051
|
const destroyStub = sinon.stub(locusInfo.webex.meetings, 'destroy');
|
|
926
1052
|
|
|
927
1053
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
928
|
-
locusInfoUpdateCallback(MEETING_ENDED);
|
|
1054
|
+
locusInfoUpdateCallback({updateType: MEETING_ENDED});
|
|
929
1055
|
|
|
930
1056
|
assert.calledOnceWithExactly(collectionGetStub, locusInfo.meetingId);
|
|
931
1057
|
assert.calledOnceWithExactly(
|
|
@@ -943,11 +1069,100 @@ describe('plugin-meetings', () => {
|
|
|
943
1069
|
const destroyStub = sinon.stub(locusInfo.webex.meetings, 'destroy');
|
|
944
1070
|
|
|
945
1071
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
946
|
-
locusInfoUpdateCallback(MEETING_ENDED);
|
|
1072
|
+
locusInfoUpdateCallback({updateType: MEETING_ENDED});
|
|
947
1073
|
|
|
948
1074
|
assert.calledOnceWithExactly(collectionGetStub, locusInfo.meetingId);
|
|
949
1075
|
assert.notCalled(destroyStub);
|
|
950
1076
|
});
|
|
1077
|
+
|
|
1078
|
+
it('should handle LOCUS_NOT_FOUND by calling syncMeetings with skipHashTreeSync', () => {
|
|
1079
|
+
const syncMeetingsStub = sinon.stub(locusInfo.webex.meetings, 'syncMeetings').resolves();
|
|
1080
|
+
|
|
1081
|
+
locusInfoUpdateCallback({updateType: LOCUS_NOT_FOUND});
|
|
1082
|
+
|
|
1083
|
+
assert.calledOnceWithExactly(syncMeetingsStub, {keepOnlyLocusMeetings: false, skipHashTreeSync: true});
|
|
1084
|
+
});
|
|
1085
|
+
|
|
1086
|
+
it('should handle LOCUS_NOT_FOUND and log error if syncMeetings fails', async () => {
|
|
1087
|
+
const syncError = new Error('sync failed');
|
|
1088
|
+
const syncMeetingsStub = sinon.stub(locusInfo.webex.meetings, 'syncMeetings').rejects(syncError);
|
|
1089
|
+
const logErrorStub = LoggerProxy.logger.error?.isSinonProxy
|
|
1090
|
+
? LoggerProxy.logger.error
|
|
1091
|
+
: sinon.stub(LoggerProxy.logger, 'error');
|
|
1092
|
+
|
|
1093
|
+
logErrorStub.resetHistory();
|
|
1094
|
+
|
|
1095
|
+
locusInfoUpdateCallback({updateType: LOCUS_NOT_FOUND});
|
|
1096
|
+
|
|
1097
|
+
assert.calledOnceWithExactly(syncMeetingsStub, {keepOnlyLocusMeetings: false, skipHashTreeSync: true});
|
|
1098
|
+
|
|
1099
|
+
// wait for the promise rejection to be handled
|
|
1100
|
+
await testUtils.flushPromises();
|
|
1101
|
+
|
|
1102
|
+
assert.calledOnce(logErrorStub);
|
|
1103
|
+
assert.match(
|
|
1104
|
+
logErrorStub.firstCall.args[0],
|
|
1105
|
+
/syncMeetings failed after LOCUS_NOT_FOUND/
|
|
1106
|
+
);
|
|
1107
|
+
});
|
|
1108
|
+
|
|
1109
|
+
it('should set forceReplaceMembers to true on the first update for a locusUrl (initializedFromHashTree is false)', () => {
|
|
1110
|
+
const createdHashTreeParser = locusInfo.hashTreeParsers.get('fake-locus-url');
|
|
1111
|
+
createdHashTreeParser.initializedFromHashTree = false;
|
|
1112
|
+
|
|
1113
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
1114
|
+
updatedObjects: [
|
|
1115
|
+
{
|
|
1116
|
+
htMeta: {elementId: {type: 'self'}},
|
|
1117
|
+
data: {id: 'new-self'},
|
|
1118
|
+
},
|
|
1119
|
+
],
|
|
1120
|
+
});
|
|
1121
|
+
|
|
1122
|
+
assert.calledOnce(onDeltaLocusStub);
|
|
1123
|
+
assert.equal(onDeltaLocusStub.firstCall.args[0].jsSdkMeta.forceReplaceMembers, true);
|
|
1124
|
+
assert.isTrue(createdHashTreeParser.initializedFromHashTree);
|
|
1125
|
+
});
|
|
1126
|
+
|
|
1127
|
+
it('should set forceReplaceMembers to false on subsequent updates (initializedFromHashTree is true)', () => {
|
|
1128
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
1129
|
+
updatedObjects: [
|
|
1130
|
+
{
|
|
1131
|
+
htMeta: {elementId: {type: 'self'}},
|
|
1132
|
+
data: {id: 'new-self'},
|
|
1133
|
+
},
|
|
1134
|
+
],
|
|
1135
|
+
});
|
|
1136
|
+
|
|
1137
|
+
assert.calledOnce(onDeltaLocusStub);
|
|
1138
|
+
assert.equal(onDeltaLocusStub.firstCall.args[0].jsSdkMeta.forceReplaceMembers, false);
|
|
1139
|
+
});
|
|
1140
|
+
|
|
1141
|
+
it('should copy participant data to self when participant matches self identity and state is LEFT with reason MOVED', () => {
|
|
1142
|
+
locusInfo.self = {id: 'fake-self', identity: 'user-123'};
|
|
1143
|
+
|
|
1144
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
1145
|
+
updatedObjects: [
|
|
1146
|
+
{
|
|
1147
|
+
htMeta: {elementId: {type: 'participant', id: 99}},
|
|
1148
|
+
data: {
|
|
1149
|
+
id: 'participant-matching-self',
|
|
1150
|
+
identity: 'user-123',
|
|
1151
|
+
state: 'LEFT',
|
|
1152
|
+
reason: 'MOVED',
|
|
1153
|
+
roles: ['MODERATOR'],
|
|
1154
|
+
},
|
|
1155
|
+
},
|
|
1156
|
+
],
|
|
1157
|
+
});
|
|
1158
|
+
|
|
1159
|
+
assert.calledOnce(onDeltaLocusStub);
|
|
1160
|
+
const passedLocus = onDeltaLocusStub.firstCall.args[0];
|
|
1161
|
+
|
|
1162
|
+
assert.equal(passedLocus.self.identity, 'user-123');
|
|
1163
|
+
assert.equal(passedLocus.self.state, 'LEFT');
|
|
1164
|
+
assert.equal(passedLocus.self.reason, 'MOVED');
|
|
1165
|
+
});
|
|
951
1166
|
});
|
|
952
1167
|
});
|
|
953
1168
|
|
|
@@ -1221,6 +1436,8 @@ describe('plugin-meetings', () => {
|
|
|
1221
1436
|
state: RECORDING_STATE.IDLE,
|
|
1222
1437
|
modifiedBy: 'George Kittle',
|
|
1223
1438
|
lastModified: 'TODAY',
|
|
1439
|
+
modifiedByServiceAppName: undefined,
|
|
1440
|
+
modifiedByServiceAppId: undefined,
|
|
1224
1441
|
}
|
|
1225
1442
|
);
|
|
1226
1443
|
});
|
|
@@ -1255,6 +1472,8 @@ describe('plugin-meetings', () => {
|
|
|
1255
1472
|
state: RECORDING_STATE.RECORDING,
|
|
1256
1473
|
modifiedBy: 'George Kittle',
|
|
1257
1474
|
lastModified: 'TODAY',
|
|
1475
|
+
modifiedByServiceAppName: undefined,
|
|
1476
|
+
modifiedByServiceAppId: undefined,
|
|
1258
1477
|
}
|
|
1259
1478
|
);
|
|
1260
1479
|
});
|
|
@@ -1290,6 +1509,8 @@ describe('plugin-meetings', () => {
|
|
|
1290
1509
|
state: RECORDING_STATE.PAUSED,
|
|
1291
1510
|
modifiedBy: 'George Kittle',
|
|
1292
1511
|
lastModified: 'TODAY',
|
|
1512
|
+
modifiedByServiceAppName: undefined,
|
|
1513
|
+
modifiedByServiceAppId: undefined,
|
|
1293
1514
|
}
|
|
1294
1515
|
);
|
|
1295
1516
|
});
|
|
@@ -1326,6 +1547,8 @@ describe('plugin-meetings', () => {
|
|
|
1326
1547
|
state: RECORDING_STATE.RESUMED,
|
|
1327
1548
|
modifiedBy: 'George Kittle',
|
|
1328
1549
|
lastModified: 'TODAY',
|
|
1550
|
+
modifiedByServiceAppName: undefined,
|
|
1551
|
+
modifiedByServiceAppId: undefined,
|
|
1329
1552
|
}
|
|
1330
1553
|
);
|
|
1331
1554
|
});
|
|
@@ -1361,6 +1584,44 @@ describe('plugin-meetings', () => {
|
|
|
1361
1584
|
state: RECORDING_STATE.IDLE,
|
|
1362
1585
|
modifiedBy: 'George Kittle',
|
|
1363
1586
|
lastModified: 'TODAY',
|
|
1587
|
+
modifiedByServiceAppName: undefined,
|
|
1588
|
+
modifiedByServiceAppId: undefined,
|
|
1589
|
+
}
|
|
1590
|
+
);
|
|
1591
|
+
});
|
|
1592
|
+
|
|
1593
|
+
it('should include service app fields in the recording event when present', () => {
|
|
1594
|
+
locusInfo.controls = {
|
|
1595
|
+
record: {
|
|
1596
|
+
recording: false,
|
|
1597
|
+
paused: false,
|
|
1598
|
+
meta: {
|
|
1599
|
+
lastModified: 'TODAY',
|
|
1600
|
+
modifiedBy: 'George Kittle',
|
|
1601
|
+
},
|
|
1602
|
+
},
|
|
1603
|
+
shareControl: {},
|
|
1604
|
+
transcribe: {},
|
|
1605
|
+
};
|
|
1606
|
+
newControls.record.recording = true;
|
|
1607
|
+
newControls.record.meta.modifiedByServiceAppName = 'My Bot';
|
|
1608
|
+
newControls.record.meta.modifiedByServiceAppId = 'app-id-123';
|
|
1609
|
+
locusInfo.emitScoped = sinon.stub();
|
|
1610
|
+
locusInfo.updateControls(newControls);
|
|
1611
|
+
|
|
1612
|
+
assert.calledWith(
|
|
1613
|
+
locusInfo.emitScoped,
|
|
1614
|
+
{
|
|
1615
|
+
file: 'locus-info',
|
|
1616
|
+
function: 'updateControls',
|
|
1617
|
+
},
|
|
1618
|
+
LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED,
|
|
1619
|
+
{
|
|
1620
|
+
state: RECORDING_STATE.RECORDING,
|
|
1621
|
+
modifiedBy: 'George Kittle',
|
|
1622
|
+
lastModified: 'TODAY',
|
|
1623
|
+
modifiedByServiceAppName: 'My Bot',
|
|
1624
|
+
modifiedByServiceAppId: 'app-id-123',
|
|
1364
1625
|
}
|
|
1365
1626
|
);
|
|
1366
1627
|
});
|
|
@@ -1794,6 +2055,53 @@ describe('plugin-meetings', () => {
|
|
|
1794
2055
|
});
|
|
1795
2056
|
|
|
1796
2057
|
describe('#updateSelf', () => {
|
|
2058
|
+
describe('LLM watchdog re-evaluation', () => {
|
|
2059
|
+
it('re-evaluates LLM watchdogs on all hash tree parsers when self transitions to joined', () => {
|
|
2060
|
+
const parserA = {reevaluateLlmWatchdogs: sinon.stub()};
|
|
2061
|
+
const parserB = {reevaluateLlmWatchdogs: sinon.stub()};
|
|
2062
|
+
locusInfo.hashTreeParsers.set('urlA', {parser: parserA});
|
|
2063
|
+
locusInfo.hashTreeParsers.set('urlB', {parser: parserB});
|
|
2064
|
+
|
|
2065
|
+
// start with LLM not expected (no self yet)
|
|
2066
|
+
locusInfo.parsedLocus.self = undefined;
|
|
2067
|
+
locusInfo.webex.internal.device.url = self.deviceUrl;
|
|
2068
|
+
|
|
2069
|
+
// the self fixture's joined device has state JOINED -> isLlmExpected becomes true
|
|
2070
|
+
locusInfo.updateSelf(cloneDeep(self));
|
|
2071
|
+
|
|
2072
|
+
assert.calledOnceWithExactly(parserA.reevaluateLlmWatchdogs);
|
|
2073
|
+
assert.calledOnceWithExactly(parserB.reevaluateLlmWatchdogs);
|
|
2074
|
+
});
|
|
2075
|
+
|
|
2076
|
+
it('does not re-evaluate LLM watchdogs when LLM was already expected before the update', () => {
|
|
2077
|
+
const parser = {reevaluateLlmWatchdogs: sinon.stub()};
|
|
2078
|
+
locusInfo.hashTreeParsers.set('urlA', {parser});
|
|
2079
|
+
locusInfo.webex.internal.device.url = self.deviceUrl;
|
|
2080
|
+
|
|
2081
|
+
// first update establishes the JOINED state (LLM already expected)
|
|
2082
|
+
locusInfo.updateSelf(cloneDeep(self));
|
|
2083
|
+
parser.reevaluateLlmWatchdogs.resetHistory();
|
|
2084
|
+
|
|
2085
|
+
// second update while already joined must not re-trigger re-evaluation
|
|
2086
|
+
locusInfo.updateSelf(cloneDeep(self));
|
|
2087
|
+
|
|
2088
|
+
assert.notCalled(parser.reevaluateLlmWatchdogs);
|
|
2089
|
+
});
|
|
2090
|
+
|
|
2091
|
+
it('does not re-evaluate LLM watchdogs when the self update does not make LLM expected', () => {
|
|
2092
|
+
const parser = {reevaluateLlmWatchdogs: sinon.stub()};
|
|
2093
|
+
locusInfo.hashTreeParsers.set('urlA', {parser});
|
|
2094
|
+
|
|
2095
|
+
locusInfo.parsedLocus.self = undefined;
|
|
2096
|
+
// device url does not match any of self's devices -> joinedWith is undefined -> not expected
|
|
2097
|
+
locusInfo.webex.internal.device.url = 'https://some-other-device-url.com';
|
|
2098
|
+
|
|
2099
|
+
locusInfo.updateSelf(cloneDeep(self));
|
|
2100
|
+
|
|
2101
|
+
assert.notCalled(parser.reevaluateLlmWatchdogs);
|
|
2102
|
+
});
|
|
2103
|
+
});
|
|
2104
|
+
|
|
1797
2105
|
it('should trigger SELF_MEETING_BRB_CHANGED when brb state changed', () => {
|
|
1798
2106
|
locusInfo.self = undefined;
|
|
1799
2107
|
|
|
@@ -1956,7 +2264,7 @@ describe('plugin-meetings', () => {
|
|
|
1956
2264
|
function: 'updateSelf',
|
|
1957
2265
|
},
|
|
1958
2266
|
LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED,
|
|
1959
|
-
{muted: true, unmuteAllowed: true}
|
|
2267
|
+
{muted: true, unmuteAllowed: true, modifiedBy: null}
|
|
1960
2268
|
);
|
|
1961
2269
|
|
|
1962
2270
|
// but sometimes "previous self" is defined, but without controls.audio.muted, so we test this here:
|
|
@@ -1971,7 +2279,7 @@ describe('plugin-meetings', () => {
|
|
|
1971
2279
|
function: 'updateSelf',
|
|
1972
2280
|
},
|
|
1973
2281
|
LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED,
|
|
1974
|
-
{muted: true, unmuteAllowed: true}
|
|
2282
|
+
{muted: true, unmuteAllowed: true, modifiedBy: null}
|
|
1975
2283
|
);
|
|
1976
2284
|
});
|
|
1977
2285
|
|
|
@@ -2030,7 +2338,7 @@ describe('plugin-meetings', () => {
|
|
|
2030
2338
|
function: 'updateSelf',
|
|
2031
2339
|
},
|
|
2032
2340
|
LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED,
|
|
2033
|
-
{muted: true, unmuteAllowed: true}
|
|
2341
|
+
{muted: true, unmuteAllowed: true, modifiedBy: null}
|
|
2034
2342
|
);
|
|
2035
2343
|
});
|
|
2036
2344
|
|
|
@@ -2169,7 +2477,7 @@ describe('plugin-meetings', () => {
|
|
|
2169
2477
|
function: 'updateSelf',
|
|
2170
2478
|
},
|
|
2171
2479
|
LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED,
|
|
2172
|
-
{muted: true, unmuteAllowed: false}
|
|
2480
|
+
{muted: true, unmuteAllowed: false, modifiedBy: null}
|
|
2173
2481
|
);
|
|
2174
2482
|
|
|
2175
2483
|
// now change only disallowUnmute
|
|
@@ -2187,7 +2495,28 @@ describe('plugin-meetings', () => {
|
|
|
2187
2495
|
function: 'updateSelf',
|
|
2188
2496
|
},
|
|
2189
2497
|
LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED,
|
|
2190
|
-
{muted: true, unmuteAllowed: true}
|
|
2498
|
+
{muted: true, unmuteAllowed: true, modifiedBy: null}
|
|
2499
|
+
);
|
|
2500
|
+
});
|
|
2501
|
+
|
|
2502
|
+
it('should include modifiedBy in payload when muted by host', () => {
|
|
2503
|
+
locusInfo.webex.internal.device.url = self.deviceUrl;
|
|
2504
|
+
locusInfo.updateSelf(self);
|
|
2505
|
+
const newSelf = cloneDeep(self);
|
|
2506
|
+
newSelf.controls.audio.muted = true;
|
|
2507
|
+
newSelf.controls.audio.meta = {modifiedBy: 'host-uuid-123'};
|
|
2508
|
+
|
|
2509
|
+
locusInfo.emitScoped = sinon.stub();
|
|
2510
|
+
locusInfo.updateSelf(newSelf);
|
|
2511
|
+
|
|
2512
|
+
assert.calledWith(
|
|
2513
|
+
locusInfo.emitScoped,
|
|
2514
|
+
{
|
|
2515
|
+
file: 'locus-info',
|
|
2516
|
+
function: 'updateSelf',
|
|
2517
|
+
},
|
|
2518
|
+
LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED,
|
|
2519
|
+
{muted: true, unmuteAllowed: true, modifiedBy: 'host-uuid-123'}
|
|
2191
2520
|
);
|
|
2192
2521
|
});
|
|
2193
2522
|
|
|
@@ -2196,6 +2525,33 @@ describe('plugin-meetings', () => {
|
|
|
2196
2525
|
locusInfo.updateSelf(self);
|
|
2197
2526
|
const selfWithLocalUnmuteRequired = cloneDeep(self);
|
|
2198
2527
|
|
|
2528
|
+
selfWithLocalUnmuteRequired.controls.audio.muted = false;
|
|
2529
|
+
selfWithLocalUnmuteRequired.controls.audio.localAudioUnmuteRequired = true;
|
|
2530
|
+
selfWithLocalUnmuteRequired.controls.audio.meta = {modifiedBy: 'host-uuid-123'};
|
|
2531
|
+
|
|
2532
|
+
locusInfo.emitScoped = sinon.stub();
|
|
2533
|
+
locusInfo.updateSelf(selfWithLocalUnmuteRequired);
|
|
2534
|
+
|
|
2535
|
+
assert.calledWith(
|
|
2536
|
+
locusInfo.emitScoped,
|
|
2537
|
+
{
|
|
2538
|
+
file: 'locus-info',
|
|
2539
|
+
function: 'updateSelf',
|
|
2540
|
+
},
|
|
2541
|
+
LOCUSINFO.EVENTS.LOCAL_UNMUTE_REQUIRED,
|
|
2542
|
+
{
|
|
2543
|
+
muted: false,
|
|
2544
|
+
unmuteAllowed: true,
|
|
2545
|
+
modifiedBy: 'host-uuid-123',
|
|
2546
|
+
}
|
|
2547
|
+
);
|
|
2548
|
+
});
|
|
2549
|
+
|
|
2550
|
+
it('should set modifiedBy to null on LOCAL_UNMUTE_REQUIRED when it is unavailable', () => {
|
|
2551
|
+
locusInfo.webex.internal.device.url = self.deviceUrl;
|
|
2552
|
+
locusInfo.updateSelf(self);
|
|
2553
|
+
const selfWithLocalUnmuteRequired = cloneDeep(self);
|
|
2554
|
+
|
|
2199
2555
|
selfWithLocalUnmuteRequired.controls.audio.muted = false;
|
|
2200
2556
|
selfWithLocalUnmuteRequired.controls.audio.localAudioUnmuteRequired = true;
|
|
2201
2557
|
|
|
@@ -2212,6 +2568,7 @@ describe('plugin-meetings', () => {
|
|
|
2212
2568
|
{
|
|
2213
2569
|
muted: false,
|
|
2214
2570
|
unmuteAllowed: true,
|
|
2571
|
+
modifiedBy: null,
|
|
2215
2572
|
}
|
|
2216
2573
|
);
|
|
2217
2574
|
});
|
|
@@ -2637,6 +2994,10 @@ describe('plugin-meetings', () => {
|
|
|
2637
2994
|
|
|
2638
2995
|
let expectedMeeting;
|
|
2639
2996
|
|
|
2997
|
+
// simulate that updateSelf has been called previously (as happens in production)
|
|
2998
|
+
// so that parsedLocus.self reflects the joined state
|
|
2999
|
+
locusInfo.parsedLocus.self = {state: 'JOINED'};
|
|
3000
|
+
|
|
2640
3001
|
/*
|
|
2641
3002
|
When the event is triggered, it is required that the meeting has already
|
|
2642
3003
|
been updated. This is why the meeting is being checked within the stubbed event emitter
|
|
@@ -2647,6 +3008,7 @@ describe('plugin-meetings', () => {
|
|
|
2647
3008
|
|
|
2648
3009
|
// set the info initially as locusInfo.info starts as undefined
|
|
2649
3010
|
expectedMeeting = {
|
|
3011
|
+
attendee: {},
|
|
2650
3012
|
coHost: {
|
|
2651
3013
|
LOWER_SOMEONE_ELSES_HAND: true,
|
|
2652
3014
|
},
|
|
@@ -2655,10 +3017,12 @@ describe('plugin-meetings', () => {
|
|
|
2655
3017
|
moderator: {
|
|
2656
3018
|
LOWER_SOMEONE_ELSES_HAND: true,
|
|
2657
3019
|
},
|
|
3020
|
+
panelist: {},
|
|
2658
3021
|
policy: {
|
|
2659
3022
|
LOCK_STATUS_UNLOCKED: true,
|
|
2660
3023
|
ROSTER_IN_MEETING: true,
|
|
2661
3024
|
},
|
|
3025
|
+
presenter: {},
|
|
2662
3026
|
userDisplayHints: ['ROSTER_IN_MEETING', 'LOCK_STATUS_UNLOCKED'],
|
|
2663
3027
|
};
|
|
2664
3028
|
locusInfo.updateMeetingInfo(initialInfo, self);
|
|
@@ -2673,6 +3037,7 @@ describe('plugin-meetings', () => {
|
|
|
2673
3037
|
|
|
2674
3038
|
// Updating with different info should trigger the event
|
|
2675
3039
|
expectedMeeting = {
|
|
3040
|
+
attendee: {},
|
|
2676
3041
|
coHost: {
|
|
2677
3042
|
LOWER_SOMEONE_ELSES_HAND: true,
|
|
2678
3043
|
LOCK_CONTROL_LOCK: true,
|
|
@@ -2682,10 +3047,12 @@ describe('plugin-meetings', () => {
|
|
|
2682
3047
|
moderator: {
|
|
2683
3048
|
LOWER_SOMEONE_ELSES_HAND: true,
|
|
2684
3049
|
},
|
|
3050
|
+
panelist: {},
|
|
2685
3051
|
policy: {
|
|
2686
3052
|
LOCK_STATUS_UNLOCKED: true,
|
|
2687
3053
|
ROSTER_IN_MEETING: true,
|
|
2688
3054
|
},
|
|
3055
|
+
presenter: {},
|
|
2689
3056
|
userDisplayHints: ['ROSTER_IN_MEETING', 'LOCK_STATUS_UNLOCKED'],
|
|
2690
3057
|
};
|
|
2691
3058
|
locusInfo.updateMeetingInfo(newInfo, self);
|
|
@@ -2694,6 +3061,7 @@ describe('plugin-meetings', () => {
|
|
|
2694
3061
|
|
|
2695
3062
|
// update it with the same info
|
|
2696
3063
|
expectedMeeting = {
|
|
3064
|
+
attendee: {},
|
|
2697
3065
|
coHost: {
|
|
2698
3066
|
LOWER_SOMEONE_ELSES_HAND: true,
|
|
2699
3067
|
LOCK_CONTROL_LOCK: true,
|
|
@@ -2703,10 +3071,12 @@ describe('plugin-meetings', () => {
|
|
|
2703
3071
|
moderator: {
|
|
2704
3072
|
LOWER_SOMEONE_ELSES_HAND: true,
|
|
2705
3073
|
},
|
|
3074
|
+
panelist: {},
|
|
2706
3075
|
policy: {
|
|
2707
3076
|
LOCK_STATUS_UNLOCKED: true,
|
|
2708
3077
|
ROSTER_IN_MEETING: true,
|
|
2709
3078
|
},
|
|
3079
|
+
presenter: {},
|
|
2710
3080
|
userDisplayHints: ['ROSTER_IN_MEETING', 'LOCK_STATUS_UNLOCKED'],
|
|
2711
3081
|
};
|
|
2712
3082
|
locusInfo.updateMeetingInfo(newInfo, self);
|
|
@@ -2721,6 +3091,7 @@ describe('plugin-meetings', () => {
|
|
|
2721
3091
|
hasRole: true,
|
|
2722
3092
|
});
|
|
2723
3093
|
expectedMeeting = {
|
|
3094
|
+
attendee: {},
|
|
2724
3095
|
coHost: {
|
|
2725
3096
|
LOWER_SOMEONE_ELSES_HAND: true,
|
|
2726
3097
|
LOCK_CONTROL_LOCK: true,
|
|
@@ -2730,10 +3101,12 @@ describe('plugin-meetings', () => {
|
|
|
2730
3101
|
moderator: {
|
|
2731
3102
|
LOWER_SOMEONE_ELSES_HAND: true,
|
|
2732
3103
|
},
|
|
3104
|
+
panelist: {},
|
|
2733
3105
|
policy: {
|
|
2734
3106
|
LOCK_STATUS_UNLOCKED: true,
|
|
2735
3107
|
ROSTER_IN_MEETING: true,
|
|
2736
3108
|
},
|
|
3109
|
+
presenter: {},
|
|
2737
3110
|
userDisplayHints: [
|
|
2738
3111
|
'ROSTER_IN_MEETING',
|
|
2739
3112
|
'LOCK_STATUS_UNLOCKED',
|
|
@@ -2776,6 +3149,46 @@ describe('plugin-meetings', () => {
|
|
|
2776
3149
|
// since self is not passed to updateMeetingInfo, MEETING_INFO_UPDATED should be triggered with isIntializing: true
|
|
2777
3150
|
checkMeetingInfoUpdatedCalledForRoles(true, {isInitializing: true});
|
|
2778
3151
|
});
|
|
3152
|
+
|
|
3153
|
+
// joined-section hints (like ROSTER_IN_MEETING) are filtered out while not joined, so they
|
|
3154
|
+
// are a good proxy for verifying that userDisplayHints get recomputed on a join transition
|
|
3155
|
+
[
|
|
3156
|
+
{
|
|
3157
|
+
name: 'the JOINED delta carries the info section',
|
|
3158
|
+
getSecondInfo: (info) => info,
|
|
3159
|
+
},
|
|
3160
|
+
{
|
|
3161
|
+
name: 'the JOINED delta omits the info section (falls back to stored info)',
|
|
3162
|
+
getSecondInfo: () => undefined,
|
|
3163
|
+
},
|
|
3164
|
+
].forEach(({name, getSecondInfo}) => {
|
|
3165
|
+
it(`recomputes userDisplayHints when self transitions to JOINED with unchanged roles and ${name}`, () => {
|
|
3166
|
+
const info = cloneDeep(meetingInfo); // joined: ['ROSTER_IN_MEETING', 'LOCK_STATUS_UNLOCKED']
|
|
3167
|
+
|
|
3168
|
+
const notJoinedSelf = cloneDeep(self);
|
|
3169
|
+
notJoinedSelf.state = 'IDLE';
|
|
3170
|
+
notJoinedSelf.controls.role.roles = [];
|
|
3171
|
+
|
|
3172
|
+
const joinedSelf = cloneDeep(self);
|
|
3173
|
+
joinedSelf.state = 'JOINED';
|
|
3174
|
+
joinedSelf.controls.role.roles = [];
|
|
3175
|
+
|
|
3176
|
+
sinon.stub(locusInfo, 'emitScoped');
|
|
3177
|
+
|
|
3178
|
+
// first update while not joined: joined-section hints are filtered out
|
|
3179
|
+
locusInfo.updateMeetingInfo(info, notJoinedSelf);
|
|
3180
|
+
assert.notInclude(locusInfo.parsedLocus.info.userDisplayHints, 'ROSTER_IN_MEETING');
|
|
3181
|
+
assert.notInclude(locusInfo.parsedLocus.info.userDisplayHints, 'LOCK_STATUS_UNLOCKED');
|
|
3182
|
+
|
|
3183
|
+
// self transitions to JOINED - info and roles are unchanged
|
|
3184
|
+
locusInfo.updateMeetingInfo(getSecondInfo(info), joinedSelf);
|
|
3185
|
+
|
|
3186
|
+
// the hints must be recomputed with the new joined state
|
|
3187
|
+
assert.include(locusInfo.parsedLocus.info.userDisplayHints, 'ROSTER_IN_MEETING');
|
|
3188
|
+
assert.include(locusInfo.parsedLocus.info.userDisplayHints, 'LOCK_STATUS_UNLOCKED');
|
|
3189
|
+
checkMeetingInfoUpdatedCalled(true, {isInitializing: false});
|
|
3190
|
+
});
|
|
3191
|
+
});
|
|
2779
3192
|
});
|
|
2780
3193
|
|
|
2781
3194
|
describe('#updateMediaShares', () => {
|
|
@@ -2969,47 +3382,627 @@ describe('plugin-meetings', () => {
|
|
|
2969
3382
|
});
|
|
2970
3383
|
});
|
|
2971
3384
|
|
|
2972
|
-
describe('#
|
|
2973
|
-
|
|
2974
|
-
const fakeLocus = {eventType: LOCUSEVENT.DIFFERENCE};
|
|
3385
|
+
describe('#createHashTreeParser', () => {
|
|
3386
|
+
let HashTreeParserStub;
|
|
2975
3387
|
|
|
2976
|
-
|
|
3388
|
+
beforeEach(() => {
|
|
3389
|
+
HashTreeParserStub = sinon
|
|
3390
|
+
.stub(HashTreeParserModule, 'default')
|
|
3391
|
+
.returns({
|
|
3392
|
+
initializeFromMessage: sinon.stub().resolves(),
|
|
3393
|
+
initializeFromGetLociResponse: sinon.stub().resolves(),
|
|
3394
|
+
state: 'active',
|
|
3395
|
+
stop: sinon.stub(),
|
|
3396
|
+
handleMessage: sinon.stub(),
|
|
3397
|
+
});
|
|
3398
|
+
});
|
|
2977
3399
|
|
|
2978
|
-
|
|
3400
|
+
const setupParserViaInitialSetup = async (locusUrl = 'http://locus-url-A.com') => {
|
|
3401
|
+
await locusInfo.initialSetup({
|
|
3402
|
+
trigger: 'locus-message',
|
|
3403
|
+
hashTreeMessage: {
|
|
3404
|
+
locusUrl,
|
|
3405
|
+
locusStateElements: [
|
|
3406
|
+
{
|
|
3407
|
+
htMeta: {elementId: {type: 'Metadata'}},
|
|
3408
|
+
data: {visibleDataSets: [{name: 'dataset1', url: 'test-url'}]},
|
|
3409
|
+
},
|
|
3410
|
+
],
|
|
3411
|
+
dataSets: [{name: 'dataset1', url: 'test-url'}],
|
|
3412
|
+
},
|
|
3413
|
+
});
|
|
3414
|
+
};
|
|
2979
3415
|
|
|
2980
|
-
|
|
3416
|
+
it('should stop existing active parsers when creating a new one', async () => {
|
|
3417
|
+
await setupParserViaInitialSetup('http://locus-url-A.com');
|
|
3418
|
+
|
|
3419
|
+
const firstParser = locusInfo.hashTreeParsers.get('http://locus-url-A.com').parser;
|
|
3420
|
+
|
|
3421
|
+
await setupParserViaInitialSetup('http://locus-url-B.com');
|
|
3422
|
+
|
|
3423
|
+
assert.calledOnce(firstParser.stop);
|
|
2981
3424
|
});
|
|
2982
|
-
it('calls hash tree parser when we are using hash trees', () => {
|
|
2983
|
-
const fakeLocus = {eventType: LOCUSEVENT.DIFFERENCE};
|
|
2984
|
-
const fakeDataSets = [{name: 'dataset1', url: 'http://test.com'}];
|
|
2985
|
-
const responseBody = {locus: fakeLocus, dataSets: fakeDataSets};
|
|
2986
3425
|
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
handleLocusUpdate: sinon.stub(),
|
|
2990
|
-
};
|
|
2991
|
-
locusInfo.hashTreeParser = mockHashTreeParser;
|
|
3426
|
+
it('should set replacedAt on existing entries when replacedAt is provided', async () => {
|
|
3427
|
+
await setupParserViaInitialSetup('http://locus-url-A.com');
|
|
2992
3428
|
|
|
2993
|
-
|
|
3429
|
+
// Call createHashTreeParser with replacedAt via parse -> handleHashTreeParserSwitch
|
|
3430
|
+
// which calls createHashTreeParser with replacedAt from the self element
|
|
3431
|
+
locusInfo.webex.internal.device.url = 'http://device-url.com';
|
|
3432
|
+
const message = {
|
|
3433
|
+
locusUrl: 'http://locus-url-B.com',
|
|
3434
|
+
locusStateElements: [
|
|
3435
|
+
{
|
|
3436
|
+
htMeta: {elementId: {type: 'Metadata'}},
|
|
3437
|
+
data: {visibleDataSets: [{name: 'dataset1', url: 'test-url'}]},
|
|
3438
|
+
},
|
|
3439
|
+
{
|
|
3440
|
+
htMeta: {elementId: {type: 'Self'}},
|
|
3441
|
+
data: {
|
|
3442
|
+
devices: [{url: 'http://device-url.com', replaces: [{locusUrl: 'http://locus-url-A.com', replacedAt: '2026-01-01T00:00:00Z'}]}],
|
|
3443
|
+
},
|
|
3444
|
+
},
|
|
3445
|
+
],
|
|
3446
|
+
dataSets: [{name: 'dataset1', url: 'test-url'}],
|
|
3447
|
+
};
|
|
2994
3448
|
|
|
2995
|
-
locusInfo.
|
|
3449
|
+
locusInfo.parse(mockMeeting, {
|
|
3450
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3451
|
+
stateElementsMessage: message,
|
|
3452
|
+
});
|
|
2996
3453
|
|
|
2997
|
-
assert.
|
|
3454
|
+
assert.equal(locusInfo.hashTreeParsers.get('http://locus-url-A.com').replacedAt, '2026-01-01T00:00:00Z');
|
|
2998
3455
|
});
|
|
2999
|
-
});
|
|
3000
3456
|
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
let sandbox = null;
|
|
3004
|
-
let locusParser = null;
|
|
3005
|
-
let fakeLocus = null;
|
|
3457
|
+
it('should not set replacedAt on existing entries when replacedAt is not provided', async () => {
|
|
3458
|
+
await setupParserViaInitialSetup('http://locus-url-A.com');
|
|
3006
3459
|
|
|
3007
|
-
|
|
3008
|
-
locusParser = locusInfo.locusParser;
|
|
3009
|
-
sandbox = sinon.createSandbox();
|
|
3460
|
+
await setupParserViaInitialSetup('http://locus-url-B.com');
|
|
3010
3461
|
|
|
3011
|
-
|
|
3012
|
-
|
|
3462
|
+
assert.isUndefined(locusInfo.hashTreeParsers.get('http://locus-url-A.com').replacedAt);
|
|
3463
|
+
});
|
|
3464
|
+
|
|
3465
|
+
it('should store the new parser in hashTreeParsers map with the correct locusUrl key', async () => {
|
|
3466
|
+
await setupParserViaInitialSetup('http://locus-url-A.com');
|
|
3467
|
+
|
|
3468
|
+
assert.isTrue(locusInfo.hashTreeParsers.has('http://locus-url-A.com'));
|
|
3469
|
+
assert.isDefined(locusInfo.hashTreeParsers.get('http://locus-url-A.com').parser);
|
|
3470
|
+
});
|
|
3471
|
+
|
|
3472
|
+
it('should clear hashTreeObjectId2ParticipantId when creating a new parser', async () => {
|
|
3473
|
+
await setupParserViaInitialSetup('http://locus-url-A.com');
|
|
3474
|
+
locusInfo.hashTreeObjectId2ParticipantId.set(1, 'participant-1');
|
|
3475
|
+
|
|
3476
|
+
await setupParserViaInitialSetup('http://locus-url-B.com');
|
|
3477
|
+
|
|
3478
|
+
assert.equal(locusInfo.hashTreeObjectId2ParticipantId.size, 0);
|
|
3479
|
+
});
|
|
3480
|
+
|
|
3481
|
+
it('should not stop already stopped parsers', async () => {
|
|
3482
|
+
await setupParserViaInitialSetup('http://locus-url-A.com');
|
|
3483
|
+
const firstParser = locusInfo.hashTreeParsers.get('http://locus-url-A.com').parser;
|
|
3484
|
+
firstParser.state = 'stopped';
|
|
3485
|
+
|
|
3486
|
+
await setupParserViaInitialSetup('http://locus-url-B.com');
|
|
3487
|
+
|
|
3488
|
+
assert.notCalled(firstParser.stop);
|
|
3489
|
+
});
|
|
3490
|
+
});
|
|
3491
|
+
|
|
3492
|
+
describe('#handleHashTreeParserSwitch', () => {
|
|
3493
|
+
const deviceUrl = 'http://device-url.com';
|
|
3494
|
+
const locusUrlA = 'http://locus-url-A.com';
|
|
3495
|
+
const locusUrlB = 'http://locus-url-B.com';
|
|
3496
|
+
|
|
3497
|
+
let HashTreeParserStub;
|
|
3498
|
+
|
|
3499
|
+
const createMockParser = (state = 'active') => ({
|
|
3500
|
+
state,
|
|
3501
|
+
stop: sinon.stub(),
|
|
3502
|
+
resumeFromMessage: sinon.stub(),
|
|
3503
|
+
handleMessage: sinon.stub(),
|
|
3504
|
+
});
|
|
3505
|
+
|
|
3506
|
+
const createSelfElementWithReplaces = (replacedLocusUrl, replacedAt) => ({
|
|
3507
|
+
htMeta: {elementId: {type: 'Self'}},
|
|
3508
|
+
data: {
|
|
3509
|
+
deviceUrl,
|
|
3510
|
+
devices: [{url: deviceUrl, replaces: [{locusUrl: replacedLocusUrl, replacedAt}]}],
|
|
3511
|
+
},
|
|
3512
|
+
});
|
|
3513
|
+
|
|
3514
|
+
const createMetadataElement = () => ({
|
|
3515
|
+
htMeta: {elementId: {type: 'Metadata'}},
|
|
3516
|
+
data: {visibleDataSets: [{name: 'dataset1', url: 'test-url'}]},
|
|
3517
|
+
});
|
|
3518
|
+
|
|
3519
|
+
beforeEach(() => {
|
|
3520
|
+
locusInfo.webex.internal.device.url = deviceUrl;
|
|
3521
|
+
HashTreeParserStub = sinon
|
|
3522
|
+
.stub(HashTreeParserModule, 'default')
|
|
3523
|
+
.returns(createMockParser());
|
|
3524
|
+
});
|
|
3525
|
+
|
|
3526
|
+
it('should create a new parser when no entry exists for locusUrl and metadata has visibleDataSets', () => {
|
|
3527
|
+
// set up an existing parser for a different url
|
|
3528
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: createMockParser(), initializedFromHashTree: true});
|
|
3529
|
+
|
|
3530
|
+
const message = {
|
|
3531
|
+
locusUrl: locusUrlB,
|
|
3532
|
+
locusStateElements: [createMetadataElement()],
|
|
3533
|
+
dataSets: [{name: 'dataset1', url: 'test-url'}],
|
|
3534
|
+
};
|
|
3535
|
+
|
|
3536
|
+
locusInfo.parse(mockMeeting, {
|
|
3537
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3538
|
+
stateElementsMessage: message,
|
|
3539
|
+
});
|
|
3540
|
+
|
|
3541
|
+
assert.isTrue(locusInfo.hashTreeParsers.has(locusUrlB));
|
|
3542
|
+
});
|
|
3543
|
+
|
|
3544
|
+
it('should return true when no entry exists even if no metadata is available', () => {
|
|
3545
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: createMockParser(), initializedFromHashTree: true});
|
|
3546
|
+
const parserA = locusInfo.hashTreeParsers.get(locusUrlA).parser;
|
|
3547
|
+
|
|
3548
|
+
const message = {
|
|
3549
|
+
locusUrl: locusUrlB,
|
|
3550
|
+
locusStateElements: [],
|
|
3551
|
+
dataSets: [],
|
|
3552
|
+
};
|
|
3553
|
+
|
|
3554
|
+
locusInfo.parse(mockMeeting, {
|
|
3555
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3556
|
+
stateElementsMessage: message,
|
|
3557
|
+
});
|
|
3558
|
+
|
|
3559
|
+
// no new parser created since no metadata
|
|
3560
|
+
assert.isFalse(locusInfo.hashTreeParsers.has(locusUrlB));
|
|
3561
|
+
// the existing parser's handleMessage should NOT have been called
|
|
3562
|
+
assert.notCalled(parserA.handleMessage);
|
|
3563
|
+
});
|
|
3564
|
+
|
|
3565
|
+
it('should resume a stopped parser when replaces info is newer', () => {
|
|
3566
|
+
const parserA = createMockParser('stopped');
|
|
3567
|
+
const parserB = createMockParser('active');
|
|
3568
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, replacedAt: '2026-01-01T00:00:00Z', initializedFromHashTree: true});
|
|
3569
|
+
locusInfo.hashTreeParsers.set(locusUrlB, {parser: parserB, initializedFromHashTree: true});
|
|
3570
|
+
|
|
3571
|
+
const message = {
|
|
3572
|
+
locusUrl: locusUrlA,
|
|
3573
|
+
locusStateElements: [
|
|
3574
|
+
createSelfElementWithReplaces(locusUrlB, '2026-02-01T00:00:00Z'),
|
|
3575
|
+
createMetadataElement(),
|
|
3576
|
+
],
|
|
3577
|
+
dataSets: [{name: 'dataset1', url: 'test-url'}],
|
|
3578
|
+
};
|
|
3579
|
+
|
|
3580
|
+
locusInfo.parse(mockMeeting, {
|
|
3581
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3582
|
+
stateElementsMessage: message,
|
|
3583
|
+
});
|
|
3584
|
+
|
|
3585
|
+
assert.calledOnce(parserA.resumeFromMessage);
|
|
3586
|
+
assert.calledOnce(parserB.stop);
|
|
3587
|
+
});
|
|
3588
|
+
|
|
3589
|
+
it('should not resume a stopped parser when replaces info is not newer', () => {
|
|
3590
|
+
const parserA = createMockParser('stopped');
|
|
3591
|
+
const parserB = createMockParser('active');
|
|
3592
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, replacedAt: '2026-03-01T00:00:00Z', initializedFromHashTree: true});
|
|
3593
|
+
locusInfo.hashTreeParsers.set(locusUrlB, {parser: parserB, initializedFromHashTree: true});
|
|
3594
|
+
|
|
3595
|
+
const message = {
|
|
3596
|
+
locusUrl: locusUrlA,
|
|
3597
|
+
locusStateElements: [
|
|
3598
|
+
createSelfElementWithReplaces(locusUrlB, '2026-01-01T00:00:00Z'),
|
|
3599
|
+
],
|
|
3600
|
+
dataSets: [{name: 'dataset1', url: 'test-url'}],
|
|
3601
|
+
};
|
|
3602
|
+
|
|
3603
|
+
locusInfo.parse(mockMeeting, {
|
|
3604
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3605
|
+
stateElementsMessage: message,
|
|
3606
|
+
});
|
|
3607
|
+
|
|
3608
|
+
assert.notCalled(parserA.resumeFromMessage);
|
|
3609
|
+
assert.notCalled(parserB.stop);
|
|
3610
|
+
});
|
|
3611
|
+
|
|
3612
|
+
it('should return true for a stopped parser with no replaces info', () => {
|
|
3613
|
+
const parserA = createMockParser('stopped');
|
|
3614
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, initializedFromHashTree: true});
|
|
3615
|
+
|
|
3616
|
+
const message = {
|
|
3617
|
+
locusUrl: locusUrlA,
|
|
3618
|
+
locusStateElements: [],
|
|
3619
|
+
dataSets: [],
|
|
3620
|
+
};
|
|
3621
|
+
|
|
3622
|
+
locusInfo.parse(mockMeeting, {
|
|
3623
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3624
|
+
stateElementsMessage: message,
|
|
3625
|
+
});
|
|
3626
|
+
|
|
3627
|
+
assert.notCalled(parserA.resumeFromMessage);
|
|
3628
|
+
assert.notCalled(parserA.handleMessage);
|
|
3629
|
+
});
|
|
3630
|
+
|
|
3631
|
+
it('should return false when the entry exists and parser is active', () => {
|
|
3632
|
+
const parserA = createMockParser('active');
|
|
3633
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, initializedFromHashTree: true});
|
|
3634
|
+
|
|
3635
|
+
const message = {
|
|
3636
|
+
locusUrl: locusUrlA,
|
|
3637
|
+
locusStateElements: [],
|
|
3638
|
+
dataSets: [],
|
|
3639
|
+
};
|
|
3640
|
+
|
|
3641
|
+
locusInfo.parse(mockMeeting, {
|
|
3642
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3643
|
+
stateElementsMessage: message,
|
|
3644
|
+
});
|
|
3645
|
+
|
|
3646
|
+
assert.calledOnceWithExactly(parserA.handleMessage, message);
|
|
3647
|
+
});
|
|
3648
|
+
|
|
3649
|
+
it('should pass replacedAt from replaces to createHashTreeParser when creating a new parser', () => {
|
|
3650
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: createMockParser(), initializedFromHashTree: true});
|
|
3651
|
+
|
|
3652
|
+
const message = {
|
|
3653
|
+
locusUrl: locusUrlB,
|
|
3654
|
+
locusStateElements: [
|
|
3655
|
+
createMetadataElement(),
|
|
3656
|
+
createSelfElementWithReplaces(locusUrlA, '2026-05-01T00:00:00Z'),
|
|
3657
|
+
],
|
|
3658
|
+
dataSets: [{name: 'dataset1', url: 'test-url'}],
|
|
3659
|
+
};
|
|
3660
|
+
|
|
3661
|
+
locusInfo.parse(mockMeeting, {
|
|
3662
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3663
|
+
stateElementsMessage: message,
|
|
3664
|
+
});
|
|
3665
|
+
|
|
3666
|
+
assert.isTrue(locusInfo.hashTreeParsers.has(locusUrlB));
|
|
3667
|
+
assert.equal(locusInfo.hashTreeParsers.get(locusUrlA).replacedAt, '2026-05-01T00:00:00Z');
|
|
3668
|
+
});
|
|
3669
|
+
});
|
|
3670
|
+
|
|
3671
|
+
describe('#handleHashTreeMessage', () => {
|
|
3672
|
+
it('should call handleHashTreeParserSwitch and not call handleMessage if parser was switched', () => {
|
|
3673
|
+
const locusUrlA = 'http://locus-url-A.com';
|
|
3674
|
+
const locusUrlB = 'http://locus-url-B.com';
|
|
3675
|
+
const parserA = {state: 'stopped', handleMessage: sinon.stub(), resume: sinon.stub(), stop: sinon.stub()};
|
|
3676
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, initializedFromHashTree: true});
|
|
3677
|
+
|
|
3678
|
+
// message for a stopped parser without replaces -> handleHashTreeParserSwitch returns true
|
|
3679
|
+
const message = {
|
|
3680
|
+
locusUrl: locusUrlA,
|
|
3681
|
+
locusStateElements: [],
|
|
3682
|
+
dataSets: [],
|
|
3683
|
+
};
|
|
3684
|
+
|
|
3685
|
+
locusInfo.parse(mockMeeting, {
|
|
3686
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3687
|
+
stateElementsMessage: message,
|
|
3688
|
+
});
|
|
3689
|
+
|
|
3690
|
+
assert.notCalled(parserA.handleMessage);
|
|
3691
|
+
});
|
|
3692
|
+
|
|
3693
|
+
it('should call handleMessage on the correct parser when no switch occurs', () => {
|
|
3694
|
+
const locusUrlA = 'http://locus-url-A.com';
|
|
3695
|
+
const parserA = {state: 'active', handleMessage: sinon.stub()};
|
|
3696
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, initializedFromHashTree: true});
|
|
3697
|
+
|
|
3698
|
+
const message = {
|
|
3699
|
+
locusUrl: locusUrlA,
|
|
3700
|
+
locusStateElements: [],
|
|
3701
|
+
dataSets: [],
|
|
3702
|
+
};
|
|
3703
|
+
|
|
3704
|
+
locusInfo.parse(mockMeeting, {
|
|
3705
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3706
|
+
stateElementsMessage: message,
|
|
3707
|
+
});
|
|
3708
|
+
|
|
3709
|
+
assert.calledOnceWithExactly(parserA.handleMessage, message);
|
|
3710
|
+
});
|
|
3711
|
+
|
|
3712
|
+
it('should send mismatch metric when eventType is not HASH_TREE_DATA_UPDATED', () => {
|
|
3713
|
+
const locusUrlA = 'http://locus-url-A.com';
|
|
3714
|
+
const parserA = {state: 'active', handleMessage: sinon.stub()};
|
|
3715
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, initializedFromHashTree: true});
|
|
3716
|
+
|
|
3717
|
+
locusInfo.parse(mockMeeting, {
|
|
3718
|
+
eventType: LOCUSEVENT.SELF_CHANGED,
|
|
3719
|
+
stateElementsMessage: {locusUrl: locusUrlA, locusStateElements: [], dataSets: []},
|
|
3720
|
+
});
|
|
3721
|
+
|
|
3722
|
+
assert.calledOnceWithExactly(
|
|
3723
|
+
sendBehavioralMetricStub,
|
|
3724
|
+
'js_sdk_locus_classic_vs_hash_tree_mismatch',
|
|
3725
|
+
{
|
|
3726
|
+
correlationId: mockMeeting.correlationId,
|
|
3727
|
+
message: `got ${LOCUSEVENT.SELF_CHANGED}, expected ${LOCUSEVENT.HASH_TREE_DATA_UPDATED}`,
|
|
3728
|
+
}
|
|
3729
|
+
);
|
|
3730
|
+
assert.notCalled(parserA.handleMessage);
|
|
3731
|
+
});
|
|
3732
|
+
});
|
|
3733
|
+
|
|
3734
|
+
describe('#sendClassicVsHashTreeMismatchMetric', () => {
|
|
3735
|
+
it('should send the metric when called for the first time', () => {
|
|
3736
|
+
locusInfo.sendClassicVsHashTreeMismatchMetric(mockMeeting, 'some mismatch');
|
|
3737
|
+
|
|
3738
|
+
assert.calledOnceWithExactly(
|
|
3739
|
+
sendBehavioralMetricStub,
|
|
3740
|
+
'js_sdk_locus_classic_vs_hash_tree_mismatch',
|
|
3741
|
+
{
|
|
3742
|
+
correlationId: mockMeeting.correlationId,
|
|
3743
|
+
message: 'some mismatch',
|
|
3744
|
+
}
|
|
3745
|
+
);
|
|
3746
|
+
});
|
|
3747
|
+
|
|
3748
|
+
it('should send the metric up to 5 times and stop after that', () => {
|
|
3749
|
+
for (let i = 0; i < 7; i += 1) {
|
|
3750
|
+
locusInfo.sendClassicVsHashTreeMismatchMetric(mockMeeting, `mismatch ${i}`);
|
|
3751
|
+
}
|
|
3752
|
+
|
|
3753
|
+
assert.callCount(sendBehavioralMetricStub, 5);
|
|
3754
|
+
assert.equal(locusInfo.classicVsHashTreeMismatchMetricCounter, 5);
|
|
3755
|
+
});
|
|
3756
|
+
});
|
|
3757
|
+
|
|
3758
|
+
describe('#handleLocusAPIResponse', () => {
|
|
3759
|
+
it('calls handleLocusDelta when we are not using hash trees', () => {
|
|
3760
|
+
const fakeLocus = {eventType: LOCUSEVENT.DIFFERENCE};
|
|
3761
|
+
|
|
3762
|
+
sinon.stub(locusInfo, 'handleLocusDelta');
|
|
3763
|
+
|
|
3764
|
+
locusInfo.handleLocusAPIResponse(mockMeeting, {locus: fakeLocus});
|
|
3765
|
+
|
|
3766
|
+
assert.calledWith(locusInfo.handleLocusDelta, fakeLocus, mockMeeting);
|
|
3767
|
+
});
|
|
3768
|
+
it('calls hash tree parser when we are using hash trees', () => {
|
|
3769
|
+
const fakeLocus = {eventType: LOCUSEVENT.DIFFERENCE, url: 'http://locus-url.com'};
|
|
3770
|
+
const fakeDataSets = [{name: 'dataset1', url: 'http://test.com'}];
|
|
3771
|
+
const responseBody = {locus: fakeLocus, dataSets: fakeDataSets};
|
|
3772
|
+
|
|
3773
|
+
// Create a mock hash tree parser
|
|
3774
|
+
const mockHashTreeParser = {
|
|
3775
|
+
handleLocusUpdate: sinon.stub(),
|
|
3776
|
+
};
|
|
3777
|
+
locusInfo.hashTreeParsers.set(fakeLocus.url, {
|
|
3778
|
+
parser: mockHashTreeParser,
|
|
3779
|
+
initializedFromHashTree: true,
|
|
3780
|
+
});
|
|
3781
|
+
|
|
3782
|
+
sinon.stub(locusInfo, 'onDeltaLocus');
|
|
3783
|
+
|
|
3784
|
+
locusInfo.handleLocusAPIResponse(mockMeeting, responseBody);
|
|
3785
|
+
|
|
3786
|
+
assert.calledOnceWithExactly(mockHashTreeParser.handleLocusUpdate, responseBody);
|
|
3787
|
+
});
|
|
3788
|
+
|
|
3789
|
+
it('should handle unwrapped LocusDTO (without locus wrapper) when hash tree parser exists', () => {
|
|
3790
|
+
const fakeLocus = {url: 'http://locus-url.com', fullState: {state: 'ACTIVE'}};
|
|
3791
|
+
const mockHashTreeParser = {handleLocusUpdate: sinon.stub()};
|
|
3792
|
+
locusInfo.hashTreeParsers.set(fakeLocus.url, {
|
|
3793
|
+
parser: mockHashTreeParser,
|
|
3794
|
+
initializedFromHashTree: true,
|
|
3795
|
+
});
|
|
3796
|
+
|
|
3797
|
+
locusInfo.handleLocusAPIResponse(mockMeeting, fakeLocus);
|
|
3798
|
+
|
|
3799
|
+
assert.calledOnceWithExactly(mockHashTreeParser.handleLocusUpdate, {locus: fakeLocus});
|
|
3800
|
+
});
|
|
3801
|
+
|
|
3802
|
+
it('should handle unwrapped LocusDTO in classic mode (no hash tree parser)', () => {
|
|
3803
|
+
const fakeLocus = {url: 'http://locus-url.com', fullState: {state: 'ACTIVE'}};
|
|
3804
|
+
sinon.stub(locusInfo, 'handleLocusDelta');
|
|
3805
|
+
|
|
3806
|
+
locusInfo.handleLocusAPIResponse(mockMeeting, fakeLocus);
|
|
3807
|
+
|
|
3808
|
+
assert.calledOnceWithExactly(locusInfo.handleLocusDelta, fakeLocus, mockMeeting);
|
|
3809
|
+
});
|
|
3810
|
+
|
|
3811
|
+
it('should send mismatch metric in classic mode when wrapped response has dataSets', () => {
|
|
3812
|
+
const fakeLocus = {url: 'http://locus-url.com'};
|
|
3813
|
+
sinon.stub(locusInfo, 'handleLocusDelta');
|
|
3814
|
+
|
|
3815
|
+
locusInfo.handleLocusAPIResponse(mockMeeting, {
|
|
3816
|
+
locus: fakeLocus,
|
|
3817
|
+
dataSets: [{name: 'dataset1', url: 'test-url'}],
|
|
3818
|
+
});
|
|
3819
|
+
|
|
3820
|
+
assert.calledOnceWithExactly(
|
|
3821
|
+
sendBehavioralMetricStub,
|
|
3822
|
+
'js_sdk_locus_classic_vs_hash_tree_mismatch',
|
|
3823
|
+
{
|
|
3824
|
+
correlationId: mockMeeting.correlationId,
|
|
3825
|
+
message: 'unexpected hash tree dataSets in API response',
|
|
3826
|
+
}
|
|
3827
|
+
);
|
|
3828
|
+
assert.calledOnce(locusInfo.handleLocusDelta);
|
|
3829
|
+
});
|
|
3830
|
+
|
|
3831
|
+
describe('parser switch via API response', () => {
|
|
3832
|
+
const deviceUrl = 'http://device-url.com';
|
|
3833
|
+
const locusUrlA = 'http://locus-url-A.com';
|
|
3834
|
+
const locusUrlB = 'http://locus-url-B.com';
|
|
3835
|
+
|
|
3836
|
+
let HashTreeParserStub;
|
|
3837
|
+
|
|
3838
|
+
const createMockApiParser = (state = 'active') => ({
|
|
3839
|
+
state,
|
|
3840
|
+
stop: sinon.stub(),
|
|
3841
|
+
resumeFromApiResponse: sinon.stub(),
|
|
3842
|
+
handleLocusUpdate: sinon.stub(),
|
|
3843
|
+
initializeFromGetLociResponse: sinon.stub(),
|
|
3844
|
+
});
|
|
3845
|
+
|
|
3846
|
+
const createLocusWithReplaces = (url, replacedLocusUrl, replacedAt) => ({
|
|
3847
|
+
url,
|
|
3848
|
+
self: {
|
|
3849
|
+
devices: [{url: deviceUrl, replaces: [{locusUrl: replacedLocusUrl, replacedAt}]}],
|
|
3850
|
+
},
|
|
3851
|
+
});
|
|
3852
|
+
|
|
3853
|
+
const createLocusWithoutReplaces = (url) => ({
|
|
3854
|
+
url,
|
|
3855
|
+
self: {devices: [{url: deviceUrl}]},
|
|
3856
|
+
});
|
|
3857
|
+
|
|
3858
|
+
beforeEach(() => {
|
|
3859
|
+
locusInfo.webex.internal.device.url = deviceUrl;
|
|
3860
|
+
HashTreeParserStub = sinon
|
|
3861
|
+
.stub(HashTreeParserModule, 'default')
|
|
3862
|
+
.returns(createMockApiParser());
|
|
3863
|
+
});
|
|
3864
|
+
|
|
3865
|
+
it('should create a new parser and initialize it when no entry exists for the locusUrl', () => {
|
|
3866
|
+
// existing parser for a different url so hashTreeParsers.size > 0
|
|
3867
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: createMockApiParser(), initializedFromHashTree: true});
|
|
3868
|
+
|
|
3869
|
+
const locus = createLocusWithReplaces(locusUrlB, locusUrlA, '2026-01-01T00:00:00Z');
|
|
3870
|
+
sinon.stub(locusInfo, 'handleLocusDelta');
|
|
3871
|
+
|
|
3872
|
+
locusInfo.handleLocusAPIResponse(mockMeeting, {locus});
|
|
3873
|
+
|
|
3874
|
+
assert.isTrue(locusInfo.hashTreeParsers.has(locusUrlB));
|
|
3875
|
+
const newEntry = locusInfo.hashTreeParsers.get(locusUrlB);
|
|
3876
|
+
assert.isFalse(newEntry.initializedFromHashTree);
|
|
3877
|
+
|
|
3878
|
+
// the stub returns the mock, so initializeFromGetLociResponse should be called on it
|
|
3879
|
+
const createdParser = HashTreeParserStub.returnValues[0];
|
|
3880
|
+
assert.calledOnceWithExactly(createdParser.initializeFromGetLociResponse, locus);
|
|
3881
|
+
assert.notCalled(locusInfo.handleLocusDelta);
|
|
3882
|
+
});
|
|
3883
|
+
|
|
3884
|
+
it('should reactivate a stopped parser when replaces info is newer', () => {
|
|
3885
|
+
const parserA = createMockApiParser('stopped');
|
|
3886
|
+
const parserB = createMockApiParser('active');
|
|
3887
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, replacedAt: '2026-01-01T00:00:00Z', initializedFromHashTree: true});
|
|
3888
|
+
locusInfo.hashTreeParsers.set(locusUrlB, {parser: parserB, initializedFromHashTree: true});
|
|
3889
|
+
|
|
3890
|
+
const locus = createLocusWithReplaces(locusUrlA, locusUrlB, '2026-02-01T00:00:00Z');
|
|
3891
|
+
|
|
3892
|
+
locusInfo.handleLocusAPIResponse(mockMeeting, {locus});
|
|
3893
|
+
|
|
3894
|
+
assert.calledOnce(parserA.resumeFromApiResponse);
|
|
3895
|
+
assert.calledWithExactly(parserA.resumeFromApiResponse, locus);
|
|
3896
|
+
assert.calledOnce(parserB.stop);
|
|
3897
|
+
assert.equal(locusInfo.hashTreeParsers.get(locusUrlB).replacedAt, '2026-02-01T00:00:00Z');
|
|
3898
|
+
assert.isFalse(locusInfo.hashTreeParsers.get(locusUrlA).initializedFromHashTree);
|
|
3899
|
+
});
|
|
3900
|
+
|
|
3901
|
+
it('should not reactivate a stopped parser when replaces info is not newer', () => {
|
|
3902
|
+
const parserA = createMockApiParser('stopped');
|
|
3903
|
+
const parserB = createMockApiParser('active');
|
|
3904
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, replacedAt: '2026-03-01T00:00:00Z', initializedFromHashTree: true});
|
|
3905
|
+
locusInfo.hashTreeParsers.set(locusUrlB, {parser: parserB, initializedFromHashTree: true});
|
|
3906
|
+
|
|
3907
|
+
const locus = createLocusWithReplaces(locusUrlA, locusUrlB, '2026-01-01T00:00:00Z');
|
|
3908
|
+
|
|
3909
|
+
locusInfo.handleLocusAPIResponse(mockMeeting, {locus});
|
|
3910
|
+
|
|
3911
|
+
assert.notCalled(parserA.resumeFromApiResponse);
|
|
3912
|
+
assert.notCalled(parserB.stop);
|
|
3913
|
+
});
|
|
3914
|
+
|
|
3915
|
+
it('should not reactivate a stopped parser when no replaces info is available', () => {
|
|
3916
|
+
const parserA = createMockApiParser('stopped');
|
|
3917
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, initializedFromHashTree: true});
|
|
3918
|
+
|
|
3919
|
+
const locus = createLocusWithoutReplaces(locusUrlA);
|
|
3920
|
+
|
|
3921
|
+
locusInfo.handleLocusAPIResponse(mockMeeting, {locus});
|
|
3922
|
+
|
|
3923
|
+
assert.notCalled(parserA.resumeFromApiResponse);
|
|
3924
|
+
});
|
|
3925
|
+
});
|
|
3926
|
+
});
|
|
3927
|
+
|
|
3928
|
+
describe('#syncAllHashTreeDatasets', () => {
|
|
3929
|
+
it('should call syncAllDatasets on each parser that has an entry', async () => {
|
|
3930
|
+
const parser1 = {syncAllDatasets: sinon.stub().resolves()};
|
|
3931
|
+
const parser2 = {syncAllDatasets: sinon.stub().resolves()};
|
|
3932
|
+
locusInfo.hashTreeParsers.set('url1', {parser: parser1});
|
|
3933
|
+
locusInfo.hashTreeParsers.set('url2', {parser: parser2});
|
|
3934
|
+
|
|
3935
|
+
await locusInfo.syncAllHashTreeDatasets();
|
|
3936
|
+
|
|
3937
|
+
assert.calledOnce(parser1.syncAllDatasets);
|
|
3938
|
+
assert.calledOnce(parser2.syncAllDatasets);
|
|
3939
|
+
});
|
|
3940
|
+
|
|
3941
|
+
it('should skip parser entries without a parser object', async () => {
|
|
3942
|
+
const parser1 = {syncAllDatasets: sinon.stub().resolves()};
|
|
3943
|
+
locusInfo.hashTreeParsers.set('url1', {parser: parser1});
|
|
3944
|
+
locusInfo.hashTreeParsers.set('url2', {parser: undefined});
|
|
3945
|
+
|
|
3946
|
+
await locusInfo.syncAllHashTreeDatasets();
|
|
3947
|
+
|
|
3948
|
+
assert.calledOnce(parser1.syncAllDatasets);
|
|
3949
|
+
});
|
|
3950
|
+
|
|
3951
|
+
it('should forward options to each parser syncAllDatasets', async () => {
|
|
3952
|
+
const parser1 = {syncAllDatasets: sinon.stub().resolves()};
|
|
3953
|
+
const parser2 = {syncAllDatasets: sinon.stub().resolves()};
|
|
3954
|
+
locusInfo.hashTreeParsers.set('url1', {parser: parser1});
|
|
3955
|
+
locusInfo.hashTreeParsers.set('url2', {parser: parser2});
|
|
3956
|
+
|
|
3957
|
+
await locusInfo.syncAllHashTreeDatasets({onlyLLM: true});
|
|
3958
|
+
|
|
3959
|
+
assert.calledOnceWithExactly(parser1.syncAllDatasets, {onlyLLM: true});
|
|
3960
|
+
assert.calledOnceWithExactly(parser2.syncAllDatasets, {onlyLLM: true});
|
|
3961
|
+
});
|
|
3962
|
+
|
|
3963
|
+
it('should await each parsers syncAllDatasets sequentially', async () => {
|
|
3964
|
+
const callOrder = [];
|
|
3965
|
+
const parser1 = {syncAllDatasets: sinon.stub().callsFake(() => {
|
|
3966
|
+
callOrder.push('start1');
|
|
3967
|
+
return new Promise((resolve) => {
|
|
3968
|
+
setTimeout(() => {
|
|
3969
|
+
callOrder.push('end1');
|
|
3970
|
+
resolve();
|
|
3971
|
+
}, 100);
|
|
3972
|
+
});
|
|
3973
|
+
})};
|
|
3974
|
+
const parser2 = {syncAllDatasets: sinon.stub().callsFake(() => {
|
|
3975
|
+
callOrder.push('start2');
|
|
3976
|
+
return Promise.resolve();
|
|
3977
|
+
})};
|
|
3978
|
+
locusInfo.hashTreeParsers.set('url1', {parser: parser1});
|
|
3979
|
+
locusInfo.hashTreeParsers.set('url2', {parser: parser2});
|
|
3980
|
+
|
|
3981
|
+
const clock = sinon.useFakeTimers();
|
|
3982
|
+
const promise = locusInfo.syncAllHashTreeDatasets();
|
|
3983
|
+
// parser1 started but parser2 not yet
|
|
3984
|
+
assert.deepEqual(callOrder, ['start1']);
|
|
3985
|
+
|
|
3986
|
+
await clock.tickAsync(100);
|
|
3987
|
+
await promise;
|
|
3988
|
+
// parser1 finished, then parser2 started and finished
|
|
3989
|
+
assert.deepEqual(callOrder, ['start1', 'end1', 'start2']);
|
|
3990
|
+
clock.restore();
|
|
3991
|
+
});
|
|
3992
|
+
});
|
|
3993
|
+
|
|
3994
|
+
describe('#LocusDeltaEvents', () => {
|
|
3995
|
+
const fakeMeeting = 'fakeMeeting';
|
|
3996
|
+
let sandbox = null;
|
|
3997
|
+
let locusParser = null;
|
|
3998
|
+
let fakeLocus = null;
|
|
3999
|
+
|
|
4000
|
+
beforeEach(() => {
|
|
4001
|
+
locusParser = locusInfo.locusParser;
|
|
4002
|
+
sandbox = sinon.createSandbox();
|
|
4003
|
+
|
|
4004
|
+
fakeLocus = {
|
|
4005
|
+
meeting: true,
|
|
3013
4006
|
participants: [],
|
|
3014
4007
|
url: 'newLocusUrl',
|
|
3015
4008
|
syncUrl: 'newSyncUrl',
|
|
@@ -3086,49 +4079,23 @@ describe('plugin-meetings', () => {
|
|
|
3086
4079
|
assert.deepEqual(callOrder, ['updateLocusUrl', 'updateMeetingInfo']);
|
|
3087
4080
|
});
|
|
3088
4081
|
|
|
3089
|
-
it('#updateLocusInfo ignores
|
|
3090
|
-
const newLocus = {
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
state: 'LEFT',
|
|
3094
|
-
},
|
|
3095
|
-
};
|
|
4082
|
+
it('#updateLocusInfo ignores locus when isSelfMovedOrBreakoutEnded returns true', () => {
|
|
4083
|
+
const newLocus = {self: {state: 'JOINED'}};
|
|
4084
|
+
|
|
4085
|
+
sinon.stub(MeetingsUtil, 'isSelfMovedOrBreakoutEnded').returns(true);
|
|
3096
4086
|
|
|
3097
4087
|
locusInfo.updateControls = sinon.stub();
|
|
3098
|
-
locusInfo.updateConversationUrl = sinon.stub();
|
|
3099
|
-
locusInfo.updateCreated = sinon.stub();
|
|
3100
4088
|
locusInfo.updateFullState = sinon.stub();
|
|
3101
|
-
locusInfo.updateHostInfo = sinon.stub();
|
|
3102
|
-
locusInfo.updateMeetingInfo = sinon.stub();
|
|
3103
|
-
locusInfo.updateMediaShares = sinon.stub();
|
|
3104
|
-
locusInfo.updateReplaces = sinon.stub();
|
|
3105
4089
|
locusInfo.updateSelf = sinon.stub();
|
|
3106
|
-
locusInfo.updateLocusUrl = sinon.stub();
|
|
3107
|
-
locusInfo.updateAclUrl = sinon.stub();
|
|
3108
|
-
locusInfo.updateBasequence = sinon.stub();
|
|
3109
|
-
locusInfo.updateSequence = sinon.stub();
|
|
3110
|
-
locusInfo.updateEmbeddedApps = sinon.stub();
|
|
3111
|
-
locusInfo.updateLinks = sinon.stub();
|
|
3112
|
-
locusInfo.compareAndUpdate = sinon.stub();
|
|
3113
4090
|
|
|
3114
4091
|
locusInfo.updateLocusInfo(newLocus);
|
|
3115
4092
|
|
|
4093
|
+
assert.calledOnceWithExactly(MeetingsUtil.isSelfMovedOrBreakoutEnded, newLocus);
|
|
3116
4094
|
assert.notCalled(locusInfo.updateControls);
|
|
3117
|
-
assert.notCalled(locusInfo.updateConversationUrl);
|
|
3118
|
-
assert.notCalled(locusInfo.updateCreated);
|
|
3119
4095
|
assert.notCalled(locusInfo.updateFullState);
|
|
3120
|
-
assert.notCalled(locusInfo.updateHostInfo);
|
|
3121
|
-
assert.notCalled(locusInfo.updateMeetingInfo);
|
|
3122
|
-
assert.notCalled(locusInfo.updateMediaShares);
|
|
3123
|
-
assert.notCalled(locusInfo.updateReplaces);
|
|
3124
4096
|
assert.notCalled(locusInfo.updateSelf);
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
assert.notCalled(locusInfo.updateBasequence);
|
|
3128
|
-
assert.notCalled(locusInfo.updateSequence);
|
|
3129
|
-
assert.notCalled(locusInfo.updateEmbeddedApps);
|
|
3130
|
-
assert.notCalled(locusInfo.updateLinks);
|
|
3131
|
-
assert.notCalled(locusInfo.compareAndUpdate);
|
|
4097
|
+
|
|
4098
|
+
MeetingsUtil.isSelfMovedOrBreakoutEnded.restore();
|
|
3132
4099
|
});
|
|
3133
4100
|
|
|
3134
4101
|
it('#updateLocusInfo puts the Locus DTO top level properties at the right place in LocusInfo class', () => {
|
|
@@ -3335,45 +4302,335 @@ describe('plugin-meetings', () => {
|
|
|
3335
4302
|
|
|
3336
4303
|
locusInfo.locusParser.workingCopy = {}; // no syncUrl
|
|
3337
4304
|
|
|
3338
|
-
// Since we have a promise inside a function we want to test that's not returned,
|
|
3339
|
-
// we will wait and stub it's last function to resolve this waiting promise.
|
|
3340
|
-
// Also ensures .onFullLocus() is called before .resume()
|
|
3341
|
-
return new Promise((resolve) => {
|
|
3342
|
-
locusInfo.locusParser.resume = sandbox.stub().callsFake(() => resolve());
|
|
3343
|
-
locusInfo.applyLocusDeltaData(DESYNC, fakeLocus, meeting);
|
|
3344
|
-
}).then(() => {
|
|
3345
|
-
assert.calledOnceWithExactly(meeting.meetingRequest.getLocusDTO, {url: 'oldLocusUrl'});
|
|
4305
|
+
// Since we have a promise inside a function we want to test that's not returned,
|
|
4306
|
+
// we will wait and stub it's last function to resolve this waiting promise.
|
|
4307
|
+
// Also ensures .onFullLocus() is called before .resume()
|
|
4308
|
+
return new Promise((resolve) => {
|
|
4309
|
+
locusInfo.locusParser.resume = sandbox.stub().callsFake(() => resolve());
|
|
4310
|
+
locusInfo.applyLocusDeltaData(DESYNC, fakeLocus, meeting);
|
|
4311
|
+
}).then(() => {
|
|
4312
|
+
assert.calledOnceWithExactly(meeting.meetingRequest.getLocusDTO, {url: 'oldLocusUrl'});
|
|
4313
|
+
|
|
4314
|
+
assert.calledOnceWithExactly(
|
|
4315
|
+
meeting.locusInfo.onFullLocus,
|
|
4316
|
+
'classic Locus sync',
|
|
4317
|
+
fakeFullLocusDto
|
|
4318
|
+
);
|
|
4319
|
+
assert.calledOnce(locusInfo.locusParser.resume);
|
|
4320
|
+
});
|
|
4321
|
+
});
|
|
4322
|
+
|
|
4323
|
+
it('applyLocusDeltaData handles LOCUS_URL_CHANGED action correctly', () => {
|
|
4324
|
+
const {LOCUS_URL_CHANGED} = LocusDeltaParser.loci;
|
|
4325
|
+
const fakeFullLocus = {
|
|
4326
|
+
url: 'new full loci url',
|
|
4327
|
+
};
|
|
4328
|
+
const meeting = {
|
|
4329
|
+
meetingRequest: {
|
|
4330
|
+
getLocusDTO: sandbox.stub().resolves({body: fakeFullLocus}),
|
|
4331
|
+
},
|
|
4332
|
+
locusInfo: {
|
|
4333
|
+
handleLocusDelta: sandbox.stub(),
|
|
4334
|
+
},
|
|
4335
|
+
locusUrl: 'current BO session locus url',
|
|
4336
|
+
};
|
|
4337
|
+
|
|
4338
|
+
locusInfo.locusParser.workingCopy = null;
|
|
4339
|
+
|
|
4340
|
+
locusInfo.applyLocusDeltaData(LOCUS_URL_CHANGED, fakeLocus, meeting);
|
|
4341
|
+
assert.calledOnceWithExactly(meeting.meetingRequest.getLocusDTO, {url: fakeLocus.url});
|
|
4342
|
+
});
|
|
4343
|
+
|
|
4344
|
+
describe('#sync', () => {
|
|
4345
|
+
it('pauses the parser and awaits the Locus sync for classic meetings when canSyncClassicLocus is true', async () => {
|
|
4346
|
+
const fakeFullLocusDto = {id: 'fake full locus dto'};
|
|
4347
|
+
const meeting = {
|
|
4348
|
+
meetingRequest: {
|
|
4349
|
+
getLocusDTO: sandbox.stub().resolves({body: fakeFullLocusDto}),
|
|
4350
|
+
},
|
|
4351
|
+
locusInfo: {
|
|
4352
|
+
onFullLocus: sandbox.stub(),
|
|
4353
|
+
},
|
|
4354
|
+
locusUrl: 'someLocusUrl',
|
|
4355
|
+
};
|
|
4356
|
+
|
|
4357
|
+
locusInfo.locusParser.workingCopy = {}; // no syncUrl -> full sync
|
|
4358
|
+
sandbox.stub(locusInfo.locusParser, 'pause');
|
|
4359
|
+
sandbox.stub(locusInfo.locusParser, 'resume');
|
|
4360
|
+
|
|
4361
|
+
await locusInfo.sync(meeting, {canSyncClassicLocus: true, canSyncHashTree: true});
|
|
4362
|
+
|
|
4363
|
+
assert.calledOnce(locusInfo.locusParser.pause);
|
|
4364
|
+
assert.calledOnceWithExactly(meeting.meetingRequest.getLocusDTO, {url: 'someLocusUrl'});
|
|
4365
|
+
// sync() must not resolve until the fetched DTO has been applied
|
|
4366
|
+
assert.calledOnceWithExactly(
|
|
4367
|
+
meeting.locusInfo.onFullLocus,
|
|
4368
|
+
'classic Locus sync',
|
|
4369
|
+
fakeFullLocusDto
|
|
4370
|
+
);
|
|
4371
|
+
assert.calledOnce(locusInfo.locusParser.resume);
|
|
4372
|
+
});
|
|
4373
|
+
|
|
4374
|
+
it('does nothing for classic meetings when the meeting has no Locus URL', async () => {
|
|
4375
|
+
const meeting = {
|
|
4376
|
+
meetingRequest: {
|
|
4377
|
+
getLocusDTO: sandbox.stub().resolves({body: {}}),
|
|
4378
|
+
},
|
|
4379
|
+
locusUrl: undefined,
|
|
4380
|
+
};
|
|
4381
|
+
|
|
4382
|
+
locusInfo.locusParser.workingCopy = {};
|
|
4383
|
+
sandbox.stub(locusInfo.locusParser, 'pause');
|
|
4384
|
+
|
|
4385
|
+
await locusInfo.sync(meeting, {canSyncClassicLocus: true, canSyncHashTree: true});
|
|
4386
|
+
|
|
4387
|
+
assert.notCalled(locusInfo.locusParser.pause);
|
|
4388
|
+
assert.notCalled(meeting.meetingRequest.getLocusDTO);
|
|
4389
|
+
});
|
|
4390
|
+
|
|
4391
|
+
it('does nothing for classic meetings when canSyncClassicLocus is false', async () => {
|
|
4392
|
+
const meeting = {
|
|
4393
|
+
meetingRequest: {
|
|
4394
|
+
getLocusDTO: sandbox.stub().resolves({body: {}}),
|
|
4395
|
+
},
|
|
4396
|
+
locusUrl: 'someLocusUrl',
|
|
4397
|
+
};
|
|
4398
|
+
|
|
4399
|
+
locusInfo.locusParser.workingCopy = {};
|
|
4400
|
+
sandbox.stub(locusInfo.locusParser, 'pause');
|
|
4401
|
+
|
|
4402
|
+
await locusInfo.sync(meeting, {canSyncClassicLocus: false, canSyncHashTree: true});
|
|
4403
|
+
|
|
4404
|
+
assert.notCalled(locusInfo.locusParser.pause);
|
|
4405
|
+
assert.notCalled(meeting.meetingRequest.getLocusDTO);
|
|
4406
|
+
});
|
|
4407
|
+
|
|
4408
|
+
it('syncs hash tree datasets and never does a classic Locus sync for hash tree based meetings', async () => {
|
|
4409
|
+
const parser = {syncAllDatasets: sandbox.stub().resolves()};
|
|
4410
|
+
const meeting = {
|
|
4411
|
+
meetingRequest: {
|
|
4412
|
+
getLocusDTO: sandbox.stub().resolves({body: {}}),
|
|
4413
|
+
},
|
|
4414
|
+
};
|
|
4415
|
+
|
|
4416
|
+
locusInfo.hashTreeParsers.set('someLocusUrl', {parser});
|
|
4417
|
+
sandbox.stub(locusInfo.locusParser, 'pause');
|
|
4418
|
+
|
|
4419
|
+
await locusInfo.sync(meeting, {canSyncClassicLocus: true, canSyncHashTree: true});
|
|
4420
|
+
|
|
4421
|
+
assert.calledOnce(parser.syncAllDatasets);
|
|
4422
|
+
assert.notCalled(locusInfo.locusParser.pause);
|
|
4423
|
+
assert.notCalled(meeting.meetingRequest.getLocusDTO);
|
|
4424
|
+
});
|
|
4425
|
+
|
|
4426
|
+
it('does not sync hash tree datasets when canSyncHashTree is false', async () => {
|
|
4427
|
+
const parser = {syncAllDatasets: sandbox.stub().resolves()};
|
|
4428
|
+
const meeting = {
|
|
4429
|
+
meetingRequest: {
|
|
4430
|
+
getLocusDTO: sandbox.stub().resolves({body: {}}),
|
|
4431
|
+
},
|
|
4432
|
+
};
|
|
4433
|
+
|
|
4434
|
+
locusInfo.hashTreeParsers.set('someLocusUrl', {parser});
|
|
4435
|
+
sandbox.stub(locusInfo.locusParser, 'pause');
|
|
4436
|
+
|
|
4437
|
+
await locusInfo.sync(meeting, {canSyncClassicLocus: true, canSyncHashTree: false});
|
|
4438
|
+
|
|
4439
|
+
assert.notCalled(parser.syncAllDatasets);
|
|
4440
|
+
assert.notCalled(locusInfo.locusParser.pause);
|
|
4441
|
+
assert.notCalled(meeting.meetingRequest.getLocusDTO);
|
|
4442
|
+
});
|
|
4443
|
+
|
|
4444
|
+
it('preserves the meeting and rejects when the classic sync fails, so the caller can retry', async () => {
|
|
4445
|
+
const fetchError = new Error('transient failure');
|
|
4446
|
+
const meeting = {
|
|
4447
|
+
meetingRequest: {
|
|
4448
|
+
getLocusDTO: sandbox.stub().rejects(fetchError),
|
|
4449
|
+
},
|
|
4450
|
+
locusInfo: {
|
|
4451
|
+
onFullLocus: sandbox.stub(),
|
|
4452
|
+
},
|
|
4453
|
+
locusUrl: 'someLocusUrl',
|
|
4454
|
+
};
|
|
4455
|
+
|
|
4456
|
+
locusInfo.locusParser.workingCopy = {}; // no syncUrl -> full sync
|
|
4457
|
+
sandbox.stub(locusInfo.locusParser, 'pause');
|
|
4458
|
+
sandbox.stub(locusInfo.locusParser, 'resume');
|
|
4459
|
+
sandbox.stub(webex.meetings, 'destroy');
|
|
4460
|
+
|
|
4461
|
+
await assert.isRejected(
|
|
4462
|
+
locusInfo.sync(meeting, {canSyncClassicLocus: true, canSyncHashTree: true}),
|
|
4463
|
+
fetchError
|
|
4464
|
+
);
|
|
4465
|
+
|
|
4466
|
+
// the meeting must not be torn down on a transient reconnection sync failure
|
|
4467
|
+
assert.notCalled(webex.meetings.destroy);
|
|
4468
|
+
// the parser must still be resumed so it isn't left paused
|
|
4469
|
+
assert.calledOnce(locusInfo.locusParser.resume);
|
|
4470
|
+
});
|
|
4471
|
+
|
|
4472
|
+
it('destroys the meeting and resolves when the classic sync gets a terminal 403, so the caller does not retry', async () => {
|
|
4473
|
+
const fake403Error = new Error('meeting ended');
|
|
4474
|
+
fake403Error.statusCode = 403;
|
|
4475
|
+
const meeting = {
|
|
4476
|
+
correlationId: 'correlationId',
|
|
4477
|
+
meetingRequest: {
|
|
4478
|
+
getLocusDTO: sandbox.stub().rejects(fake403Error),
|
|
4479
|
+
},
|
|
4480
|
+
locusInfo: {
|
|
4481
|
+
onFullLocus: sandbox.stub(),
|
|
4482
|
+
},
|
|
4483
|
+
locusUrl: 'someLocusUrl',
|
|
4484
|
+
};
|
|
4485
|
+
|
|
4486
|
+
locusInfo.locusParser.workingCopy = {syncUrl: 'deltaSyncUrl'}; // delta sync -> 403 is terminal
|
|
4487
|
+
sandbox.stub(locusInfo.locusParser, 'pause');
|
|
4488
|
+
sandbox.stub(locusInfo.locusParser, 'resume');
|
|
4489
|
+
sandbox.stub(webex.meetings, 'destroy');
|
|
4490
|
+
|
|
4491
|
+
// a terminal 403 means the meeting has ended, so the sync must resolve (not reject),
|
|
4492
|
+
// otherwise the reconnection flow would retry indefinitely
|
|
4493
|
+
await locusInfo.sync(meeting, {canSyncClassicLocus: true, canSyncHashTree: true});
|
|
4494
|
+
|
|
4495
|
+
assert.calledOnceWithExactly(webex.meetings.destroy, meeting, 'LOCUS_DTO_SYNC_FAILED');
|
|
4496
|
+
// meeting was destroyed, so the parser is not resumed
|
|
4497
|
+
assert.notCalled(locusInfo.locusParser.resume);
|
|
4498
|
+
});
|
|
4499
|
+
|
|
4500
|
+
it('destroys the meeting and resolves when the fallback full sync gets a terminal 403, so the caller does not retry', async () => {
|
|
4501
|
+
const fakeDeltaError = new Error('delta failed');
|
|
4502
|
+
fakeDeltaError.statusCode = 500;
|
|
4503
|
+
const fake403Error = new Error('meeting ended');
|
|
4504
|
+
fake403Error.statusCode = 403;
|
|
4505
|
+
const getLocusDTO = sandbox.stub();
|
|
4506
|
+
getLocusDTO.onCall(0).rejects(fakeDeltaError); // delta sync fails with non-403
|
|
4507
|
+
getLocusDTO.onCall(1).rejects(fake403Error); // fallback full sync fails with 403
|
|
4508
|
+
const meeting = {
|
|
4509
|
+
correlationId: 'correlationId',
|
|
4510
|
+
meetingRequest: {
|
|
4511
|
+
getLocusDTO,
|
|
4512
|
+
},
|
|
4513
|
+
locusInfo: {
|
|
4514
|
+
onFullLocus: sandbox.stub(),
|
|
4515
|
+
},
|
|
4516
|
+
locusUrl: 'someLocusUrl',
|
|
4517
|
+
};
|
|
4518
|
+
|
|
4519
|
+
locusInfo.locusParser.workingCopy = {syncUrl: 'deltaSyncUrl'}; // delta sync -> fallback to full sync
|
|
4520
|
+
sandbox.stub(locusInfo.locusParser, 'pause');
|
|
4521
|
+
sandbox.stub(locusInfo.locusParser, 'resume');
|
|
4522
|
+
sandbox.stub(webex.meetings, 'destroy');
|
|
4523
|
+
|
|
4524
|
+
// a terminal 403 from the fallback full sync means the meeting has ended, so the sync must
|
|
4525
|
+
// resolve (not reject), otherwise the reconnection flow would retry indefinitely
|
|
4526
|
+
await locusInfo.sync(meeting, {canSyncClassicLocus: true, canSyncHashTree: true});
|
|
4527
|
+
|
|
4528
|
+
assert.calledTwice(getLocusDTO);
|
|
4529
|
+
assert.deepEqual(getLocusDTO.getCalls()[0].args, [{url: 'deltaSyncUrl'}]);
|
|
4530
|
+
assert.deepEqual(getLocusDTO.getCalls()[1].args, [{url: 'someLocusUrl'}]);
|
|
4531
|
+
assert.calledOnceWithExactly(webex.meetings.destroy, meeting, 'LOCUS_DTO_SYNC_FAILED');
|
|
4532
|
+
// meeting was destroyed, so the parser is not resumed
|
|
4533
|
+
assert.notCalled(locusInfo.locusParser.resume);
|
|
4534
|
+
});
|
|
4535
|
+
|
|
4536
|
+
it('destroys the meeting and resolves when the direct full sync (no delta syncUrl) gets a terminal 403, so the caller does not retry', async () => {
|
|
4537
|
+
const fake403Error = new Error('meeting ended');
|
|
4538
|
+
fake403Error.statusCode = 403;
|
|
4539
|
+
const meeting = {
|
|
4540
|
+
correlationId: 'correlationId',
|
|
4541
|
+
meetingRequest: {
|
|
4542
|
+
getLocusDTO: sandbox.stub().rejects(fake403Error),
|
|
4543
|
+
},
|
|
4544
|
+
locusInfo: {
|
|
4545
|
+
onFullLocus: sandbox.stub(),
|
|
4546
|
+
},
|
|
4547
|
+
locusUrl: 'someLocusUrl',
|
|
4548
|
+
};
|
|
4549
|
+
|
|
4550
|
+
locusInfo.locusParser.workingCopy = {}; // no syncUrl -> direct full sync, 403 is terminal
|
|
4551
|
+
sandbox.stub(locusInfo.locusParser, 'pause');
|
|
4552
|
+
sandbox.stub(locusInfo.locusParser, 'resume');
|
|
4553
|
+
sandbox.stub(webex.meetings, 'destroy');
|
|
4554
|
+
|
|
4555
|
+
// a terminal 403 from the direct full sync means the meeting has ended, so the sync must
|
|
4556
|
+
// resolve (not reject), otherwise the reconnection flow would retry indefinitely
|
|
4557
|
+
await locusInfo.sync(meeting, {canSyncClassicLocus: true, canSyncHashTree: true});
|
|
4558
|
+
|
|
4559
|
+
assert.calledOnceWithExactly(meeting.meetingRequest.getLocusDTO, {url: 'someLocusUrl'});
|
|
4560
|
+
assert.calledOnceWithExactly(webex.meetings.destroy, meeting, 'LOCUS_DTO_SYNC_FAILED');
|
|
4561
|
+
// meeting was destroyed, so the parser is not resumed
|
|
4562
|
+
assert.notCalled(locusInfo.locusParser.resume);
|
|
4563
|
+
});
|
|
4564
|
+
});
|
|
4565
|
+
|
|
4566
|
+
describe('#doLocusSync', () => {
|
|
4567
|
+
it('resolves without destroying the meeting when the DTO is fetched but applying it fails and destroyOnTransientFailure is true', async () => {
|
|
4568
|
+
const fakeFullLocusDto = {id: 'fake full locus dto'};
|
|
4569
|
+
const applyError = new Error('failed to apply DTO');
|
|
4570
|
+
const meeting = {
|
|
4571
|
+
correlationId: 'correlationId',
|
|
4572
|
+
meetingRequest: {
|
|
4573
|
+
getLocusDTO: sandbox.stub().resolves({body: fakeFullLocusDto}),
|
|
4574
|
+
},
|
|
4575
|
+
locusInfo: {
|
|
4576
|
+
onFullLocus: sandbox.stub().throws(applyError),
|
|
4577
|
+
},
|
|
4578
|
+
locusUrl: 'someLocusUrl',
|
|
4579
|
+
};
|
|
4580
|
+
|
|
4581
|
+
locusInfo.locusParser.workingCopy = {}; // no syncUrl -> full sync
|
|
4582
|
+
sandbox.stub(locusInfo.locusParser, 'resume');
|
|
4583
|
+
sandbox.stub(webex.meetings, 'destroy');
|
|
4584
|
+
|
|
4585
|
+
// destroyOnTransientFailure defaults to true: a successfully fetched DTO that then fails to
|
|
4586
|
+
// apply must not reject or destroy the meeting - doLocusSync just resumes the parser and
|
|
4587
|
+
// resolves (the returned promise must not reject)
|
|
4588
|
+
await locusInfo.doLocusSync(meeting, false, undefined);
|
|
4589
|
+
|
|
4590
|
+
assert.calledOnceWithExactly(
|
|
4591
|
+
meeting.locusInfo.onFullLocus,
|
|
4592
|
+
'classic Locus sync',
|
|
4593
|
+
fakeFullLocusDto
|
|
4594
|
+
);
|
|
4595
|
+
assert.notCalled(webex.meetings.destroy);
|
|
4596
|
+
assert.calledOnce(locusInfo.locusParser.resume);
|
|
4597
|
+
});
|
|
4598
|
+
|
|
4599
|
+
it('resolves (does not reject) when the DTO is fetched but applying it fails even when destroyOnTransientFailure is false, so the sync is not retried indefinitely', async () => {
|
|
4600
|
+
const fakeFullLocusDto = {id: 'fake full locus dto'};
|
|
4601
|
+
const applyError = new Error('failed to apply DTO');
|
|
4602
|
+
const meeting = {
|
|
4603
|
+
correlationId: 'correlationId',
|
|
4604
|
+
meetingRequest: {
|
|
4605
|
+
getLocusDTO: sandbox.stub().resolves({body: fakeFullLocusDto}),
|
|
4606
|
+
},
|
|
4607
|
+
locusInfo: {
|
|
4608
|
+
onFullLocus: sandbox.stub().throws(applyError),
|
|
4609
|
+
},
|
|
4610
|
+
locusUrl: 'someLocusUrl',
|
|
4611
|
+
};
|
|
4612
|
+
|
|
4613
|
+
locusInfo.locusParser.workingCopy = {}; // no syncUrl -> full sync
|
|
4614
|
+
sandbox.stub(locusInfo.locusParser, 'resume');
|
|
4615
|
+
sandbox.stub(webex.meetings, 'destroy');
|
|
4616
|
+
|
|
4617
|
+
// Even on the caller-driven (reconnection) path (destroyOnTransientFailure: false), an
|
|
4618
|
+
// application failure must not reject: retrying would re-fetch and re-apply the same
|
|
4619
|
+
// unprocessable DTO, so doLocusSync just resumes the parser and resolves.
|
|
4620
|
+
await locusInfo.doLocusSync(meeting, false, undefined, {
|
|
4621
|
+
destroyOnTransientFailure: false,
|
|
4622
|
+
});
|
|
3346
4623
|
|
|
3347
4624
|
assert.calledOnceWithExactly(
|
|
3348
4625
|
meeting.locusInfo.onFullLocus,
|
|
3349
4626
|
'classic Locus sync',
|
|
3350
4627
|
fakeFullLocusDto
|
|
3351
4628
|
);
|
|
4629
|
+
assert.notCalled(webex.meetings.destroy);
|
|
3352
4630
|
assert.calledOnce(locusInfo.locusParser.resume);
|
|
3353
4631
|
});
|
|
3354
4632
|
});
|
|
3355
4633
|
|
|
3356
|
-
it('applyLocusDeltaData handles LOCUS_URL_CHANGED action correctly', () => {
|
|
3357
|
-
const {LOCUS_URL_CHANGED} = LocusDeltaParser.loci;
|
|
3358
|
-
const fakeFullLocus = {
|
|
3359
|
-
url: 'new full loci url',
|
|
3360
|
-
};
|
|
3361
|
-
const meeting = {
|
|
3362
|
-
meetingRequest: {
|
|
3363
|
-
getLocusDTO: sandbox.stub().resolves({body: fakeFullLocus}),
|
|
3364
|
-
},
|
|
3365
|
-
locusInfo: {
|
|
3366
|
-
handleLocusDelta: sandbox.stub(),
|
|
3367
|
-
},
|
|
3368
|
-
locusUrl: 'current BO session locus url',
|
|
3369
|
-
};
|
|
3370
|
-
|
|
3371
|
-
locusInfo.locusParser.workingCopy = null;
|
|
3372
|
-
|
|
3373
|
-
locusInfo.applyLocusDeltaData(LOCUS_URL_CHANGED, fakeLocus, meeting);
|
|
3374
|
-
assert.calledOnceWithExactly(meeting.meetingRequest.getLocusDTO, {url: fakeLocus.url});
|
|
3375
|
-
});
|
|
3376
|
-
|
|
3377
4634
|
describe('edge cases for sync failing', () => {
|
|
3378
4635
|
const {DESYNC} = LocusDeltaParser.loci;
|
|
3379
4636
|
const fakeFullLocusDto = {id: 'fake full locus dto'};
|
|
@@ -3651,6 +4908,137 @@ describe('plugin-meetings', () => {
|
|
|
3651
4908
|
|
|
3652
4909
|
assert.isNull(locusInfo.mainSessionLocusCache);
|
|
3653
4910
|
});
|
|
4911
|
+
|
|
4912
|
+
it('should map participant with htMeta.elementId.id of 0 (falsy number) to hashTreeObjectId2ParticipantId', () => {
|
|
4913
|
+
const locus = {
|
|
4914
|
+
url: 'url',
|
|
4915
|
+
participants: [
|
|
4916
|
+
{
|
|
4917
|
+
id: 'participant-zero',
|
|
4918
|
+
htMeta: {elementId: {id: 0}},
|
|
4919
|
+
},
|
|
4920
|
+
],
|
|
4921
|
+
};
|
|
4922
|
+
|
|
4923
|
+
sinon.stub(locusInfo.locusParser, 'isNewFullLocus').returns(true);
|
|
4924
|
+
sinon.stub(locusInfo, 'updateLocusInfo');
|
|
4925
|
+
sinon.stub(locusInfo, 'updateParticipants');
|
|
4926
|
+
sinon.stub(locusInfo, 'isMeetingActive');
|
|
4927
|
+
sinon.stub(locusInfo, 'handleOneOnOneEvent');
|
|
4928
|
+
sinon.stub(locusInfo, 'updateEmbeddedApps');
|
|
4929
|
+
locusInfo.locusParser.workingCopy = null;
|
|
4930
|
+
|
|
4931
|
+
locusInfo.onFullLocus('test', locus);
|
|
4932
|
+
|
|
4933
|
+
assert.equal(locusInfo.hashTreeObjectId2ParticipantId.get(0), 'participant-zero');
|
|
4934
|
+
});
|
|
4935
|
+
});
|
|
4936
|
+
|
|
4937
|
+
describe('#onDeltaLocus', () => {
|
|
4938
|
+
it('should use forceReplaceMembers from jsSdkMeta when it is defined', () => {
|
|
4939
|
+
sinon.stub(locusInfo, 'mergeParticipants');
|
|
4940
|
+
sinon.stub(locusInfo, 'updateLocusInfo').returns(true);
|
|
4941
|
+
sinon.stub(locusInfo, 'updateParticipants');
|
|
4942
|
+
sinon.stub(locusInfo, 'isMeetingActive');
|
|
4943
|
+
|
|
4944
|
+
locusInfo.onDeltaLocus({
|
|
4945
|
+
participants: [],
|
|
4946
|
+
jsSdkMeta: {forceReplaceMembers: true, removedParticipantIds: []},
|
|
4947
|
+
});
|
|
4948
|
+
|
|
4949
|
+
assert.calledOnceWithExactly(locusInfo.updateParticipants, [], [], true);
|
|
4950
|
+
});
|
|
4951
|
+
|
|
4952
|
+
it('should fall back to isNeedReplaceMembers when forceReplaceMembers is not in jsSdkMeta', () => {
|
|
4953
|
+
sinon.stub(locusInfo, 'mergeParticipants');
|
|
4954
|
+
sinon.stub(locusInfo, 'updateLocusInfo').returns(true);
|
|
4955
|
+
sinon.stub(locusInfo, 'updateParticipants');
|
|
4956
|
+
sinon.stub(locusInfo, 'isMeetingActive');
|
|
4957
|
+
|
|
4958
|
+
locusInfo.onDeltaLocus({participants: []});
|
|
4959
|
+
|
|
4960
|
+
// without jsSdkMeta.forceReplaceMembers, uses ControlsUtils.isNeedReplaceMembers result (false by default)
|
|
4961
|
+
assert.calledOnceWithExactly(locusInfo.updateParticipants, [], undefined, false);
|
|
4962
|
+
});
|
|
4963
|
+
|
|
4964
|
+
it('should not call updateParticipants when updateLocusInfo returns false', () => {
|
|
4965
|
+
sinon.stub(locusInfo, 'mergeParticipants');
|
|
4966
|
+
sinon.stub(locusInfo, 'updateLocusInfo').returns(false);
|
|
4967
|
+
sinon.stub(locusInfo, 'updateParticipants');
|
|
4968
|
+
sinon.stub(locusInfo, 'isMeetingActive');
|
|
4969
|
+
|
|
4970
|
+
locusInfo.onDeltaLocus({participants: [], self: {state: 'LEFT', reason: 'MOVED'}});
|
|
4971
|
+
|
|
4972
|
+
assert.notCalled(locusInfo.updateParticipants);
|
|
4973
|
+
});
|
|
4974
|
+
|
|
4975
|
+
it('should call updateParticipants when updateLocusInfo returns true', () => {
|
|
4976
|
+
sinon.stub(locusInfo, 'mergeParticipants');
|
|
4977
|
+
sinon.stub(locusInfo, 'updateLocusInfo').returns(true);
|
|
4978
|
+
sinon.stub(locusInfo, 'updateParticipants');
|
|
4979
|
+
sinon.stub(locusInfo, 'isMeetingActive');
|
|
4980
|
+
|
|
4981
|
+
locusInfo.onDeltaLocus({participants: [{id: 'p1'}]});
|
|
4982
|
+
|
|
4983
|
+
assert.calledOnce(locusInfo.updateParticipants);
|
|
4984
|
+
});
|
|
4985
|
+
|
|
4986
|
+
[
|
|
4987
|
+
{forceReplaceMembers: true, selfInParticipants: false, expectedSelfCopied: true},
|
|
4988
|
+
{forceReplaceMembers: true, selfInParticipants: true, expectedSelfCopied: false},
|
|
4989
|
+
{forceReplaceMembers: false, selfInParticipants: false, expectedSelfCopied: false},
|
|
4990
|
+
{forceReplaceMembers: false, selfInParticipants: true, expectedSelfCopied: false},
|
|
4991
|
+
].forEach(({forceReplaceMembers, selfInParticipants, expectedSelfCopied}) => {
|
|
4992
|
+
it(`should ${expectedSelfCopied ? '' : 'not '}copy self into participants when forceReplaceMembers=${forceReplaceMembers} and self ${selfInParticipants ? 'is' : 'is not'} in participants`, () => {
|
|
4993
|
+
const self = {identity: 'selfId', state: 'JOINED', devices: [], status: {}};
|
|
4994
|
+
const participant = {identity: selfInParticipants ? 'selfId' : 'other'};
|
|
4995
|
+
const locus = {
|
|
4996
|
+
participants: [participant],
|
|
4997
|
+
self,
|
|
4998
|
+
jsSdkMeta: {forceReplaceMembers, removedParticipantIds: []},
|
|
4999
|
+
};
|
|
5000
|
+
|
|
5001
|
+
locusInfo.onDeltaLocus(locus);
|
|
5002
|
+
|
|
5003
|
+
const expectedParticipants = expectedSelfCopied ? [participant, self] : [participant];
|
|
5004
|
+
assert.deepEqual(locus.participants, expectedParticipants);
|
|
5005
|
+
});
|
|
5006
|
+
});
|
|
5007
|
+
});
|
|
5008
|
+
|
|
5009
|
+
describe('#updateLocusInfo', () => {
|
|
5010
|
+
it('should return false when self.reason is MOVED and self.state is LEFT', () => {
|
|
5011
|
+
sinon.stub(locusInfo, 'updateControls');
|
|
5012
|
+
|
|
5013
|
+
const result = locusInfo.updateLocusInfo({self: {reason: 'MOVED', state: 'LEFT'}});
|
|
5014
|
+
|
|
5015
|
+
assert.isFalse(result);
|
|
5016
|
+
assert.notCalled(locusInfo.updateControls);
|
|
5017
|
+
});
|
|
5018
|
+
|
|
5019
|
+
it('should return true when self is not in MOVED/LEFT state', () => {
|
|
5020
|
+
sinon.stub(locusInfo, 'updateControls');
|
|
5021
|
+
sinon.stub(locusInfo, 'updateConversationUrl');
|
|
5022
|
+
sinon.stub(locusInfo, 'updateCreated');
|
|
5023
|
+
sinon.stub(locusInfo, 'updateFullState');
|
|
5024
|
+
sinon.stub(locusInfo, 'updateHostInfo');
|
|
5025
|
+
sinon.stub(locusInfo, 'updateLocusUrl');
|
|
5026
|
+
sinon.stub(locusInfo, 'updateMeetingInfo');
|
|
5027
|
+
sinon.stub(locusInfo, 'updateMediaShares');
|
|
5028
|
+
sinon.stub(locusInfo, 'updateReplaces');
|
|
5029
|
+
sinon.stub(locusInfo, 'updateSelf');
|
|
5030
|
+
sinon.stub(locusInfo, 'updateAclUrl');
|
|
5031
|
+
sinon.stub(locusInfo, 'updateBasequence');
|
|
5032
|
+
sinon.stub(locusInfo, 'updateSequence');
|
|
5033
|
+
sinon.stub(locusInfo, 'updateEmbeddedApps');
|
|
5034
|
+
sinon.stub(locusInfo, 'updateLinks');
|
|
5035
|
+
sinon.stub(locusInfo, 'compareAndUpdate');
|
|
5036
|
+
|
|
5037
|
+
const result = locusInfo.updateLocusInfo({self: {state: 'JOINED'}});
|
|
5038
|
+
|
|
5039
|
+
assert.isTrue(result);
|
|
5040
|
+
assert.calledOnce(locusInfo.updateControls);
|
|
5041
|
+
});
|
|
3654
5042
|
});
|
|
3655
5043
|
|
|
3656
5044
|
describe('#getTheLocusToUpdate', () => {
|
|
@@ -3847,6 +5235,31 @@ describe('plugin-meetings', () => {
|
|
|
3847
5235
|
});
|
|
3848
5236
|
});
|
|
3849
5237
|
|
|
5238
|
+
describe('#cleanUp', () => {
|
|
5239
|
+
it('calls cleanUp on all hash tree parsers and clears maps', () => {
|
|
5240
|
+
const parser1 = {cleanUp: sinon.stub()};
|
|
5241
|
+
const parser2 = {cleanUp: sinon.stub()};
|
|
5242
|
+
|
|
5243
|
+
locusInfo.hashTreeParsers.set('url1', {parser: parser1, initializedFromHashTree: true});
|
|
5244
|
+
locusInfo.hashTreeParsers.set('url2', {parser: parser2, initializedFromHashTree: true});
|
|
5245
|
+
locusInfo.hashTreeObjectId2ParticipantId.set(1, 'participant1');
|
|
5246
|
+
|
|
5247
|
+
locusInfo.cleanUp();
|
|
5248
|
+
|
|
5249
|
+
assert.calledOnce(parser1.cleanUp);
|
|
5250
|
+
assert.calledOnce(parser2.cleanUp);
|
|
5251
|
+
assert.equal(locusInfo.hashTreeParsers.size, 0);
|
|
5252
|
+
assert.equal(locusInfo.hashTreeObjectId2ParticipantId.size, 0);
|
|
5253
|
+
});
|
|
5254
|
+
|
|
5255
|
+
it('works when there are no hash tree parsers', () => {
|
|
5256
|
+
locusInfo.cleanUp();
|
|
5257
|
+
|
|
5258
|
+
assert.equal(locusInfo.hashTreeParsers.size, 0);
|
|
5259
|
+
assert.equal(locusInfo.hashTreeObjectId2ParticipantId.size, 0);
|
|
5260
|
+
});
|
|
5261
|
+
});
|
|
5262
|
+
|
|
3850
5263
|
describe('#handleOneonOneEvent', () => {
|
|
3851
5264
|
beforeEach(() => {
|
|
3852
5265
|
locusInfo.emitScoped = sinon.stub();
|
|
@@ -3889,6 +5302,9 @@ describe('plugin-meetings', () => {
|
|
|
3889
5302
|
});
|
|
3890
5303
|
|
|
3891
5304
|
describe('#isMeetingActive', () => {
|
|
5305
|
+
beforeEach(() => {
|
|
5306
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
5307
|
+
});
|
|
3892
5308
|
forEach([_CALL_, _SIP_BRIDGE_, _SPACE_SHARE_], (type) => {
|
|
3893
5309
|
describe(`type = ${type}`, () => {
|
|
3894
5310
|
it('sends client event correctly for state = inactive', () => {
|
|
@@ -3909,6 +5325,11 @@ describe('plugin-meetings', () => {
|
|
|
3909
5325
|
options: {
|
|
3910
5326
|
meetingId: locusInfo.meetingId,
|
|
3911
5327
|
},
|
|
5328
|
+
payload: {
|
|
5329
|
+
eventData: {
|
|
5330
|
+
joinInProgress: false,
|
|
5331
|
+
},
|
|
5332
|
+
},
|
|
3912
5333
|
});
|
|
3913
5334
|
});
|
|
3914
5335
|
|
|
@@ -3929,6 +5350,11 @@ describe('plugin-meetings', () => {
|
|
|
3929
5350
|
options: {
|
|
3930
5351
|
meetingId: locusInfo.meetingId,
|
|
3931
5352
|
},
|
|
5353
|
+
payload: {
|
|
5354
|
+
eventData: {
|
|
5355
|
+
joinInProgress: false,
|
|
5356
|
+
},
|
|
5357
|
+
},
|
|
3932
5358
|
});
|
|
3933
5359
|
});
|
|
3934
5360
|
|
|
@@ -3950,12 +5376,17 @@ describe('plugin-meetings', () => {
|
|
|
3950
5376
|
options: {
|
|
3951
5377
|
meetingId: locusInfo.meetingId,
|
|
3952
5378
|
},
|
|
5379
|
+
payload: {
|
|
5380
|
+
eventData: {
|
|
5381
|
+
joinInProgress: false,
|
|
5382
|
+
},
|
|
5383
|
+
},
|
|
3953
5384
|
});
|
|
3954
5385
|
});
|
|
3955
5386
|
});
|
|
3956
5387
|
});
|
|
3957
5388
|
|
|
3958
|
-
it('sends client event correctly for state =
|
|
5389
|
+
it('sends client event correctly for state = MEETING_INACTIVE', () => {
|
|
3959
5390
|
locusInfo.getLocusPartner = sinon.stub().returns({state: MEETING_STATE.STATES.LEFT});
|
|
3960
5391
|
locusInfo.parsedLocus = {
|
|
3961
5392
|
fullState: {
|
|
@@ -3977,7 +5408,7 @@ describe('plugin-meetings', () => {
|
|
|
3977
5408
|
});
|
|
3978
5409
|
});
|
|
3979
5410
|
|
|
3980
|
-
it('
|
|
5411
|
+
it('does not send client event when state = INACTIVE and endMeetingReason = BREAKOUT_ENDED', () => {
|
|
3981
5412
|
locusInfo.getLocusPartner = sinon.stub().returns({state: MEETING_STATE.STATES.LEFT});
|
|
3982
5413
|
locusInfo.parsedLocus = {
|
|
3983
5414
|
fullState: {
|
|
@@ -3986,16 +5417,127 @@ describe('plugin-meetings', () => {
|
|
|
3986
5417
|
};
|
|
3987
5418
|
|
|
3988
5419
|
locusInfo.fullState = {
|
|
3989
|
-
|
|
5420
|
+
state: LOCUS.STATE.INACTIVE,
|
|
5421
|
+
endMeetingReason: 'BREAKOUT_ENDED',
|
|
3990
5422
|
};
|
|
3991
5423
|
|
|
3992
5424
|
locusInfo.isMeetingActive();
|
|
3993
5425
|
|
|
3994
|
-
assert.
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
5426
|
+
assert.notCalled(webex.internal.newMetrics.submitClientEvent);
|
|
5427
|
+
});
|
|
5428
|
+
|
|
5429
|
+
it('sends client event correctly for state self removed', () => {
|
|
5430
|
+
locusInfo.emitScoped = sinon.stub();
|
|
5431
|
+
locusInfo.parsedLocus = {
|
|
5432
|
+
fullState: {
|
|
5433
|
+
type: _MEETING_,
|
|
5434
|
+
},
|
|
5435
|
+
self: {
|
|
5436
|
+
removed: true,
|
|
5437
|
+
}
|
|
5438
|
+
};
|
|
5439
|
+
|
|
5440
|
+
locusInfo.isMeetingActive();
|
|
5441
|
+
|
|
5442
|
+
assert.notCalled(webex.internal.newMetrics.submitClientEvent);
|
|
5443
|
+
assert.calledOnceWithExactly(
|
|
5444
|
+
locusInfo.emitScoped,
|
|
5445
|
+
{
|
|
5446
|
+
file: 'locus-info',
|
|
5447
|
+
function: 'isMeetingActive',
|
|
3998
5448
|
},
|
|
5449
|
+
EVENTS.DESTROY_MEETING,
|
|
5450
|
+
{
|
|
5451
|
+
reason: MEETING_REMOVED_REASON.SELF_REMOVED,
|
|
5452
|
+
shouldLeave: false,
|
|
5453
|
+
}
|
|
5454
|
+
);
|
|
5455
|
+
});
|
|
5456
|
+
|
|
5457
|
+
describe('destroyMeetingSuspended', () => {
|
|
5458
|
+
it('suppresses DESTROY_MEETING for SELF_REMOVED when suspended', () => {
|
|
5459
|
+
locusInfo.emitScoped = sinon.stub();
|
|
5460
|
+
locusInfo.suspendDestroyMeeting(true);
|
|
5461
|
+
locusInfo.parsedLocus = {
|
|
5462
|
+
fullState: {
|
|
5463
|
+
type: _MEETING_,
|
|
5464
|
+
},
|
|
5465
|
+
self: {
|
|
5466
|
+
removed: true,
|
|
5467
|
+
}
|
|
5468
|
+
};
|
|
5469
|
+
|
|
5470
|
+
locusInfo.isMeetingActive();
|
|
5471
|
+
|
|
5472
|
+
assert.notCalled(locusInfo.emitScoped);
|
|
5473
|
+
assert.calledOnceWithExactly(
|
|
5474
|
+
sendBehavioralMetricStub,
|
|
5475
|
+
BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED,
|
|
5476
|
+
{
|
|
5477
|
+
meetingId: locusInfo.meetingId,
|
|
5478
|
+
reason: 'SELF_REMOVED',
|
|
5479
|
+
}
|
|
5480
|
+
);
|
|
5481
|
+
});
|
|
5482
|
+
|
|
5483
|
+
it('suppresses DESTROY_MEETING for MEETING_INACTIVE_TERMINATING when suspended', () => {
|
|
5484
|
+
locusInfo.emitScoped = sinon.stub();
|
|
5485
|
+
locusInfo.suspendDestroyMeeting(true);
|
|
5486
|
+
locusInfo.parsedLocus = {
|
|
5487
|
+
fullState: {
|
|
5488
|
+
type: _MEETING_,
|
|
5489
|
+
},
|
|
5490
|
+
};
|
|
5491
|
+
locusInfo.fullState = {
|
|
5492
|
+
state: LOCUS.STATE.INACTIVE,
|
|
5493
|
+
};
|
|
5494
|
+
|
|
5495
|
+
locusInfo.isMeetingActive();
|
|
5496
|
+
|
|
5497
|
+
assert.notCalled(locusInfo.emitScoped);
|
|
5498
|
+
assert.notCalled(webex.internal.newMetrics.submitClientEvent);
|
|
5499
|
+
assert.calledOnceWithExactly(
|
|
5500
|
+
sendBehavioralMetricStub,
|
|
5501
|
+
BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED,
|
|
5502
|
+
{
|
|
5503
|
+
meetingId: locusInfo.meetingId,
|
|
5504
|
+
reason: 'MEETING_INACTIVE_TERMINATING',
|
|
5505
|
+
}
|
|
5506
|
+
);
|
|
5507
|
+
});
|
|
5508
|
+
|
|
5509
|
+
[
|
|
5510
|
+
{reason: 'CALL_INACTIVE', setup: () => {
|
|
5511
|
+
locusInfo.parsedLocus = {fullState: {type: _CALL_}};
|
|
5512
|
+
locusInfo.fullState = {state: LOCUS.STATE.INACTIVE};
|
|
5513
|
+
}},
|
|
5514
|
+
{reason: 'PARTNER_LEFT', setup: () => {
|
|
5515
|
+
locusInfo.getLocusPartner = sinon.stub().returns({state: MEETING_STATE.STATES.LEFT});
|
|
5516
|
+
locusInfo.parsedLocus = {fullState: {type: _CALL_}, self: {state: MEETING_STATE.STATES.JOINED}};
|
|
5517
|
+
}},
|
|
5518
|
+
{reason: 'SELF_LEFT', setup: () => {
|
|
5519
|
+
locusInfo.getLocusPartner = sinon.stub().returns({state: MEETING_STATE.STATES.LEFT});
|
|
5520
|
+
locusInfo.parsedLocus = {fullState: {type: _CALL_}, self: {state: MEETING_STATE.STATES.LEFT}};
|
|
5521
|
+
}},
|
|
5522
|
+
].forEach(({reason, setup}) => {
|
|
5523
|
+
it(`sends joinInProgress=true in client event for ${reason} when suspended`, () => {
|
|
5524
|
+
locusInfo.suspendDestroyMeeting(true);
|
|
5525
|
+
setup();
|
|
5526
|
+
|
|
5527
|
+
locusInfo.isMeetingActive();
|
|
5528
|
+
|
|
5529
|
+
assert.calledWith(webex.internal.newMetrics.submitClientEvent, {
|
|
5530
|
+
name: 'client.call.remote-ended',
|
|
5531
|
+
options: {
|
|
5532
|
+
meetingId: locusInfo.meetingId,
|
|
5533
|
+
},
|
|
5534
|
+
payload: {
|
|
5535
|
+
eventData: {
|
|
5536
|
+
joinInProgress: true,
|
|
5537
|
+
},
|
|
5538
|
+
},
|
|
5539
|
+
});
|
|
5540
|
+
});
|
|
3999
5541
|
});
|
|
4000
5542
|
});
|
|
4001
5543
|
});
|
|
@@ -4334,7 +5876,9 @@ describe('plugin-meetings', () => {
|
|
|
4334
5876
|
|
|
4335
5877
|
describe('#parse', () => {
|
|
4336
5878
|
it('handles hash tree messages correctly', () => {
|
|
5879
|
+
const fakeLocusUrl = 'http://locus-url.com';
|
|
4337
5880
|
const fakeHashTreeMessage = {
|
|
5881
|
+
locusUrl: fakeLocusUrl,
|
|
4338
5882
|
locusStateElements: [
|
|
4339
5883
|
{
|
|
4340
5884
|
htMeta: {elementId: {type: 'self'}},
|
|
@@ -4353,7 +5897,10 @@ describe('plugin-meetings', () => {
|
|
|
4353
5897
|
const mockHashTreeParser = {
|
|
4354
5898
|
handleMessage: sinon.stub(),
|
|
4355
5899
|
};
|
|
4356
|
-
locusInfo.
|
|
5900
|
+
locusInfo.hashTreeParsers.set(fakeLocusUrl, {
|
|
5901
|
+
parser: mockHashTreeParser,
|
|
5902
|
+
initializedFromHashTree: true,
|
|
5903
|
+
});
|
|
4357
5904
|
|
|
4358
5905
|
locusInfo.parse(mockMeeting, data);
|
|
4359
5906
|
|
|
@@ -4373,7 +5920,7 @@ describe('plugin-meetings', () => {
|
|
|
4373
5920
|
const getTheLocusToUpdateStub = sinon.stub(locusInfo, 'getTheLocusToUpdate');
|
|
4374
5921
|
|
|
4375
5922
|
// Ensure we're not using hash trees
|
|
4376
|
-
assert.
|
|
5923
|
+
assert.equal(locusInfo.hashTreeParsers.size, 0);
|
|
4377
5924
|
|
|
4378
5925
|
locusInfo.parse(mockMeeting, data);
|
|
4379
5926
|
|
|
@@ -4383,6 +5930,31 @@ describe('plugin-meetings', () => {
|
|
|
4383
5930
|
);
|
|
4384
5931
|
assert.notCalled(getTheLocusToUpdateStub);
|
|
4385
5932
|
});
|
|
5933
|
+
|
|
5934
|
+
it('should call handleLocusAPIResponse for SDK_LOCUS_FROM_SYNC_MEETINGS when hash tree parsers exist', () => {
|
|
5935
|
+
const fakeLocusUrl = 'http://locus-url.com';
|
|
5936
|
+
const fakeLocus = {url: fakeLocusUrl, fullState: {state: 'ACTIVE'}};
|
|
5937
|
+
const mockHashTreeParser = {
|
|
5938
|
+
handleMessage: sinon.stub(),
|
|
5939
|
+
handleLocusUpdate: sinon.stub(),
|
|
5940
|
+
};
|
|
5941
|
+
locusInfo.hashTreeParsers.set(fakeLocusUrl, {
|
|
5942
|
+
parser: mockHashTreeParser,
|
|
5943
|
+
initializedFromHashTree: true,
|
|
5944
|
+
});
|
|
5945
|
+
|
|
5946
|
+
sinon.stub(locusInfo, 'handleLocusDelta');
|
|
5947
|
+
|
|
5948
|
+
locusInfo.parse(mockMeeting, {
|
|
5949
|
+
eventType: LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS,
|
|
5950
|
+
locus: fakeLocus,
|
|
5951
|
+
});
|
|
5952
|
+
|
|
5953
|
+
// should route through handleLocusAPIResponse which passes unwrapped LocusDTO to parser
|
|
5954
|
+
assert.calledOnce(mockHashTreeParser.handleLocusUpdate);
|
|
5955
|
+
assert.notCalled(mockHashTreeParser.handleMessage);
|
|
5956
|
+
assert.notCalled(locusInfo.handleLocusDelta);
|
|
5957
|
+
});
|
|
4386
5958
|
});
|
|
4387
5959
|
});
|
|
4388
5960
|
|
|
@@ -4552,4 +6124,176 @@ describe('plugin-meetings', () => {
|
|
|
4552
6124
|
assert.deepEqual(result.locus, {participants: [], url: LOCUS_URL});
|
|
4553
6125
|
});
|
|
4554
6126
|
});
|
|
6127
|
+
|
|
6128
|
+
describe('findMeetingForHashTreeMessage', () => {
|
|
6129
|
+
const deviceUrl = 'https://devices.example.com/device1';
|
|
6130
|
+
|
|
6131
|
+
function createMockMeetingCollection(meetings) {
|
|
6132
|
+
return {
|
|
6133
|
+
getAll: () => meetings,
|
|
6134
|
+
};
|
|
6135
|
+
}
|
|
6136
|
+
|
|
6137
|
+
function createMockMeeting(id, hashTreeParsersMap) {
|
|
6138
|
+
return {
|
|
6139
|
+
id,
|
|
6140
|
+
locusInfo: {
|
|
6141
|
+
hashTreeParsers: hashTreeParsersMap,
|
|
6142
|
+
},
|
|
6143
|
+
};
|
|
6144
|
+
}
|
|
6145
|
+
|
|
6146
|
+
function createSelfElement(devices) {
|
|
6147
|
+
return {
|
|
6148
|
+
htMeta: {elementId: {type: 'Self'}},
|
|
6149
|
+
data: {
|
|
6150
|
+
deviceUrl,
|
|
6151
|
+
devices,
|
|
6152
|
+
},
|
|
6153
|
+
};
|
|
6154
|
+
}
|
|
6155
|
+
|
|
6156
|
+
it('returns the meeting when locusUrl matches a hashTreeParser directly', () => {
|
|
6157
|
+
const locusUrl = 'https://locus.example.com/loci/abc123';
|
|
6158
|
+
const parsersMap = new Map([[locusUrl, {state: 'active'}]]);
|
|
6159
|
+
const meeting = createMockMeeting('meeting1', parsersMap);
|
|
6160
|
+
const collection = createMockMeetingCollection({meeting1: meeting});
|
|
6161
|
+
|
|
6162
|
+
const message = {locusUrl, locusStateElements: []};
|
|
6163
|
+
|
|
6164
|
+
const result = findMeetingForHashTreeMessage(message, collection, deviceUrl);
|
|
6165
|
+
|
|
6166
|
+
assert.equal(result, meeting);
|
|
6167
|
+
});
|
|
6168
|
+
|
|
6169
|
+
it('returns undefined when no meeting matches and message has no locusStateElements', () => {
|
|
6170
|
+
const locusUrl = 'https://locus.example.com/loci/unknown';
|
|
6171
|
+
const parsersMap = new Map([['https://locus.example.com/loci/other', {state: 'active'}]]);
|
|
6172
|
+
const meeting = createMockMeeting('meeting1', parsersMap);
|
|
6173
|
+
const collection = createMockMeetingCollection({meeting1: meeting});
|
|
6174
|
+
|
|
6175
|
+
const message = {locusUrl};
|
|
6176
|
+
|
|
6177
|
+
const result = findMeetingForHashTreeMessage(message, collection, deviceUrl);
|
|
6178
|
+
|
|
6179
|
+
assert.isUndefined(result);
|
|
6180
|
+
});
|
|
6181
|
+
|
|
6182
|
+
it('returns undefined when no meeting matches and self element has no replaces', () => {
|
|
6183
|
+
const locusUrl = 'https://locus.example.com/loci/unknown';
|
|
6184
|
+
const parsersMap = new Map([['https://locus.example.com/loci/other', {state: 'active'}]]);
|
|
6185
|
+
const meeting = createMockMeeting('meeting1', parsersMap);
|
|
6186
|
+
const collection = createMockMeetingCollection({meeting1: meeting});
|
|
6187
|
+
|
|
6188
|
+
const selfElement = createSelfElement([{url: deviceUrl}]);
|
|
6189
|
+
const message = {locusUrl, locusStateElements: [selfElement]};
|
|
6190
|
+
|
|
6191
|
+
const result = findMeetingForHashTreeMessage(message, collection, deviceUrl);
|
|
6192
|
+
|
|
6193
|
+
assert.isUndefined(result);
|
|
6194
|
+
});
|
|
6195
|
+
|
|
6196
|
+
it('returns the meeting when locusUrl from replaces matches a hashTreeParser', () => {
|
|
6197
|
+
const oldLocusUrl = 'https://locus.example.com/loci/old';
|
|
6198
|
+
const newLocusUrl = 'https://locus.example.com/loci/new';
|
|
6199
|
+
const parsersMap = new Map([[oldLocusUrl, {state: 'active'}]]);
|
|
6200
|
+
const meeting = createMockMeeting('meeting1', parsersMap);
|
|
6201
|
+
const collection = createMockMeetingCollection({meeting1: meeting});
|
|
6202
|
+
|
|
6203
|
+
const selfElement = createSelfElement([
|
|
6204
|
+
{url: deviceUrl, replaces: [{locusUrl: oldLocusUrl}]},
|
|
6205
|
+
]);
|
|
6206
|
+
const message = {locusUrl: newLocusUrl, locusStateElements: [selfElement]};
|
|
6207
|
+
|
|
6208
|
+
const result = findMeetingForHashTreeMessage(message, collection, deviceUrl);
|
|
6209
|
+
|
|
6210
|
+
assert.equal(result, meeting);
|
|
6211
|
+
});
|
|
6212
|
+
|
|
6213
|
+
it('returns undefined when replaces locusUrl does not match any hashTreeParser', () => {
|
|
6214
|
+
const oldLocusUrl = 'https://locus.example.com/loci/old';
|
|
6215
|
+
const newLocusUrl = 'https://locus.example.com/loci/new';
|
|
6216
|
+
const parsersMap = new Map([
|
|
6217
|
+
['https://locus.example.com/loci/something-else', {state: 'active'}],
|
|
6218
|
+
]);
|
|
6219
|
+
const meeting = createMockMeeting('meeting1', parsersMap);
|
|
6220
|
+
const collection = createMockMeetingCollection({meeting1: meeting});
|
|
6221
|
+
|
|
6222
|
+
const selfElement = createSelfElement([
|
|
6223
|
+
{url: deviceUrl, replaces: [{locusUrl: oldLocusUrl}]},
|
|
6224
|
+
]);
|
|
6225
|
+
const message = {locusUrl: newLocusUrl, locusStateElements: [selfElement]};
|
|
6226
|
+
|
|
6227
|
+
const result = findMeetingForHashTreeMessage(message, collection, deviceUrl);
|
|
6228
|
+
|
|
6229
|
+
assert.isUndefined(result);
|
|
6230
|
+
});
|
|
6231
|
+
|
|
6232
|
+
it('returns undefined when meetingCollection is empty', () => {
|
|
6233
|
+
const collection = createMockMeetingCollection({});
|
|
6234
|
+
const message = {locusUrl: 'https://locus.example.com/loci/abc', locusStateElements: []};
|
|
6235
|
+
|
|
6236
|
+
const result = findMeetingForHashTreeMessage(message, collection, deviceUrl);
|
|
6237
|
+
|
|
6238
|
+
assert.isUndefined(result);
|
|
6239
|
+
});
|
|
6240
|
+
|
|
6241
|
+
it('checks multiple meetings and returns the correct one', () => {
|
|
6242
|
+
const targetLocusUrl = 'https://locus.example.com/loci/target';
|
|
6243
|
+
const meeting1 = createMockMeeting(
|
|
6244
|
+
'meeting1',
|
|
6245
|
+
new Map([['https://locus.example.com/loci/other', {state: 'active'}]])
|
|
6246
|
+
);
|
|
6247
|
+
const meeting2 = createMockMeeting(
|
|
6248
|
+
'meeting2',
|
|
6249
|
+
new Map([[targetLocusUrl, {state: 'active'}]])
|
|
6250
|
+
);
|
|
6251
|
+
const collection = createMockMeetingCollection({meeting1, meeting2});
|
|
6252
|
+
|
|
6253
|
+
const message = {locusUrl: targetLocusUrl, locusStateElements: []};
|
|
6254
|
+
|
|
6255
|
+
const result = findMeetingForHashTreeMessage(message, collection, deviceUrl);
|
|
6256
|
+
|
|
6257
|
+
assert.equal(result, meeting2);
|
|
6258
|
+
});
|
|
6259
|
+
|
|
6260
|
+
it('ignores devices that do not match deviceUrl when looking for replaces', () => {
|
|
6261
|
+
const oldLocusUrl = 'https://locus.example.com/loci/old';
|
|
6262
|
+
const newLocusUrl = 'https://locus.example.com/loci/new';
|
|
6263
|
+
const parsersMap = new Map([[oldLocusUrl, {state: 'active'}]]);
|
|
6264
|
+
const meeting = createMockMeeting('meeting1', parsersMap);
|
|
6265
|
+
const collection = createMockMeetingCollection({meeting1: meeting});
|
|
6266
|
+
|
|
6267
|
+
// self element has replaces, but on a different device
|
|
6268
|
+
const selfElement = createSelfElement([
|
|
6269
|
+
{url: 'https://devices.example.com/other-device', replaces: [{locusUrl: oldLocusUrl}]},
|
|
6270
|
+
]);
|
|
6271
|
+
const message = {locusUrl: newLocusUrl, locusStateElements: [selfElement]};
|
|
6272
|
+
|
|
6273
|
+
const result = findMeetingForHashTreeMessage(message, collection, deviceUrl);
|
|
6274
|
+
|
|
6275
|
+
assert.isUndefined(result);
|
|
6276
|
+
});
|
|
6277
|
+
|
|
6278
|
+
it('does not use self element if it is not of type Self', () => {
|
|
6279
|
+
const oldLocusUrl = 'https://locus.example.com/loci/old';
|
|
6280
|
+
const newLocusUrl = 'https://locus.example.com/loci/new';
|
|
6281
|
+
const parsersMap = new Map([[oldLocusUrl, {state: 'active'}]]);
|
|
6282
|
+
const meeting = createMockMeeting('meeting1', parsersMap);
|
|
6283
|
+
const collection = createMockMeetingCollection({meeting1: meeting});
|
|
6284
|
+
|
|
6285
|
+
// element has replaces data but is not of type Self
|
|
6286
|
+
const nonSelfElement = {
|
|
6287
|
+
htMeta: {elementId: {type: 'Participant'}},
|
|
6288
|
+
data: {
|
|
6289
|
+
devices: [{url: deviceUrl, replaces: [{locusUrl: oldLocusUrl}]}],
|
|
6290
|
+
},
|
|
6291
|
+
};
|
|
6292
|
+
const message = {locusUrl: newLocusUrl, locusStateElements: [nonSelfElement]};
|
|
6293
|
+
|
|
6294
|
+
const result = findMeetingForHashTreeMessage(message, collection, deviceUrl);
|
|
6295
|
+
|
|
6296
|
+
assert.isUndefined(result);
|
|
6297
|
+
});
|
|
6298
|
+
});
|
|
4555
6299
|
});
|