@webex/plugin-meetings 3.11.0-webex-services-ready.1 → 3.12.0-llmrefactor.1
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/AGENTS.md +9 -0
- package/dist/aiEnableRequest/index.js +197 -0
- package/dist/aiEnableRequest/index.js.map +1 -0
- package/dist/aiEnableRequest/utils.js +36 -0
- package/dist/aiEnableRequest/utils.js.map +1 -0
- package/dist/annotation/index.js +58 -13
- package/dist/annotation/index.js.map +1 -1
- 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 +124 -7
- package/dist/breakouts/index.js.map +1 -1
- package/dist/common/errors/webex-errors.js +49 -5
- package/dist/common/errors/webex-errors.js.map +1 -1
- package/dist/config.js +8 -3
- package/dist/config.js.map +1 -1
- package/dist/constants.js +60 -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 +16 -2
- package/dist/hashTree/constants.js.map +1 -1
- package/dist/hashTree/hashTree.js +18 -0
- package/dist/hashTree/hashTree.js.map +1 -1
- package/dist/hashTree/hashTreeParser.js +1655 -538
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/hashTree/types.js +4 -2
- package/dist/hashTree/types.js.map +1 -1
- package/dist/hashTree/utils.js +52 -0
- package/dist/hashTree/utils.js.map +1 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/interceptors/constant.js +12 -0
- package/dist/interceptors/constant.js.map +1 -0
- package/dist/interceptors/dataChannelAuthToken.js +332 -0
- package/dist/interceptors/dataChannelAuthToken.js.map +1 -0
- package/dist/interceptors/index.js +7 -0
- package/dist/interceptors/index.js.map +1 -1
- package/dist/interceptors/locusRetry.js +23 -8
- package/dist/interceptors/locusRetry.js.map +1 -1
- package/dist/interceptors/utils.js +27 -0
- package/dist/interceptors/utils.js.map +1 -0
- package/dist/interpretation/index.js +11 -2
- 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 +9 -4
- package/dist/locus-info/controlsUtils.js.map +1 -1
- package/dist/locus-info/index.js +914 -212
- 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/selfUtils.js +1 -0
- package/dist/locus-info/selfUtils.js.map +1 -1
- package/dist/locus-info/types.js +19 -0
- package/dist/locus-info/types.js.map +1 -1
- package/dist/media/MediaConnectionAwaiter.js +72 -3
- 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 +8 -7
- package/dist/media/properties.js.map +1 -1
- package/dist/meeting/in-meeting-actions.js +11 -1
- package/dist/meeting/in-meeting-actions.js.map +1 -1
- package/dist/meeting/index.js +2286 -1129
- 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 +55 -2
- package/dist/meeting/request.js.map +1 -1
- package/dist/meeting/request.type.js.map +1 -1
- package/dist/meeting/util.js +168 -5
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +2 -2
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meetings/index.js +369 -162
- 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 +20 -0
- package/dist/member/index.js.map +1 -1
- package/dist/member/types.js.map +1 -1
- package/dist/member/util.js +40 -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 +12 -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 +64 -68
- 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 +11 -0
- package/dist/multistream/remoteMediaManager.js.map +1 -1
- package/dist/multistream/sendSlotManager.js +116 -2
- 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/reconnection-manager/index.js +0 -1
- package/dist/reconnection-manager/index.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/aiEnableRequest/index.d.ts +5 -0
- package/dist/types/aiEnableRequest/utils.d.ts +2 -0
- package/dist/types/annotation/index.d.ts +19 -0
- package/dist/types/common/errors/webex-errors.d.ts +32 -2
- package/dist/types/config.d.ts +6 -2
- package/dist/types/constants.d.ts +35 -1
- 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 +3 -0
- package/dist/types/hashTree/hashTree.d.ts +7 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +315 -30
- package/dist/types/hashTree/types.d.ts +3 -0
- package/dist/types/hashTree/utils.d.ts +24 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/interceptors/constant.d.ts +5 -0
- package/dist/types/interceptors/dataChannelAuthToken.d.ts +43 -0
- package/dist/types/interceptors/index.d.ts +2 -1
- package/dist/types/interceptors/locusRetry.d.ts +4 -4
- package/dist/types/interceptors/utils.d.ts +1 -0
- package/dist/types/interpretation/interpretation.types.d.ts +10 -0
- package/dist/types/locus-info/index.d.ts +126 -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 +20 -2
- package/dist/types/media/properties.d.ts +8 -3
- package/dist/types/meeting/in-meeting-actions.d.ts +10 -0
- package/dist/types/meeting/index.d.ts +271 -16
- package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
- package/dist/types/meeting/request.d.ts +17 -1
- package/dist/types/meeting/request.type.d.ts +5 -0
- package/dist/types/meeting/util.d.ts +40 -0
- package/dist/types/meetings/index.d.ts +42 -20
- 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 +2 -0
- package/dist/types/member/types.d.ts +1 -0
- package/dist/types/member/util.d.ts +14 -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 +11 -0
- package/dist/types/multistream/codec/constants.d.ts +7 -0
- package/dist/types/multistream/mediaRequestManager.d.ts +20 -26
- package/dist/types/multistream/sendSlotManager.d.ts +23 -1
- package/dist/types/reachability/clusterReachability.d.ts +3 -3
- package/dist/types/reachability/index.d.ts +10 -3
- package/dist/types/reachability/reachability.types.d.ts +7 -0
- package/dist/types/reachability/util.d.ts +17 -0
- package/dist/types/reactions/reactions.type.d.ts +4 -0
- package/dist/types/webinar/utils.d.ts +6 -0
- package/dist/webinar/index.js +611 -164
- package/dist/webinar/index.js.map +1 -1
- package/dist/webinar/utils.js +25 -0
- package/dist/webinar/utils.js.map +1 -0
- package/package.json +24 -23
- package/src/aiEnableRequest/README.md +84 -0
- package/src/aiEnableRequest/index.ts +186 -0
- package/src/aiEnableRequest/utils.ts +25 -0
- package/src/annotation/index.ts +62 -12
- package/src/breakouts/breakout.ts +3 -1
- package/src/breakouts/events.ts +33 -11
- package/src/breakouts/index.ts +143 -3
- package/src/common/errors/webex-errors.ts +50 -3
- package/src/config.ts +6 -2
- package/src/constants.ts +49 -3
- 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/constants.ts +17 -0
- package/src/hashTree/hashTree.ts +17 -0
- package/src/hashTree/hashTreeParser.ts +1482 -361
- package/src/hashTree/types.ts +4 -0
- package/src/hashTree/utils.ts +45 -0
- package/src/index.ts +14 -1
- package/src/interceptors/constant.ts +6 -0
- package/src/interceptors/dataChannelAuthToken.ts +217 -0
- package/src/interceptors/index.ts +2 -1
- package/src/interceptors/locusRetry.ts +25 -4
- package/src/interceptors/utils.ts +16 -0
- package/src/interpretation/index.ts +29 -11
- package/src/interpretation/interpretation.types.ts +11 -0
- package/src/locus-info/controlsUtils.ts +14 -1
- package/src/locus-info/index.ts +976 -203
- package/src/locus-info/infoUtils.ts +41 -6
- package/src/locus-info/selfUtils.ts +1 -0
- package/src/locus-info/types.ts +33 -1
- package/src/media/MediaConnectionAwaiter.ts +62 -5
- package/src/media/index.ts +10 -1
- package/src/media/properties.ts +11 -4
- package/src/meeting/in-meeting-actions.ts +20 -0
- package/src/meeting/index.ts +1244 -224
- package/src/meeting/locusMediaRequest.ts +106 -6
- package/src/meeting/muteState.ts +10 -1
- package/src/meeting/request.ts +53 -0
- package/src/meeting/request.type.ts +6 -0
- package/src/meeting/util.ts +207 -7
- package/src/meeting-info/meeting-info-v2.ts +4 -2
- package/src/meetings/index.ts +319 -117
- 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/index.ts +20 -0
- package/src/member/types.ts +1 -0
- package/src/member/util.ts +41 -0
- package/src/members/index.ts +70 -7
- package/src/members/util.ts +12 -4
- package/src/metrics/constants.ts +12 -0
- package/src/multistream/codec/constants.ts +58 -0
- package/src/multistream/mediaRequestManager.ts +117 -76
- package/src/multistream/receiveSlot.ts +18 -0
- package/src/multistream/remoteMediaManager.ts +13 -0
- package/src/multistream/sendSlotManager.ts +97 -3
- 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/reactions.type.ts +4 -0
- package/src/reconnection-manager/index.ts +0 -1
- package/src/recording-controller/index.ts +1 -2
- package/src/roap/turnDiscovery.ts +9 -1
- package/src/webinar/index.ts +415 -11
- package/src/webinar/utils.ts +16 -0
- package/test/unit/spec/aiEnableRequest/index.ts +1067 -0
- package/test/unit/spec/aiEnableRequest/utils.ts +130 -0
- package/test/unit/spec/annotation/index.ts +228 -134
- 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 +305 -18
- 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/hashTree.ts +66 -0
- package/test/unit/spec/hashTree/hashTreeParser.ts +4528 -171
- package/test/unit/spec/hashTree/utils.ts +125 -1
- package/test/unit/spec/interceptors/dataChannelAuthToken.ts +388 -0
- package/test/unit/spec/interceptors/locusRetry.ts +205 -4
- package/test/unit/spec/interceptors/utils.ts +75 -0
- package/test/unit/spec/interpretation/index.ts +26 -4
- package/test/unit/spec/locus-info/controlsUtils.js +200 -56
- package/test/unit/spec/locus-info/index.js +1861 -149
- package/test/unit/spec/locus-info/infoUtils.js +184 -1
- package/test/unit/spec/media/MediaConnectionAwaiter.ts +96 -1
- package/test/unit/spec/media/index.ts +92 -0
- package/test/unit/spec/media/properties.ts +35 -26
- package/test/unit/spec/meeting/in-meeting-actions.ts +12 -2
- package/test/unit/spec/meeting/index.js +3573 -353
- 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 +82 -0
- package/test/unit/spec/meeting/utils.js +595 -27
- package/test/unit/spec/meeting-info/meetinginfov2.js +19 -10
- package/test/unit/spec/meetings/index.js +1138 -86
- 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 +35 -4
- package/test/unit/spec/member/util.js +154 -27
- 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 +503 -122
- package/test/unit/spec/multistream/remoteMediaManager.ts +30 -0
- package/test/unit/spec/multistream/sendSlotManager.ts +135 -36
- package/test/unit/spec/reachability/index.ts +128 -46
- package/test/unit/spec/reachability/util.ts +31 -0
- package/test/unit/spec/reconnection-manager/index.js +4 -8
- 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 +1087 -167
- package/test/unit/spec/webinar/utils.ts +39 -0
|
@@ -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 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,
|
|
@@ -29,7 +31,9 @@ import {
|
|
|
29
31
|
} from '../../../../src/constants';
|
|
30
32
|
|
|
31
33
|
import {self, selfWithInactivity} from './selfConstant';
|
|
32
|
-
import {
|
|
34
|
+
import {MEETING_REMOVED_REASON} from '@webex/plugin-meetings/src/constants';
|
|
35
|
+
import BEHAVIORAL_METRICS from '@webex/plugin-meetings/src/metrics/constants';
|
|
36
|
+
import LoggerProxy from '@webex/plugin-meetings/src/common/logs/logger-proxy';
|
|
33
37
|
|
|
34
38
|
describe('plugin-meetings', () => {
|
|
35
39
|
describe('LocusInfo index', () => {
|
|
@@ -54,7 +58,7 @@ describe('plugin-meetings', () => {
|
|
|
54
58
|
|
|
55
59
|
beforeEach(() => {
|
|
56
60
|
mockMeeting = {};
|
|
57
|
-
locusInfo = new LocusInfo(updateMeeting, webex, meetingId);
|
|
61
|
+
locusInfo = new LocusInfo({updateMeeting}, webex, meetingId);
|
|
58
62
|
|
|
59
63
|
locusInfo.init(locus);
|
|
60
64
|
|
|
@@ -104,9 +108,10 @@ describe('plugin-meetings', () => {
|
|
|
104
108
|
});
|
|
105
109
|
|
|
106
110
|
const createHashTreeMessage = (visibleDataSets) => ({
|
|
111
|
+
locusUrl: 'http://locus-url.com',
|
|
107
112
|
locusStateElements: [
|
|
108
113
|
{
|
|
109
|
-
htMeta: {elementId: {type: '
|
|
114
|
+
htMeta: {elementId: {type: 'metadata'}},
|
|
110
115
|
data: {visibleDataSets},
|
|
111
116
|
},
|
|
112
117
|
],
|
|
@@ -114,6 +119,7 @@ describe('plugin-meetings', () => {
|
|
|
114
119
|
});
|
|
115
120
|
|
|
116
121
|
const createLocusWithVisibleDataSets = (visibleDataSets) => ({
|
|
122
|
+
url: 'http://locus-url.com',
|
|
117
123
|
self: {visibleDataSets},
|
|
118
124
|
participants: [],
|
|
119
125
|
links: {
|
|
@@ -136,11 +142,17 @@ describe('plugin-meetings', () => {
|
|
|
136
142
|
HashTreeParserStub,
|
|
137
143
|
sinon.match({
|
|
138
144
|
initialLocus: {
|
|
139
|
-
locus:
|
|
140
|
-
dataSets:
|
|
145
|
+
locus: null,
|
|
146
|
+
dataSets: hashTreeMessage.dataSets,
|
|
147
|
+
},
|
|
148
|
+
metadata: {
|
|
149
|
+
htMeta: hashTreeMessage.locusStateElements[0].htMeta,
|
|
150
|
+
visibleDataSets,
|
|
141
151
|
},
|
|
142
152
|
webexRequest: sinon.match.func,
|
|
143
|
-
|
|
153
|
+
callbacks: sinon.match({
|
|
154
|
+
locusInfoUpdateCallback: sinon.match.func,
|
|
155
|
+
}),
|
|
144
156
|
debugId: sinon.match.string,
|
|
145
157
|
})
|
|
146
158
|
);
|
|
@@ -150,6 +162,39 @@ describe('plugin-meetings', () => {
|
|
|
150
162
|
assert.isTrue(locusInfo.emitChange);
|
|
151
163
|
});
|
|
152
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
|
+
|
|
153
198
|
it('should not initialize the hash tree when triggered from a non-hash tree locus message', async () => {
|
|
154
199
|
const locus = {url: 'http://locus-url.com', participants: []};
|
|
155
200
|
|
|
@@ -169,11 +214,16 @@ describe('plugin-meetings', () => {
|
|
|
169
214
|
const visibleDataSets = ['dataset1', 'dataset2'];
|
|
170
215
|
const locus = createLocusWithVisibleDataSets(visibleDataSets);
|
|
171
216
|
const dataSets = [{name: 'dataset1', url: 'http://dataset-url.com'}];
|
|
217
|
+
const metadata = {
|
|
218
|
+
htMeta: {elementId: {type: 'metadata'}},
|
|
219
|
+
visibleDataSets,
|
|
220
|
+
};
|
|
172
221
|
|
|
173
222
|
await locusInfo.initialSetup({
|
|
174
223
|
trigger: 'join-response',
|
|
175
224
|
locus,
|
|
176
225
|
dataSets,
|
|
226
|
+
metadata,
|
|
177
227
|
});
|
|
178
228
|
|
|
179
229
|
assert.calledOnceWithExactly(
|
|
@@ -183,8 +233,11 @@ describe('plugin-meetings', () => {
|
|
|
183
233
|
locus,
|
|
184
234
|
dataSets,
|
|
185
235
|
},
|
|
236
|
+
metadata,
|
|
186
237
|
webexRequest: sinon.match.func,
|
|
187
|
-
|
|
238
|
+
callbacks: sinon.match({
|
|
239
|
+
locusInfoUpdateCallback: sinon.match.func,
|
|
240
|
+
}),
|
|
188
241
|
debugId: sinon.match.string,
|
|
189
242
|
})
|
|
190
243
|
);
|
|
@@ -207,6 +260,47 @@ describe('plugin-meetings', () => {
|
|
|
207
260
|
assert.isTrue(locusInfo.emitChange);
|
|
208
261
|
});
|
|
209
262
|
|
|
263
|
+
it('calls onLocusSynced callback passed as second argument with full locus from join response', async () => {
|
|
264
|
+
const syncedLocus = {url: 'http://locus-url.com', participants: []};
|
|
265
|
+
const onLocusSynced = sinon.stub();
|
|
266
|
+
|
|
267
|
+
await locusInfo.initialSetup(
|
|
268
|
+
{
|
|
269
|
+
trigger: 'join-response',
|
|
270
|
+
locus: syncedLocus,
|
|
271
|
+
},
|
|
272
|
+
onLocusSynced
|
|
273
|
+
);
|
|
274
|
+
|
|
275
|
+
assert.calledOnceWithExactly(onLocusSynced, syncedLocus);
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
it('swallows onLocusSynced callback errors and logs warn', async () => {
|
|
279
|
+
const syncedLocus = {url: 'http://locus-url.com', participants: []};
|
|
280
|
+
const callbackError = new Error('onLocusSynced failed');
|
|
281
|
+
const onLocusSynced = sinon.stub().throws(callbackError);
|
|
282
|
+
const loggerWarnStub = LoggerProxy.logger.warn?.isSinonProxy
|
|
283
|
+
? LoggerProxy.logger.warn
|
|
284
|
+
: sinon.stub(LoggerProxy.logger, 'warn');
|
|
285
|
+
|
|
286
|
+
loggerWarnStub.resetHistory();
|
|
287
|
+
|
|
288
|
+
await locusInfo.initialSetup(
|
|
289
|
+
{
|
|
290
|
+
trigger: 'join-response',
|
|
291
|
+
locus: syncedLocus,
|
|
292
|
+
},
|
|
293
|
+
onLocusSynced
|
|
294
|
+
);
|
|
295
|
+
|
|
296
|
+
assert.calledOnceWithExactly(onLocusSynced, syncedLocus);
|
|
297
|
+
assert.calledOnce(loggerWarnStub);
|
|
298
|
+
assert.match(
|
|
299
|
+
loggerWarnStub.firstCall.args[0],
|
|
300
|
+
/Locus-info:index#initialSetup --> onLocusSynced callback failed/
|
|
301
|
+
);
|
|
302
|
+
});
|
|
303
|
+
|
|
210
304
|
it('should initialize the hash tree parser correctly when triggered from a get loci response containing visible datasets', async () => {
|
|
211
305
|
const visibleDataSets = ['dataset1', 'dataset2'];
|
|
212
306
|
const locus = createLocusWithVisibleDataSets(visibleDataSets);
|
|
@@ -220,12 +314,15 @@ describe('plugin-meetings', () => {
|
|
|
220
314
|
HashTreeParserStub,
|
|
221
315
|
sinon.match({
|
|
222
316
|
initialLocus: {
|
|
223
|
-
locus:
|
|
317
|
+
locus: null,
|
|
224
318
|
dataSets: [],
|
|
225
319
|
},
|
|
226
320
|
webexRequest: sinon.match.func,
|
|
227
|
-
|
|
321
|
+
callbacks: sinon.match({
|
|
322
|
+
locusInfoUpdateCallback: sinon.match.func,
|
|
323
|
+
}),
|
|
228
324
|
debugId: sinon.match.string,
|
|
325
|
+
metadata: null,
|
|
229
326
|
})
|
|
230
327
|
);
|
|
231
328
|
assert.calledOnceWithExactly(mockHashTreeParser.initializeFromGetLociResponse, locus);
|
|
@@ -249,9 +346,34 @@ describe('plugin-meetings', () => {
|
|
|
249
346
|
assert.isTrue(locusInfo.emitChange);
|
|
250
347
|
});
|
|
251
348
|
|
|
349
|
+
it('throws if called with "locus-message" and Metadata object without visibleDataSets', async () => {
|
|
350
|
+
const hashTreeMessage = {
|
|
351
|
+
locusStateElements: [
|
|
352
|
+
{
|
|
353
|
+
htMeta: {elementId: {type: 'Metadata'}},
|
|
354
|
+
data: {},
|
|
355
|
+
},
|
|
356
|
+
],
|
|
357
|
+
dataSets: [{name: 'dataset1', url: 'test-url'}],
|
|
358
|
+
};
|
|
359
|
+
try {
|
|
360
|
+
await locusInfo.initialSetup({
|
|
361
|
+
trigger: 'locus-message',
|
|
362
|
+
hashTreeMessage,
|
|
363
|
+
});
|
|
364
|
+
assert.fail('should have thrown an error');
|
|
365
|
+
} catch (error) {
|
|
366
|
+
assert.equal(
|
|
367
|
+
error.message,
|
|
368
|
+
'Metadata object with visibleDataSets is missing in the message'
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
|
|
252
373
|
describe('should setup correct locusInfoUpdateCallback when creating HashTreeParser', () => {
|
|
253
374
|
const OBJECTS_UPDATED = HashTreeParserModule.LocusInfoUpdateType.OBJECTS_UPDATED;
|
|
254
375
|
const MEETING_ENDED = HashTreeParserModule.LocusInfoUpdateType.MEETING_ENDED;
|
|
376
|
+
const LOCUS_NOT_FOUND = HashTreeParserModule.LocusInfoUpdateType.LOCUS_NOT_FOUND;
|
|
255
377
|
|
|
256
378
|
let locusInfoUpdateCallback;
|
|
257
379
|
let onDeltaLocusStub;
|
|
@@ -263,17 +385,18 @@ describe('plugin-meetings', () => {
|
|
|
263
385
|
await locusInfo.initialSetup({
|
|
264
386
|
trigger: 'locus-message',
|
|
265
387
|
hashTreeMessage: {
|
|
388
|
+
locusUrl: 'fake-locus-url',
|
|
266
389
|
locusStateElements: [
|
|
267
390
|
{
|
|
268
|
-
htMeta: {elementId: {type: '
|
|
269
|
-
data: {visibleDataSets: ['dataset1']},
|
|
391
|
+
htMeta: {elementId: {type: 'Metadata'}},
|
|
392
|
+
data: {visibleDataSets: [{name: 'dataset1', url: 'test-url'}]},
|
|
270
393
|
},
|
|
271
394
|
],
|
|
272
395
|
dataSets: [{name: 'dataset1', url: 'test-url'}],
|
|
273
396
|
},
|
|
274
397
|
});
|
|
275
398
|
|
|
276
|
-
locusInfoUpdateCallback = HashTreeParserStub.firstCall.args[0].locusInfoUpdateCallback;
|
|
399
|
+
locusInfoUpdateCallback = HashTreeParserStub.firstCall.args[0].callbacks.locusInfoUpdateCallback;
|
|
277
400
|
|
|
278
401
|
assert.isDefined(locusInfoUpdateCallback);
|
|
279
402
|
|
|
@@ -293,6 +416,16 @@ describe('plugin-meetings', () => {
|
|
|
293
416
|
htMeta: {elementId: {type: 'mediashare', id: 'fake-ht-mediaShare-2', version: 1}},
|
|
294
417
|
},
|
|
295
418
|
];
|
|
419
|
+
locusInfo.embeddedApps = [
|
|
420
|
+
{
|
|
421
|
+
id: 'fake-embedded-app-1',
|
|
422
|
+
htMeta: {elementId: {type: 'embeddedapp', id: 'fake-ht-embeddedApp-1', version: 1}},
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
id: 'fake-embedded-app-2',
|
|
426
|
+
htMeta: {elementId: {type: 'embeddedapp', id: 'fake-ht-embeddedApp-2', version: 1}},
|
|
427
|
+
},
|
|
428
|
+
];
|
|
296
429
|
locusInfo.meetings = {id: 'fake-meetings'};
|
|
297
430
|
locusInfo.participants = [
|
|
298
431
|
{id: 'fake-participant-1', name: 'Participant One'},
|
|
@@ -311,6 +444,13 @@ describe('plugin-meetings', () => {
|
|
|
311
444
|
locusInfo.url = 'fake-locus-url';
|
|
312
445
|
locusInfo.htMeta = {elementId: {type: 'locus', id: 'fake-ht-locus-id', version: 1}};
|
|
313
446
|
|
|
447
|
+
const createdHashTreeParser = locusInfo.hashTreeParsers.get('fake-locus-url');
|
|
448
|
+
|
|
449
|
+
assert.isDefined(createdHashTreeParser);
|
|
450
|
+
// this flag would have been set to true on the first callback triggered by initialSetup() wa called earlier
|
|
451
|
+
// it's not because we're mocking HashTreeParser, so we have to set it manually here
|
|
452
|
+
createdHashTreeParser.initializedFromHashTree = true;
|
|
453
|
+
|
|
314
454
|
// setup the default expected locus info state that each test builds upon
|
|
315
455
|
expectedLocusInfo = {
|
|
316
456
|
controls: {id: 'fake-controls'},
|
|
@@ -328,8 +468,18 @@ describe('plugin-meetings', () => {
|
|
|
328
468
|
htMeta: {elementId: {type: 'mediashare', id: 'fake-ht-mediaShare-2', version: 1}},
|
|
329
469
|
},
|
|
330
470
|
],
|
|
471
|
+
embeddedApps: [
|
|
472
|
+
{
|
|
473
|
+
id: 'fake-embedded-app-1',
|
|
474
|
+
htMeta: {elementId: {type: 'embeddedapp', id: 'fake-ht-embeddedApp-1', version: 1}},
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
id: 'fake-embedded-app-2',
|
|
478
|
+
htMeta: {elementId: {type: 'embeddedapp', id: 'fake-ht-embeddedApp-2', version: 1}},
|
|
479
|
+
},
|
|
480
|
+
],
|
|
331
481
|
meetings: {id: 'fake-meetings'},
|
|
332
|
-
jsSdkMeta: {removedParticipantIds: []},
|
|
482
|
+
jsSdkMeta: {removedParticipantIds: [], forceReplaceMembers: false},
|
|
333
483
|
participants: [], // empty means there were no participant updates
|
|
334
484
|
replaces: {id: 'fake-replaces'},
|
|
335
485
|
self: {id: 'fake-self'},
|
|
@@ -347,7 +497,7 @@ describe('plugin-meetings', () => {
|
|
|
347
497
|
};
|
|
348
498
|
|
|
349
499
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
350
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
500
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
351
501
|
updatedObjects: [{htMeta: {elementId: {type: 'self'}}, data: newSelf}],
|
|
352
502
|
});
|
|
353
503
|
|
|
@@ -374,7 +524,7 @@ describe('plugin-meetings', () => {
|
|
|
374
524
|
locusInfo.info.isWebinar = true;
|
|
375
525
|
|
|
376
526
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
377
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
527
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
378
528
|
updatedObjects: [{htMeta: {elementId: {type: 'self'}}, data: newSelf}],
|
|
379
529
|
});
|
|
380
530
|
|
|
@@ -407,7 +557,7 @@ describe('plugin-meetings', () => {
|
|
|
407
557
|
locusInfo.info.isWebinar = true;
|
|
408
558
|
|
|
409
559
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
410
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
560
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
411
561
|
updatedObjects: [{htMeta: {elementId: {type: 'self'}}, data: newSelf}],
|
|
412
562
|
});
|
|
413
563
|
|
|
@@ -435,7 +585,7 @@ describe('plugin-meetings', () => {
|
|
|
435
585
|
};
|
|
436
586
|
|
|
437
587
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
438
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
588
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
439
589
|
updatedObjects: [{htMeta: {elementId: {type: 'fullState'}}, data: newFullState}],
|
|
440
590
|
});
|
|
441
591
|
|
|
@@ -453,7 +603,7 @@ describe('plugin-meetings', () => {
|
|
|
453
603
|
};
|
|
454
604
|
|
|
455
605
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
456
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
606
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
457
607
|
updatedObjects: [{htMeta: {elementId: {type: 'info'}}, data: newInfo}],
|
|
458
608
|
});
|
|
459
609
|
|
|
@@ -471,7 +621,7 @@ describe('plugin-meetings', () => {
|
|
|
471
621
|
};
|
|
472
622
|
|
|
473
623
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
474
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
624
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
475
625
|
updatedObjects: [{htMeta: {elementId: {type: 'links'}}, data: newLinks}],
|
|
476
626
|
});
|
|
477
627
|
|
|
@@ -491,7 +641,7 @@ describe('plugin-meetings', () => {
|
|
|
491
641
|
};
|
|
492
642
|
|
|
493
643
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
494
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
644
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
495
645
|
updatedObjects: [{htMeta: newLocusHtMeta, data: newLocus}],
|
|
496
646
|
});
|
|
497
647
|
|
|
@@ -504,11 +654,12 @@ describe('plugin-meetings', () => {
|
|
|
504
654
|
self: {id: 'fake-self'},
|
|
505
655
|
links: {id: 'fake-links'},
|
|
506
656
|
mediaShares: expectedLocusInfo.mediaShares,
|
|
657
|
+
embeddedApps: expectedLocusInfo.embeddedApps,
|
|
507
658
|
// and now the new fields
|
|
508
659
|
...newLocus,
|
|
509
660
|
htMeta: newLocusHtMeta,
|
|
510
661
|
participants: [], // empty means there were no participant updates
|
|
511
|
-
jsSdkMeta: {removedParticipantIds: []}, // no participants were removed
|
|
662
|
+
jsSdkMeta: {removedParticipantIds: [], forceReplaceMembers: false}, // no participants were removed
|
|
512
663
|
});
|
|
513
664
|
});
|
|
514
665
|
|
|
@@ -523,7 +674,7 @@ describe('plugin-meetings', () => {
|
|
|
523
674
|
};
|
|
524
675
|
|
|
525
676
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
526
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
677
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
527
678
|
updatedObjects: [
|
|
528
679
|
{
|
|
529
680
|
htMeta: newLocusHtMeta,
|
|
@@ -536,6 +687,7 @@ describe('plugin-meetings', () => {
|
|
|
536
687
|
self: 'new-self',
|
|
537
688
|
participants: 'new-participants',
|
|
538
689
|
mediaShares: 'new-mediaShares',
|
|
690
|
+
embeddedApps: 'new-embeddedApps',
|
|
539
691
|
},
|
|
540
692
|
},
|
|
541
693
|
],
|
|
@@ -551,8 +703,9 @@ describe('plugin-meetings', () => {
|
|
|
551
703
|
self: {id: 'fake-self'},
|
|
552
704
|
links: {id: 'fake-links'},
|
|
553
705
|
mediaShares: expectedLocusInfo.mediaShares,
|
|
706
|
+
embeddedApps: expectedLocusInfo.embeddedApps,
|
|
554
707
|
participants: [], // empty means there were no participant updates
|
|
555
|
-
jsSdkMeta: {removedParticipantIds: []}, // no participants were removed
|
|
708
|
+
jsSdkMeta: {removedParticipantIds: [], forceReplaceMembers: false}, // no participants were removed
|
|
556
709
|
...newLocus,
|
|
557
710
|
htMeta: newLocusHtMeta,
|
|
558
711
|
});
|
|
@@ -568,7 +721,7 @@ describe('plugin-meetings', () => {
|
|
|
568
721
|
};
|
|
569
722
|
|
|
570
723
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
571
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
724
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
572
725
|
updatedObjects: [
|
|
573
726
|
// first, a removal of LOCUS object
|
|
574
727
|
{htMeta: {elementId: {type: 'locus'}}, data: null},
|
|
@@ -586,11 +739,12 @@ describe('plugin-meetings', () => {
|
|
|
586
739
|
self: {id: 'fake-self'},
|
|
587
740
|
links: {id: 'fake-links'},
|
|
588
741
|
mediaShares: expectedLocusInfo.mediaShares,
|
|
742
|
+
embeddedApps: expectedLocusInfo.embeddedApps,
|
|
589
743
|
// and now the new fields
|
|
590
744
|
...newLocus,
|
|
591
745
|
htMeta: newLocusHtMeta,
|
|
592
746
|
participants: [], // empty means there were no participant updates
|
|
593
|
-
jsSdkMeta: {removedParticipantIds: []}, // no participants were removed
|
|
747
|
+
jsSdkMeta: {removedParticipantIds: [], forceReplaceMembers: false}, // no participants were removed
|
|
594
748
|
});
|
|
595
749
|
});
|
|
596
750
|
|
|
@@ -601,7 +755,7 @@ describe('plugin-meetings', () => {
|
|
|
601
755
|
const newLocusHtMeta = {elementId: {type: 'locus', version: 99}};
|
|
602
756
|
|
|
603
757
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
604
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
758
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
605
759
|
updatedObjects: [
|
|
606
760
|
// first, an update
|
|
607
761
|
{htMeta: newLocusHtMeta, data: newLocus},
|
|
@@ -630,7 +784,7 @@ describe('plugin-meetings', () => {
|
|
|
630
784
|
};
|
|
631
785
|
|
|
632
786
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
633
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
787
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
634
788
|
updatedObjects: [
|
|
635
789
|
// first, an update
|
|
636
790
|
{htMeta: {elementId: {type: 'locus'}}, data: newLocus1},
|
|
@@ -660,7 +814,7 @@ describe('plugin-meetings', () => {
|
|
|
660
814
|
};
|
|
661
815
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
662
816
|
// with 1 participant added, 1 updated, and 1 removed
|
|
663
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
817
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
664
818
|
updatedObjects: [
|
|
665
819
|
{htMeta: {elementId: {type: 'participant', id: 'fake-ht-participant-1'}}, data: null},
|
|
666
820
|
{
|
|
@@ -678,7 +832,7 @@ describe('plugin-meetings', () => {
|
|
|
678
832
|
assert.calledOnceWithExactly(onDeltaLocusStub, {
|
|
679
833
|
...expectedLocusInfo,
|
|
680
834
|
participants: [newParticipant, updatedParticipant2],
|
|
681
|
-
jsSdkMeta: {removedParticipantIds: ['fake-participant-1']},
|
|
835
|
+
jsSdkMeta: {removedParticipantIds: ['fake-participant-1'], forceReplaceMembers: false},
|
|
682
836
|
});
|
|
683
837
|
// and that the hashTreeObjectId2ParticipantId map was updated correctly
|
|
684
838
|
assert.isUndefined(locusInfo.hashTreeObjectId2ParticipantId.get('fake-ht-participant-1'));
|
|
@@ -704,7 +858,7 @@ describe('plugin-meetings', () => {
|
|
|
704
858
|
};
|
|
705
859
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
706
860
|
// with 1 participant added, 1 updated, and 1 removed
|
|
707
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
861
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
708
862
|
updatedObjects: [
|
|
709
863
|
{htMeta: {elementId: {type: 'mediashare', id: 'fake-ht-mediaShare-1'}}, data: null},
|
|
710
864
|
{
|
|
@@ -725,6 +879,39 @@ describe('plugin-meetings', () => {
|
|
|
725
879
|
});
|
|
726
880
|
});
|
|
727
881
|
|
|
882
|
+
it('should process locus update correctly when called with updated EMBEDDEDAPP objects', () => {
|
|
883
|
+
const newEmbeddedApp = {
|
|
884
|
+
id: 'new-embedded-app-3',
|
|
885
|
+
htMeta: {elementId: {type: 'embeddedapp', id: 'fake-ht-embeddedApp-3', version: 100}},
|
|
886
|
+
};
|
|
887
|
+
const updatedEmbeddedApp2 = {
|
|
888
|
+
id: 'fake-embedded-app-2',
|
|
889
|
+
someNewProp: 'newValue',
|
|
890
|
+
htMeta: {elementId: {type: 'embeddedapp', id: 'fake-ht-embeddedApp-2', version: 100}},
|
|
891
|
+
};
|
|
892
|
+
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
893
|
+
// with 1 embedded app added, 1 updated, and 1 removed
|
|
894
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
895
|
+
updatedObjects: [
|
|
896
|
+
{htMeta: {elementId: {type: 'embeddedapp', id: 'fake-ht-embeddedApp-1'}}, data: null},
|
|
897
|
+
{
|
|
898
|
+
htMeta: {elementId: {type: 'embeddedapp', id: 'fake-ht-embeddedApp-2'}},
|
|
899
|
+
data: updatedEmbeddedApp2,
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
htMeta: {elementId: {type: 'embeddedapp', id: 'fake-ht-embeddedApp-3'}},
|
|
903
|
+
data: newEmbeddedApp,
|
|
904
|
+
},
|
|
905
|
+
],
|
|
906
|
+
});
|
|
907
|
+
|
|
908
|
+
// check onDeltaLocus() was called with correctly updated locus info
|
|
909
|
+
assert.calledOnceWithExactly(onDeltaLocusStub, {
|
|
910
|
+
...expectedLocusInfo,
|
|
911
|
+
embeddedApps: [updatedEmbeddedApp2, newEmbeddedApp],
|
|
912
|
+
});
|
|
913
|
+
});
|
|
914
|
+
|
|
728
915
|
it('should process locus update correctly when called with a combination of various updated objects', () => {
|
|
729
916
|
const newSelf = {
|
|
730
917
|
id: 'new-self',
|
|
@@ -741,7 +928,7 @@ describe('plugin-meetings', () => {
|
|
|
741
928
|
};
|
|
742
929
|
|
|
743
930
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
744
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
931
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
745
932
|
updatedObjects: [
|
|
746
933
|
{
|
|
747
934
|
htMeta: {elementId: {type: 'mediashare', id: 'fake-ht-mediaShare-2'}},
|
|
@@ -780,7 +967,7 @@ describe('plugin-meetings', () => {
|
|
|
780
967
|
};
|
|
781
968
|
|
|
782
969
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
783
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
970
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
784
971
|
updatedObjects: [
|
|
785
972
|
{
|
|
786
973
|
htMeta: {elementId: {type: 'controlentry', id: 'control-1'}},
|
|
@@ -808,7 +995,7 @@ describe('plugin-meetings', () => {
|
|
|
808
995
|
|
|
809
996
|
it('should process locus update correctly when CONTROL object is received with no data', () => {
|
|
810
997
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
811
|
-
locusInfoUpdateCallback(OBJECTS_UPDATED,
|
|
998
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
812
999
|
updatedObjects: [
|
|
813
1000
|
{
|
|
814
1001
|
htMeta: {elementId: {type: 'controlentry', id: 'some-control-id'}},
|
|
@@ -832,7 +1019,7 @@ describe('plugin-meetings', () => {
|
|
|
832
1019
|
const destroyStub = sinon.stub(locusInfo.webex.meetings, 'destroy');
|
|
833
1020
|
|
|
834
1021
|
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
835
|
-
locusInfoUpdateCallback(MEETING_ENDED);
|
|
1022
|
+
locusInfoUpdateCallback({updateType: MEETING_ENDED});
|
|
836
1023
|
|
|
837
1024
|
assert.calledOnceWithExactly(collectionGetStub, locusInfo.meetingId);
|
|
838
1025
|
assert.calledOnceWithExactly(
|
|
@@ -841,6 +1028,109 @@ describe('plugin-meetings', () => {
|
|
|
841
1028
|
MEETING_REMOVED_REASON.SELF_REMOVED
|
|
842
1029
|
);
|
|
843
1030
|
});
|
|
1031
|
+
|
|
1032
|
+
// this could happen if meeting gets destroyed while we're doing some async hash tree operation like a sync
|
|
1033
|
+
it('should handle MEETING_ENDED correctly when meeting is not found in the collection', () => {
|
|
1034
|
+
const collectionGetStub = sinon
|
|
1035
|
+
.stub(locusInfo.webex.meetings.meetingCollection, 'get')
|
|
1036
|
+
.returns(null);
|
|
1037
|
+
const destroyStub = sinon.stub(locusInfo.webex.meetings, 'destroy');
|
|
1038
|
+
|
|
1039
|
+
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
1040
|
+
locusInfoUpdateCallback({updateType: MEETING_ENDED});
|
|
1041
|
+
|
|
1042
|
+
assert.calledOnceWithExactly(collectionGetStub, locusInfo.meetingId);
|
|
1043
|
+
assert.notCalled(destroyStub);
|
|
1044
|
+
});
|
|
1045
|
+
|
|
1046
|
+
it('should handle LOCUS_NOT_FOUND by calling syncMeetings with skipHashTreeSync', () => {
|
|
1047
|
+
const syncMeetingsStub = sinon.stub(locusInfo.webex.meetings, 'syncMeetings').resolves();
|
|
1048
|
+
|
|
1049
|
+
locusInfoUpdateCallback({updateType: LOCUS_NOT_FOUND});
|
|
1050
|
+
|
|
1051
|
+
assert.calledOnceWithExactly(syncMeetingsStub, {keepOnlyLocusMeetings: false, skipHashTreeSync: true});
|
|
1052
|
+
});
|
|
1053
|
+
|
|
1054
|
+
it('should handle LOCUS_NOT_FOUND and log error if syncMeetings fails', async () => {
|
|
1055
|
+
const syncError = new Error('sync failed');
|
|
1056
|
+
const syncMeetingsStub = sinon.stub(locusInfo.webex.meetings, 'syncMeetings').rejects(syncError);
|
|
1057
|
+
const logErrorStub = LoggerProxy.logger.error?.isSinonProxy
|
|
1058
|
+
? LoggerProxy.logger.error
|
|
1059
|
+
: sinon.stub(LoggerProxy.logger, 'error');
|
|
1060
|
+
|
|
1061
|
+
logErrorStub.resetHistory();
|
|
1062
|
+
|
|
1063
|
+
locusInfoUpdateCallback({updateType: LOCUS_NOT_FOUND});
|
|
1064
|
+
|
|
1065
|
+
assert.calledOnceWithExactly(syncMeetingsStub, {keepOnlyLocusMeetings: false, skipHashTreeSync: true});
|
|
1066
|
+
|
|
1067
|
+
// wait for the promise rejection to be handled
|
|
1068
|
+
await testUtils.flushPromises();
|
|
1069
|
+
|
|
1070
|
+
assert.calledOnce(logErrorStub);
|
|
1071
|
+
assert.match(
|
|
1072
|
+
logErrorStub.firstCall.args[0],
|
|
1073
|
+
/syncMeetings failed after LOCUS_NOT_FOUND/
|
|
1074
|
+
);
|
|
1075
|
+
});
|
|
1076
|
+
|
|
1077
|
+
it('should set forceReplaceMembers to true on the first update for a locusUrl (initializedFromHashTree is false)', () => {
|
|
1078
|
+
const createdHashTreeParser = locusInfo.hashTreeParsers.get('fake-locus-url');
|
|
1079
|
+
createdHashTreeParser.initializedFromHashTree = false;
|
|
1080
|
+
|
|
1081
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
1082
|
+
updatedObjects: [
|
|
1083
|
+
{
|
|
1084
|
+
htMeta: {elementId: {type: 'self'}},
|
|
1085
|
+
data: {id: 'new-self'},
|
|
1086
|
+
},
|
|
1087
|
+
],
|
|
1088
|
+
});
|
|
1089
|
+
|
|
1090
|
+
assert.calledOnce(onDeltaLocusStub);
|
|
1091
|
+
assert.equal(onDeltaLocusStub.firstCall.args[0].jsSdkMeta.forceReplaceMembers, true);
|
|
1092
|
+
assert.isTrue(createdHashTreeParser.initializedFromHashTree);
|
|
1093
|
+
});
|
|
1094
|
+
|
|
1095
|
+
it('should set forceReplaceMembers to false on subsequent updates (initializedFromHashTree is true)', () => {
|
|
1096
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
1097
|
+
updatedObjects: [
|
|
1098
|
+
{
|
|
1099
|
+
htMeta: {elementId: {type: 'self'}},
|
|
1100
|
+
data: {id: 'new-self'},
|
|
1101
|
+
},
|
|
1102
|
+
],
|
|
1103
|
+
});
|
|
1104
|
+
|
|
1105
|
+
assert.calledOnce(onDeltaLocusStub);
|
|
1106
|
+
assert.equal(onDeltaLocusStub.firstCall.args[0].jsSdkMeta.forceReplaceMembers, false);
|
|
1107
|
+
});
|
|
1108
|
+
|
|
1109
|
+
it('should copy participant data to self when participant matches self identity and state is LEFT with reason MOVED', () => {
|
|
1110
|
+
locusInfo.self = {id: 'fake-self', identity: 'user-123'};
|
|
1111
|
+
|
|
1112
|
+
locusInfoUpdateCallback({updateType: OBJECTS_UPDATED,
|
|
1113
|
+
updatedObjects: [
|
|
1114
|
+
{
|
|
1115
|
+
htMeta: {elementId: {type: 'participant', id: 99}},
|
|
1116
|
+
data: {
|
|
1117
|
+
id: 'participant-matching-self',
|
|
1118
|
+
identity: 'user-123',
|
|
1119
|
+
state: 'LEFT',
|
|
1120
|
+
reason: 'MOVED',
|
|
1121
|
+
roles: ['MODERATOR'],
|
|
1122
|
+
},
|
|
1123
|
+
},
|
|
1124
|
+
],
|
|
1125
|
+
});
|
|
1126
|
+
|
|
1127
|
+
assert.calledOnce(onDeltaLocusStub);
|
|
1128
|
+
const passedLocus = onDeltaLocusStub.firstCall.args[0];
|
|
1129
|
+
|
|
1130
|
+
assert.equal(passedLocus.self.identity, 'user-123');
|
|
1131
|
+
assert.equal(passedLocus.self.state, 'LEFT');
|
|
1132
|
+
assert.equal(passedLocus.self.reason, 'MOVED');
|
|
1133
|
+
});
|
|
844
1134
|
});
|
|
845
1135
|
});
|
|
846
1136
|
|
|
@@ -1076,7 +1366,7 @@ describe('plugin-meetings', () => {
|
|
|
1076
1366
|
it('should trigger the CONTROLS_POLLING_QA_CHANGED event when necessary', () => {
|
|
1077
1367
|
locusInfo.controls = {};
|
|
1078
1368
|
locusInfo.emitScoped = sinon.stub();
|
|
1079
|
-
newControls.pollingQAControl = {
|
|
1369
|
+
newControls.pollingQAControl = {enabled: true};
|
|
1080
1370
|
locusInfo.updateControls(newControls);
|
|
1081
1371
|
|
|
1082
1372
|
assert.calledWith(
|
|
@@ -1114,6 +1404,8 @@ describe('plugin-meetings', () => {
|
|
|
1114
1404
|
state: RECORDING_STATE.IDLE,
|
|
1115
1405
|
modifiedBy: 'George Kittle',
|
|
1116
1406
|
lastModified: 'TODAY',
|
|
1407
|
+
modifiedByServiceAppName: undefined,
|
|
1408
|
+
modifiedByServiceAppId: undefined,
|
|
1117
1409
|
}
|
|
1118
1410
|
);
|
|
1119
1411
|
});
|
|
@@ -1148,6 +1440,8 @@ describe('plugin-meetings', () => {
|
|
|
1148
1440
|
state: RECORDING_STATE.RECORDING,
|
|
1149
1441
|
modifiedBy: 'George Kittle',
|
|
1150
1442
|
lastModified: 'TODAY',
|
|
1443
|
+
modifiedByServiceAppName: undefined,
|
|
1444
|
+
modifiedByServiceAppId: undefined,
|
|
1151
1445
|
}
|
|
1152
1446
|
);
|
|
1153
1447
|
});
|
|
@@ -1183,6 +1477,8 @@ describe('plugin-meetings', () => {
|
|
|
1183
1477
|
state: RECORDING_STATE.PAUSED,
|
|
1184
1478
|
modifiedBy: 'George Kittle',
|
|
1185
1479
|
lastModified: 'TODAY',
|
|
1480
|
+
modifiedByServiceAppName: undefined,
|
|
1481
|
+
modifiedByServiceAppId: undefined,
|
|
1186
1482
|
}
|
|
1187
1483
|
);
|
|
1188
1484
|
});
|
|
@@ -1219,6 +1515,8 @@ describe('plugin-meetings', () => {
|
|
|
1219
1515
|
state: RECORDING_STATE.RESUMED,
|
|
1220
1516
|
modifiedBy: 'George Kittle',
|
|
1221
1517
|
lastModified: 'TODAY',
|
|
1518
|
+
modifiedByServiceAppName: undefined,
|
|
1519
|
+
modifiedByServiceAppId: undefined,
|
|
1222
1520
|
}
|
|
1223
1521
|
);
|
|
1224
1522
|
});
|
|
@@ -1254,6 +1552,44 @@ describe('plugin-meetings', () => {
|
|
|
1254
1552
|
state: RECORDING_STATE.IDLE,
|
|
1255
1553
|
modifiedBy: 'George Kittle',
|
|
1256
1554
|
lastModified: 'TODAY',
|
|
1555
|
+
modifiedByServiceAppName: undefined,
|
|
1556
|
+
modifiedByServiceAppId: undefined,
|
|
1557
|
+
}
|
|
1558
|
+
);
|
|
1559
|
+
});
|
|
1560
|
+
|
|
1561
|
+
it('should include service app fields in the recording event when present', () => {
|
|
1562
|
+
locusInfo.controls = {
|
|
1563
|
+
record: {
|
|
1564
|
+
recording: false,
|
|
1565
|
+
paused: false,
|
|
1566
|
+
meta: {
|
|
1567
|
+
lastModified: 'TODAY',
|
|
1568
|
+
modifiedBy: 'George Kittle',
|
|
1569
|
+
},
|
|
1570
|
+
},
|
|
1571
|
+
shareControl: {},
|
|
1572
|
+
transcribe: {},
|
|
1573
|
+
};
|
|
1574
|
+
newControls.record.recording = true;
|
|
1575
|
+
newControls.record.meta.modifiedByServiceAppName = 'My Bot';
|
|
1576
|
+
newControls.record.meta.modifiedByServiceAppId = 'app-id-123';
|
|
1577
|
+
locusInfo.emitScoped = sinon.stub();
|
|
1578
|
+
locusInfo.updateControls(newControls);
|
|
1579
|
+
|
|
1580
|
+
assert.calledWith(
|
|
1581
|
+
locusInfo.emitScoped,
|
|
1582
|
+
{
|
|
1583
|
+
file: 'locus-info',
|
|
1584
|
+
function: 'updateControls',
|
|
1585
|
+
},
|
|
1586
|
+
LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED,
|
|
1587
|
+
{
|
|
1588
|
+
state: RECORDING_STATE.RECORDING,
|
|
1589
|
+
modifiedBy: 'George Kittle',
|
|
1590
|
+
lastModified: 'TODAY',
|
|
1591
|
+
modifiedByServiceAppName: 'My Bot',
|
|
1592
|
+
modifiedByServiceAppId: 'app-id-123',
|
|
1257
1593
|
}
|
|
1258
1594
|
);
|
|
1259
1595
|
});
|
|
@@ -1366,6 +1702,34 @@ describe('plugin-meetings', () => {
|
|
|
1366
1702
|
);
|
|
1367
1703
|
});
|
|
1368
1704
|
|
|
1705
|
+
it('should emit CONTROLS_AI_SUMMARY_NOTIFICATION_UPDATED when aiSummaryNotification changes', () => {
|
|
1706
|
+
locusInfo.emitScoped = sinon.stub();
|
|
1707
|
+
locusInfo.controls = {
|
|
1708
|
+
transcribe: {
|
|
1709
|
+
transcribing: false,
|
|
1710
|
+
caption: false,
|
|
1711
|
+
aiSummaryNotification: false,
|
|
1712
|
+
},
|
|
1713
|
+
};
|
|
1714
|
+
newControls.transcribe.transcribing = false;
|
|
1715
|
+
newControls.transcribe.caption = false;
|
|
1716
|
+
newControls.transcribe.aiSummaryNotification = true;
|
|
1717
|
+
|
|
1718
|
+
locusInfo.updateControls(newControls);
|
|
1719
|
+
|
|
1720
|
+
assert.calledWith(
|
|
1721
|
+
locusInfo.emitScoped,
|
|
1722
|
+
{
|
|
1723
|
+
file: 'locus-info',
|
|
1724
|
+
function: 'updateControls',
|
|
1725
|
+
},
|
|
1726
|
+
LOCUSINFO.EVENTS.CONTROLS_AI_SUMMARY_NOTIFICATION_UPDATED,
|
|
1727
|
+
{
|
|
1728
|
+
aiSummaryNotification: true,
|
|
1729
|
+
}
|
|
1730
|
+
);
|
|
1731
|
+
});
|
|
1732
|
+
|
|
1369
1733
|
it('should update the transcribe spoken language', () => {
|
|
1370
1734
|
locusInfo.emitScoped = sinon.stub();
|
|
1371
1735
|
locusInfo.controls = {
|
|
@@ -1631,7 +1995,6 @@ describe('plugin-meetings', () => {
|
|
|
1631
1995
|
);
|
|
1632
1996
|
});
|
|
1633
1997
|
|
|
1634
|
-
|
|
1635
1998
|
it('should call with participant display name', () => {
|
|
1636
1999
|
const failureParticipant = [
|
|
1637
2000
|
{
|
|
@@ -1656,7 +2019,7 @@ describe('plugin-meetings', () => {
|
|
|
1656
2019
|
displayName: 'Test User',
|
|
1657
2020
|
}
|
|
1658
2021
|
);
|
|
1659
|
-
})
|
|
2022
|
+
});
|
|
1660
2023
|
});
|
|
1661
2024
|
|
|
1662
2025
|
describe('#updateSelf', () => {
|
|
@@ -1822,7 +2185,7 @@ describe('plugin-meetings', () => {
|
|
|
1822
2185
|
function: 'updateSelf',
|
|
1823
2186
|
},
|
|
1824
2187
|
LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED,
|
|
1825
|
-
{muted: true, unmuteAllowed: true}
|
|
2188
|
+
{muted: true, unmuteAllowed: true, modifiedBy: null}
|
|
1826
2189
|
);
|
|
1827
2190
|
|
|
1828
2191
|
// but sometimes "previous self" is defined, but without controls.audio.muted, so we test this here:
|
|
@@ -1837,7 +2200,7 @@ describe('plugin-meetings', () => {
|
|
|
1837
2200
|
function: 'updateSelf',
|
|
1838
2201
|
},
|
|
1839
2202
|
LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED,
|
|
1840
|
-
{muted: true, unmuteAllowed: true}
|
|
2203
|
+
{muted: true, unmuteAllowed: true, modifiedBy: null}
|
|
1841
2204
|
);
|
|
1842
2205
|
});
|
|
1843
2206
|
|
|
@@ -1896,7 +2259,7 @@ describe('plugin-meetings', () => {
|
|
|
1896
2259
|
function: 'updateSelf',
|
|
1897
2260
|
},
|
|
1898
2261
|
LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED,
|
|
1899
|
-
{muted: true, unmuteAllowed: true}
|
|
2262
|
+
{muted: true, unmuteAllowed: true, modifiedBy: null}
|
|
1900
2263
|
);
|
|
1901
2264
|
});
|
|
1902
2265
|
|
|
@@ -2035,7 +2398,7 @@ describe('plugin-meetings', () => {
|
|
|
2035
2398
|
function: 'updateSelf',
|
|
2036
2399
|
},
|
|
2037
2400
|
LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED,
|
|
2038
|
-
{muted: true, unmuteAllowed: false}
|
|
2401
|
+
{muted: true, unmuteAllowed: false, modifiedBy: null}
|
|
2039
2402
|
);
|
|
2040
2403
|
|
|
2041
2404
|
// now change only disallowUnmute
|
|
@@ -2053,7 +2416,28 @@ describe('plugin-meetings', () => {
|
|
|
2053
2416
|
function: 'updateSelf',
|
|
2054
2417
|
},
|
|
2055
2418
|
LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED,
|
|
2056
|
-
{muted: true, unmuteAllowed: true}
|
|
2419
|
+
{muted: true, unmuteAllowed: true, modifiedBy: null}
|
|
2420
|
+
);
|
|
2421
|
+
});
|
|
2422
|
+
|
|
2423
|
+
it('should include modifiedBy in payload when muted by host', () => {
|
|
2424
|
+
locusInfo.webex.internal.device.url = self.deviceUrl;
|
|
2425
|
+
locusInfo.updateSelf(self);
|
|
2426
|
+
const newSelf = cloneDeep(self);
|
|
2427
|
+
newSelf.controls.audio.muted = true;
|
|
2428
|
+
newSelf.controls.audio.meta = {modifiedBy: 'host-uuid-123'};
|
|
2429
|
+
|
|
2430
|
+
locusInfo.emitScoped = sinon.stub();
|
|
2431
|
+
locusInfo.updateSelf(newSelf);
|
|
2432
|
+
|
|
2433
|
+
assert.calledWith(
|
|
2434
|
+
locusInfo.emitScoped,
|
|
2435
|
+
{
|
|
2436
|
+
file: 'locus-info',
|
|
2437
|
+
function: 'updateSelf',
|
|
2438
|
+
},
|
|
2439
|
+
LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED,
|
|
2440
|
+
{muted: true, unmuteAllowed: true, modifiedBy: 'host-uuid-123'}
|
|
2057
2441
|
);
|
|
2058
2442
|
});
|
|
2059
2443
|
|
|
@@ -2062,6 +2446,33 @@ describe('plugin-meetings', () => {
|
|
|
2062
2446
|
locusInfo.updateSelf(self);
|
|
2063
2447
|
const selfWithLocalUnmuteRequired = cloneDeep(self);
|
|
2064
2448
|
|
|
2449
|
+
selfWithLocalUnmuteRequired.controls.audio.muted = false;
|
|
2450
|
+
selfWithLocalUnmuteRequired.controls.audio.localAudioUnmuteRequired = true;
|
|
2451
|
+
selfWithLocalUnmuteRequired.controls.audio.meta = {modifiedBy: 'host-uuid-123'};
|
|
2452
|
+
|
|
2453
|
+
locusInfo.emitScoped = sinon.stub();
|
|
2454
|
+
locusInfo.updateSelf(selfWithLocalUnmuteRequired);
|
|
2455
|
+
|
|
2456
|
+
assert.calledWith(
|
|
2457
|
+
locusInfo.emitScoped,
|
|
2458
|
+
{
|
|
2459
|
+
file: 'locus-info',
|
|
2460
|
+
function: 'updateSelf',
|
|
2461
|
+
},
|
|
2462
|
+
LOCUSINFO.EVENTS.LOCAL_UNMUTE_REQUIRED,
|
|
2463
|
+
{
|
|
2464
|
+
muted: false,
|
|
2465
|
+
unmuteAllowed: true,
|
|
2466
|
+
modifiedBy: 'host-uuid-123',
|
|
2467
|
+
}
|
|
2468
|
+
);
|
|
2469
|
+
});
|
|
2470
|
+
|
|
2471
|
+
it('should set modifiedBy to null on LOCAL_UNMUTE_REQUIRED when it is unavailable', () => {
|
|
2472
|
+
locusInfo.webex.internal.device.url = self.deviceUrl;
|
|
2473
|
+
locusInfo.updateSelf(self);
|
|
2474
|
+
const selfWithLocalUnmuteRequired = cloneDeep(self);
|
|
2475
|
+
|
|
2065
2476
|
selfWithLocalUnmuteRequired.controls.audio.muted = false;
|
|
2066
2477
|
selfWithLocalUnmuteRequired.controls.audio.localAudioUnmuteRequired = true;
|
|
2067
2478
|
|
|
@@ -2078,6 +2489,7 @@ describe('plugin-meetings', () => {
|
|
|
2078
2489
|
{
|
|
2079
2490
|
muted: false,
|
|
2080
2491
|
unmuteAllowed: true,
|
|
2492
|
+
modifiedBy: null,
|
|
2081
2493
|
}
|
|
2082
2494
|
);
|
|
2083
2495
|
});
|
|
@@ -2457,8 +2869,8 @@ describe('plugin-meetings', () => {
|
|
|
2457
2869
|
{
|
|
2458
2870
|
isInitializing: !self,
|
|
2459
2871
|
}
|
|
2460
|
-
|
|
2461
|
-
|
|
2872
|
+
);
|
|
2873
|
+
});
|
|
2462
2874
|
|
|
2463
2875
|
const checkMeetingInfoUpdatedCalled = (expected, payload) => {
|
|
2464
2876
|
const expectedArgs = [
|
|
@@ -2503,6 +2915,10 @@ describe('plugin-meetings', () => {
|
|
|
2503
2915
|
|
|
2504
2916
|
let expectedMeeting;
|
|
2505
2917
|
|
|
2918
|
+
// simulate that updateSelf has been called previously (as happens in production)
|
|
2919
|
+
// so that parsedLocus.self reflects the joined state
|
|
2920
|
+
locusInfo.parsedLocus.self = {state: 'JOINED'};
|
|
2921
|
+
|
|
2506
2922
|
/*
|
|
2507
2923
|
When the event is triggered, it is required that the meeting has already
|
|
2508
2924
|
been updated. This is why the meeting is being checked within the stubbed event emitter
|
|
@@ -2513,6 +2929,7 @@ describe('plugin-meetings', () => {
|
|
|
2513
2929
|
|
|
2514
2930
|
// set the info initially as locusInfo.info starts as undefined
|
|
2515
2931
|
expectedMeeting = {
|
|
2932
|
+
attendee: {},
|
|
2516
2933
|
coHost: {
|
|
2517
2934
|
LOWER_SOMEONE_ELSES_HAND: true,
|
|
2518
2935
|
},
|
|
@@ -2521,10 +2938,12 @@ describe('plugin-meetings', () => {
|
|
|
2521
2938
|
moderator: {
|
|
2522
2939
|
LOWER_SOMEONE_ELSES_HAND: true,
|
|
2523
2940
|
},
|
|
2941
|
+
panelist: {},
|
|
2524
2942
|
policy: {
|
|
2525
2943
|
LOCK_STATUS_UNLOCKED: true,
|
|
2526
2944
|
ROSTER_IN_MEETING: true,
|
|
2527
2945
|
},
|
|
2946
|
+
presenter: {},
|
|
2528
2947
|
userDisplayHints: ['ROSTER_IN_MEETING', 'LOCK_STATUS_UNLOCKED'],
|
|
2529
2948
|
};
|
|
2530
2949
|
locusInfo.updateMeetingInfo(initialInfo, self);
|
|
@@ -2539,6 +2958,7 @@ describe('plugin-meetings', () => {
|
|
|
2539
2958
|
|
|
2540
2959
|
// Updating with different info should trigger the event
|
|
2541
2960
|
expectedMeeting = {
|
|
2961
|
+
attendee: {},
|
|
2542
2962
|
coHost: {
|
|
2543
2963
|
LOWER_SOMEONE_ELSES_HAND: true,
|
|
2544
2964
|
LOCK_CONTROL_LOCK: true,
|
|
@@ -2548,10 +2968,12 @@ describe('plugin-meetings', () => {
|
|
|
2548
2968
|
moderator: {
|
|
2549
2969
|
LOWER_SOMEONE_ELSES_HAND: true,
|
|
2550
2970
|
},
|
|
2971
|
+
panelist: {},
|
|
2551
2972
|
policy: {
|
|
2552
2973
|
LOCK_STATUS_UNLOCKED: true,
|
|
2553
2974
|
ROSTER_IN_MEETING: true,
|
|
2554
2975
|
},
|
|
2976
|
+
presenter: {},
|
|
2555
2977
|
userDisplayHints: ['ROSTER_IN_MEETING', 'LOCK_STATUS_UNLOCKED'],
|
|
2556
2978
|
};
|
|
2557
2979
|
locusInfo.updateMeetingInfo(newInfo, self);
|
|
@@ -2560,6 +2982,7 @@ describe('plugin-meetings', () => {
|
|
|
2560
2982
|
|
|
2561
2983
|
// update it with the same info
|
|
2562
2984
|
expectedMeeting = {
|
|
2985
|
+
attendee: {},
|
|
2563
2986
|
coHost: {
|
|
2564
2987
|
LOWER_SOMEONE_ELSES_HAND: true,
|
|
2565
2988
|
LOCK_CONTROL_LOCK: true,
|
|
@@ -2569,10 +2992,12 @@ describe('plugin-meetings', () => {
|
|
|
2569
2992
|
moderator: {
|
|
2570
2993
|
LOWER_SOMEONE_ELSES_HAND: true,
|
|
2571
2994
|
},
|
|
2995
|
+
panelist: {},
|
|
2572
2996
|
policy: {
|
|
2573
2997
|
LOCK_STATUS_UNLOCKED: true,
|
|
2574
2998
|
ROSTER_IN_MEETING: true,
|
|
2575
2999
|
},
|
|
3000
|
+
presenter: {},
|
|
2576
3001
|
userDisplayHints: ['ROSTER_IN_MEETING', 'LOCK_STATUS_UNLOCKED'],
|
|
2577
3002
|
};
|
|
2578
3003
|
locusInfo.updateMeetingInfo(newInfo, self);
|
|
@@ -2587,6 +3012,7 @@ describe('plugin-meetings', () => {
|
|
|
2587
3012
|
hasRole: true,
|
|
2588
3013
|
});
|
|
2589
3014
|
expectedMeeting = {
|
|
3015
|
+
attendee: {},
|
|
2590
3016
|
coHost: {
|
|
2591
3017
|
LOWER_SOMEONE_ELSES_HAND: true,
|
|
2592
3018
|
LOCK_CONTROL_LOCK: true,
|
|
@@ -2596,10 +3022,12 @@ describe('plugin-meetings', () => {
|
|
|
2596
3022
|
moderator: {
|
|
2597
3023
|
LOWER_SOMEONE_ELSES_HAND: true,
|
|
2598
3024
|
},
|
|
3025
|
+
panelist: {},
|
|
2599
3026
|
policy: {
|
|
2600
3027
|
LOCK_STATUS_UNLOCKED: true,
|
|
2601
3028
|
ROSTER_IN_MEETING: true,
|
|
2602
3029
|
},
|
|
3030
|
+
presenter: {},
|
|
2603
3031
|
userDisplayHints: [
|
|
2604
3032
|
'ROSTER_IN_MEETING',
|
|
2605
3033
|
'LOCK_STATUS_UNLOCKED',
|
|
@@ -2642,6 +3070,46 @@ describe('plugin-meetings', () => {
|
|
|
2642
3070
|
// since self is not passed to updateMeetingInfo, MEETING_INFO_UPDATED should be triggered with isIntializing: true
|
|
2643
3071
|
checkMeetingInfoUpdatedCalledForRoles(true, {isInitializing: true});
|
|
2644
3072
|
});
|
|
3073
|
+
|
|
3074
|
+
// joined-section hints (like ROSTER_IN_MEETING) are filtered out while not joined, so they
|
|
3075
|
+
// are a good proxy for verifying that userDisplayHints get recomputed on a join transition
|
|
3076
|
+
[
|
|
3077
|
+
{
|
|
3078
|
+
name: 'the JOINED delta carries the info section',
|
|
3079
|
+
getSecondInfo: (info) => info,
|
|
3080
|
+
},
|
|
3081
|
+
{
|
|
3082
|
+
name: 'the JOINED delta omits the info section (falls back to stored info)',
|
|
3083
|
+
getSecondInfo: () => undefined,
|
|
3084
|
+
},
|
|
3085
|
+
].forEach(({name, getSecondInfo}) => {
|
|
3086
|
+
it(`recomputes userDisplayHints when self transitions to JOINED with unchanged roles and ${name}`, () => {
|
|
3087
|
+
const info = cloneDeep(meetingInfo); // joined: ['ROSTER_IN_MEETING', 'LOCK_STATUS_UNLOCKED']
|
|
3088
|
+
|
|
3089
|
+
const notJoinedSelf = cloneDeep(self);
|
|
3090
|
+
notJoinedSelf.state = 'IDLE';
|
|
3091
|
+
notJoinedSelf.controls.role.roles = [];
|
|
3092
|
+
|
|
3093
|
+
const joinedSelf = cloneDeep(self);
|
|
3094
|
+
joinedSelf.state = 'JOINED';
|
|
3095
|
+
joinedSelf.controls.role.roles = [];
|
|
3096
|
+
|
|
3097
|
+
sinon.stub(locusInfo, 'emitScoped');
|
|
3098
|
+
|
|
3099
|
+
// first update while not joined: joined-section hints are filtered out
|
|
3100
|
+
locusInfo.updateMeetingInfo(info, notJoinedSelf);
|
|
3101
|
+
assert.notInclude(locusInfo.parsedLocus.info.userDisplayHints, 'ROSTER_IN_MEETING');
|
|
3102
|
+
assert.notInclude(locusInfo.parsedLocus.info.userDisplayHints, 'LOCK_STATUS_UNLOCKED');
|
|
3103
|
+
|
|
3104
|
+
// self transitions to JOINED - info and roles are unchanged
|
|
3105
|
+
locusInfo.updateMeetingInfo(getSecondInfo(info), joinedSelf);
|
|
3106
|
+
|
|
3107
|
+
// the hints must be recomputed with the new joined state
|
|
3108
|
+
assert.include(locusInfo.parsedLocus.info.userDisplayHints, 'ROSTER_IN_MEETING');
|
|
3109
|
+
assert.include(locusInfo.parsedLocus.info.userDisplayHints, 'LOCK_STATUS_UNLOCKED');
|
|
3110
|
+
checkMeetingInfoUpdatedCalled(true, {isInitializing: false});
|
|
3111
|
+
});
|
|
3112
|
+
});
|
|
2645
3113
|
});
|
|
2646
3114
|
|
|
2647
3115
|
describe('#updateMediaShares', () => {
|
|
@@ -2835,18 +3303,391 @@ describe('plugin-meetings', () => {
|
|
|
2835
3303
|
});
|
|
2836
3304
|
});
|
|
2837
3305
|
|
|
2838
|
-
describe('#
|
|
2839
|
-
|
|
2840
|
-
const fakeLocus = {eventType: LOCUSEVENT.DIFFERENCE};
|
|
2841
|
-
|
|
2842
|
-
sinon.stub(locusInfo, 'handleLocusDelta');
|
|
2843
|
-
|
|
2844
|
-
locusInfo.handleLocusAPIResponse(mockMeeting, {locus: fakeLocus});
|
|
3306
|
+
describe('#createHashTreeParser', () => {
|
|
3307
|
+
let HashTreeParserStub;
|
|
2845
3308
|
|
|
2846
|
-
|
|
3309
|
+
beforeEach(() => {
|
|
3310
|
+
HashTreeParserStub = sinon
|
|
3311
|
+
.stub(HashTreeParserModule, 'default')
|
|
3312
|
+
.returns({
|
|
3313
|
+
initializeFromMessage: sinon.stub().resolves(),
|
|
3314
|
+
initializeFromGetLociResponse: sinon.stub().resolves(),
|
|
3315
|
+
state: 'active',
|
|
3316
|
+
stop: sinon.stub(),
|
|
3317
|
+
handleMessage: sinon.stub(),
|
|
3318
|
+
});
|
|
2847
3319
|
});
|
|
2848
|
-
|
|
2849
|
-
|
|
3320
|
+
|
|
3321
|
+
const setupParserViaInitialSetup = async (locusUrl = 'http://locus-url-A.com') => {
|
|
3322
|
+
await locusInfo.initialSetup({
|
|
3323
|
+
trigger: 'locus-message',
|
|
3324
|
+
hashTreeMessage: {
|
|
3325
|
+
locusUrl,
|
|
3326
|
+
locusStateElements: [
|
|
3327
|
+
{
|
|
3328
|
+
htMeta: {elementId: {type: 'Metadata'}},
|
|
3329
|
+
data: {visibleDataSets: [{name: 'dataset1', url: 'test-url'}]},
|
|
3330
|
+
},
|
|
3331
|
+
],
|
|
3332
|
+
dataSets: [{name: 'dataset1', url: 'test-url'}],
|
|
3333
|
+
},
|
|
3334
|
+
});
|
|
3335
|
+
};
|
|
3336
|
+
|
|
3337
|
+
it('should stop existing active parsers when creating a new one', async () => {
|
|
3338
|
+
await setupParserViaInitialSetup('http://locus-url-A.com');
|
|
3339
|
+
|
|
3340
|
+
const firstParser = locusInfo.hashTreeParsers.get('http://locus-url-A.com').parser;
|
|
3341
|
+
|
|
3342
|
+
await setupParserViaInitialSetup('http://locus-url-B.com');
|
|
3343
|
+
|
|
3344
|
+
assert.calledOnce(firstParser.stop);
|
|
3345
|
+
});
|
|
3346
|
+
|
|
3347
|
+
it('should set replacedAt on existing entries when replacedAt is provided', async () => {
|
|
3348
|
+
await setupParserViaInitialSetup('http://locus-url-A.com');
|
|
3349
|
+
|
|
3350
|
+
// Call createHashTreeParser with replacedAt via parse -> handleHashTreeParserSwitch
|
|
3351
|
+
// which calls createHashTreeParser with replacedAt from the self element
|
|
3352
|
+
locusInfo.webex.internal.device.url = 'http://device-url.com';
|
|
3353
|
+
const message = {
|
|
3354
|
+
locusUrl: 'http://locus-url-B.com',
|
|
3355
|
+
locusStateElements: [
|
|
3356
|
+
{
|
|
3357
|
+
htMeta: {elementId: {type: 'Metadata'}},
|
|
3358
|
+
data: {visibleDataSets: [{name: 'dataset1', url: 'test-url'}]},
|
|
3359
|
+
},
|
|
3360
|
+
{
|
|
3361
|
+
htMeta: {elementId: {type: 'Self'}},
|
|
3362
|
+
data: {
|
|
3363
|
+
devices: [{url: 'http://device-url.com', replaces: [{locusUrl: 'http://locus-url-A.com', replacedAt: '2026-01-01T00:00:00Z'}]}],
|
|
3364
|
+
},
|
|
3365
|
+
},
|
|
3366
|
+
],
|
|
3367
|
+
dataSets: [{name: 'dataset1', url: 'test-url'}],
|
|
3368
|
+
};
|
|
3369
|
+
|
|
3370
|
+
locusInfo.parse(mockMeeting, {
|
|
3371
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3372
|
+
stateElementsMessage: message,
|
|
3373
|
+
});
|
|
3374
|
+
|
|
3375
|
+
assert.equal(locusInfo.hashTreeParsers.get('http://locus-url-A.com').replacedAt, '2026-01-01T00:00:00Z');
|
|
3376
|
+
});
|
|
3377
|
+
|
|
3378
|
+
it('should not set replacedAt on existing entries when replacedAt is not provided', async () => {
|
|
3379
|
+
await setupParserViaInitialSetup('http://locus-url-A.com');
|
|
3380
|
+
|
|
3381
|
+
await setupParserViaInitialSetup('http://locus-url-B.com');
|
|
3382
|
+
|
|
3383
|
+
assert.isUndefined(locusInfo.hashTreeParsers.get('http://locus-url-A.com').replacedAt);
|
|
3384
|
+
});
|
|
3385
|
+
|
|
3386
|
+
it('should store the new parser in hashTreeParsers map with the correct locusUrl key', async () => {
|
|
3387
|
+
await setupParserViaInitialSetup('http://locus-url-A.com');
|
|
3388
|
+
|
|
3389
|
+
assert.isTrue(locusInfo.hashTreeParsers.has('http://locus-url-A.com'));
|
|
3390
|
+
assert.isDefined(locusInfo.hashTreeParsers.get('http://locus-url-A.com').parser);
|
|
3391
|
+
});
|
|
3392
|
+
|
|
3393
|
+
it('should clear hashTreeObjectId2ParticipantId when creating a new parser', async () => {
|
|
3394
|
+
await setupParserViaInitialSetup('http://locus-url-A.com');
|
|
3395
|
+
locusInfo.hashTreeObjectId2ParticipantId.set(1, 'participant-1');
|
|
3396
|
+
|
|
3397
|
+
await setupParserViaInitialSetup('http://locus-url-B.com');
|
|
3398
|
+
|
|
3399
|
+
assert.equal(locusInfo.hashTreeObjectId2ParticipantId.size, 0);
|
|
3400
|
+
});
|
|
3401
|
+
|
|
3402
|
+
it('should not stop already stopped parsers', async () => {
|
|
3403
|
+
await setupParserViaInitialSetup('http://locus-url-A.com');
|
|
3404
|
+
const firstParser = locusInfo.hashTreeParsers.get('http://locus-url-A.com').parser;
|
|
3405
|
+
firstParser.state = 'stopped';
|
|
3406
|
+
|
|
3407
|
+
await setupParserViaInitialSetup('http://locus-url-B.com');
|
|
3408
|
+
|
|
3409
|
+
assert.notCalled(firstParser.stop);
|
|
3410
|
+
});
|
|
3411
|
+
});
|
|
3412
|
+
|
|
3413
|
+
describe('#handleHashTreeParserSwitch', () => {
|
|
3414
|
+
const deviceUrl = 'http://device-url.com';
|
|
3415
|
+
const locusUrlA = 'http://locus-url-A.com';
|
|
3416
|
+
const locusUrlB = 'http://locus-url-B.com';
|
|
3417
|
+
|
|
3418
|
+
let HashTreeParserStub;
|
|
3419
|
+
|
|
3420
|
+
const createMockParser = (state = 'active') => ({
|
|
3421
|
+
state,
|
|
3422
|
+
stop: sinon.stub(),
|
|
3423
|
+
resumeFromMessage: sinon.stub(),
|
|
3424
|
+
handleMessage: sinon.stub(),
|
|
3425
|
+
});
|
|
3426
|
+
|
|
3427
|
+
const createSelfElementWithReplaces = (replacedLocusUrl, replacedAt) => ({
|
|
3428
|
+
htMeta: {elementId: {type: 'Self'}},
|
|
3429
|
+
data: {
|
|
3430
|
+
deviceUrl,
|
|
3431
|
+
devices: [{url: deviceUrl, replaces: [{locusUrl: replacedLocusUrl, replacedAt}]}],
|
|
3432
|
+
},
|
|
3433
|
+
});
|
|
3434
|
+
|
|
3435
|
+
const createMetadataElement = () => ({
|
|
3436
|
+
htMeta: {elementId: {type: 'Metadata'}},
|
|
3437
|
+
data: {visibleDataSets: [{name: 'dataset1', url: 'test-url'}]},
|
|
3438
|
+
});
|
|
3439
|
+
|
|
3440
|
+
beforeEach(() => {
|
|
3441
|
+
locusInfo.webex.internal.device.url = deviceUrl;
|
|
3442
|
+
HashTreeParserStub = sinon
|
|
3443
|
+
.stub(HashTreeParserModule, 'default')
|
|
3444
|
+
.returns(createMockParser());
|
|
3445
|
+
});
|
|
3446
|
+
|
|
3447
|
+
it('should create a new parser when no entry exists for locusUrl and metadata has visibleDataSets', () => {
|
|
3448
|
+
// set up an existing parser for a different url
|
|
3449
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: createMockParser(), initializedFromHashTree: true});
|
|
3450
|
+
|
|
3451
|
+
const message = {
|
|
3452
|
+
locusUrl: locusUrlB,
|
|
3453
|
+
locusStateElements: [createMetadataElement()],
|
|
3454
|
+
dataSets: [{name: 'dataset1', url: 'test-url'}],
|
|
3455
|
+
};
|
|
3456
|
+
|
|
3457
|
+
locusInfo.parse(mockMeeting, {
|
|
3458
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3459
|
+
stateElementsMessage: message,
|
|
3460
|
+
});
|
|
3461
|
+
|
|
3462
|
+
assert.isTrue(locusInfo.hashTreeParsers.has(locusUrlB));
|
|
3463
|
+
});
|
|
3464
|
+
|
|
3465
|
+
it('should return true when no entry exists even if no metadata is available', () => {
|
|
3466
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: createMockParser(), initializedFromHashTree: true});
|
|
3467
|
+
const parserA = locusInfo.hashTreeParsers.get(locusUrlA).parser;
|
|
3468
|
+
|
|
3469
|
+
const message = {
|
|
3470
|
+
locusUrl: locusUrlB,
|
|
3471
|
+
locusStateElements: [],
|
|
3472
|
+
dataSets: [],
|
|
3473
|
+
};
|
|
3474
|
+
|
|
3475
|
+
locusInfo.parse(mockMeeting, {
|
|
3476
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3477
|
+
stateElementsMessage: message,
|
|
3478
|
+
});
|
|
3479
|
+
|
|
3480
|
+
// no new parser created since no metadata
|
|
3481
|
+
assert.isFalse(locusInfo.hashTreeParsers.has(locusUrlB));
|
|
3482
|
+
// the existing parser's handleMessage should NOT have been called
|
|
3483
|
+
assert.notCalled(parserA.handleMessage);
|
|
3484
|
+
});
|
|
3485
|
+
|
|
3486
|
+
it('should resume a stopped parser when replaces info is newer', () => {
|
|
3487
|
+
const parserA = createMockParser('stopped');
|
|
3488
|
+
const parserB = createMockParser('active');
|
|
3489
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, replacedAt: '2026-01-01T00:00:00Z', initializedFromHashTree: true});
|
|
3490
|
+
locusInfo.hashTreeParsers.set(locusUrlB, {parser: parserB, initializedFromHashTree: true});
|
|
3491
|
+
|
|
3492
|
+
const message = {
|
|
3493
|
+
locusUrl: locusUrlA,
|
|
3494
|
+
locusStateElements: [
|
|
3495
|
+
createSelfElementWithReplaces(locusUrlB, '2026-02-01T00:00:00Z'),
|
|
3496
|
+
createMetadataElement(),
|
|
3497
|
+
],
|
|
3498
|
+
dataSets: [{name: 'dataset1', url: 'test-url'}],
|
|
3499
|
+
};
|
|
3500
|
+
|
|
3501
|
+
locusInfo.parse(mockMeeting, {
|
|
3502
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3503
|
+
stateElementsMessage: message,
|
|
3504
|
+
});
|
|
3505
|
+
|
|
3506
|
+
assert.calledOnce(parserA.resumeFromMessage);
|
|
3507
|
+
assert.calledOnce(parserB.stop);
|
|
3508
|
+
});
|
|
3509
|
+
|
|
3510
|
+
it('should not resume a stopped parser when replaces info is not newer', () => {
|
|
3511
|
+
const parserA = createMockParser('stopped');
|
|
3512
|
+
const parserB = createMockParser('active');
|
|
3513
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, replacedAt: '2026-03-01T00:00:00Z', initializedFromHashTree: true});
|
|
3514
|
+
locusInfo.hashTreeParsers.set(locusUrlB, {parser: parserB, initializedFromHashTree: true});
|
|
3515
|
+
|
|
3516
|
+
const message = {
|
|
3517
|
+
locusUrl: locusUrlA,
|
|
3518
|
+
locusStateElements: [
|
|
3519
|
+
createSelfElementWithReplaces(locusUrlB, '2026-01-01T00:00:00Z'),
|
|
3520
|
+
],
|
|
3521
|
+
dataSets: [{name: 'dataset1', url: 'test-url'}],
|
|
3522
|
+
};
|
|
3523
|
+
|
|
3524
|
+
locusInfo.parse(mockMeeting, {
|
|
3525
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3526
|
+
stateElementsMessage: message,
|
|
3527
|
+
});
|
|
3528
|
+
|
|
3529
|
+
assert.notCalled(parserA.resumeFromMessage);
|
|
3530
|
+
assert.notCalled(parserB.stop);
|
|
3531
|
+
});
|
|
3532
|
+
|
|
3533
|
+
it('should return true for a stopped parser with no replaces info', () => {
|
|
3534
|
+
const parserA = createMockParser('stopped');
|
|
3535
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, initializedFromHashTree: true});
|
|
3536
|
+
|
|
3537
|
+
const message = {
|
|
3538
|
+
locusUrl: locusUrlA,
|
|
3539
|
+
locusStateElements: [],
|
|
3540
|
+
dataSets: [],
|
|
3541
|
+
};
|
|
3542
|
+
|
|
3543
|
+
locusInfo.parse(mockMeeting, {
|
|
3544
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3545
|
+
stateElementsMessage: message,
|
|
3546
|
+
});
|
|
3547
|
+
|
|
3548
|
+
assert.notCalled(parserA.resumeFromMessage);
|
|
3549
|
+
assert.notCalled(parserA.handleMessage);
|
|
3550
|
+
});
|
|
3551
|
+
|
|
3552
|
+
it('should return false when the entry exists and parser is active', () => {
|
|
3553
|
+
const parserA = createMockParser('active');
|
|
3554
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, initializedFromHashTree: true});
|
|
3555
|
+
|
|
3556
|
+
const message = {
|
|
3557
|
+
locusUrl: locusUrlA,
|
|
3558
|
+
locusStateElements: [],
|
|
3559
|
+
dataSets: [],
|
|
3560
|
+
};
|
|
3561
|
+
|
|
3562
|
+
locusInfo.parse(mockMeeting, {
|
|
3563
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3564
|
+
stateElementsMessage: message,
|
|
3565
|
+
});
|
|
3566
|
+
|
|
3567
|
+
assert.calledOnceWithExactly(parserA.handleMessage, message);
|
|
3568
|
+
});
|
|
3569
|
+
|
|
3570
|
+
it('should pass replacedAt from replaces to createHashTreeParser when creating a new parser', () => {
|
|
3571
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: createMockParser(), initializedFromHashTree: true});
|
|
3572
|
+
|
|
3573
|
+
const message = {
|
|
3574
|
+
locusUrl: locusUrlB,
|
|
3575
|
+
locusStateElements: [
|
|
3576
|
+
createMetadataElement(),
|
|
3577
|
+
createSelfElementWithReplaces(locusUrlA, '2026-05-01T00:00:00Z'),
|
|
3578
|
+
],
|
|
3579
|
+
dataSets: [{name: 'dataset1', url: 'test-url'}],
|
|
3580
|
+
};
|
|
3581
|
+
|
|
3582
|
+
locusInfo.parse(mockMeeting, {
|
|
3583
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3584
|
+
stateElementsMessage: message,
|
|
3585
|
+
});
|
|
3586
|
+
|
|
3587
|
+
assert.isTrue(locusInfo.hashTreeParsers.has(locusUrlB));
|
|
3588
|
+
assert.equal(locusInfo.hashTreeParsers.get(locusUrlA).replacedAt, '2026-05-01T00:00:00Z');
|
|
3589
|
+
});
|
|
3590
|
+
});
|
|
3591
|
+
|
|
3592
|
+
describe('#handleHashTreeMessage', () => {
|
|
3593
|
+
it('should call handleHashTreeParserSwitch and not call handleMessage if parser was switched', () => {
|
|
3594
|
+
const locusUrlA = 'http://locus-url-A.com';
|
|
3595
|
+
const locusUrlB = 'http://locus-url-B.com';
|
|
3596
|
+
const parserA = {state: 'stopped', handleMessage: sinon.stub(), resume: sinon.stub(), stop: sinon.stub()};
|
|
3597
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, initializedFromHashTree: true});
|
|
3598
|
+
|
|
3599
|
+
// message for a stopped parser without replaces -> handleHashTreeParserSwitch returns true
|
|
3600
|
+
const message = {
|
|
3601
|
+
locusUrl: locusUrlA,
|
|
3602
|
+
locusStateElements: [],
|
|
3603
|
+
dataSets: [],
|
|
3604
|
+
};
|
|
3605
|
+
|
|
3606
|
+
locusInfo.parse(mockMeeting, {
|
|
3607
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3608
|
+
stateElementsMessage: message,
|
|
3609
|
+
});
|
|
3610
|
+
|
|
3611
|
+
assert.notCalled(parserA.handleMessage);
|
|
3612
|
+
});
|
|
3613
|
+
|
|
3614
|
+
it('should call handleMessage on the correct parser when no switch occurs', () => {
|
|
3615
|
+
const locusUrlA = 'http://locus-url-A.com';
|
|
3616
|
+
const parserA = {state: 'active', handleMessage: sinon.stub()};
|
|
3617
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, initializedFromHashTree: true});
|
|
3618
|
+
|
|
3619
|
+
const message = {
|
|
3620
|
+
locusUrl: locusUrlA,
|
|
3621
|
+
locusStateElements: [],
|
|
3622
|
+
dataSets: [],
|
|
3623
|
+
};
|
|
3624
|
+
|
|
3625
|
+
locusInfo.parse(mockMeeting, {
|
|
3626
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
3627
|
+
stateElementsMessage: message,
|
|
3628
|
+
});
|
|
3629
|
+
|
|
3630
|
+
assert.calledOnceWithExactly(parserA.handleMessage, message);
|
|
3631
|
+
});
|
|
3632
|
+
|
|
3633
|
+
it('should send mismatch metric when eventType is not HASH_TREE_DATA_UPDATED', () => {
|
|
3634
|
+
const locusUrlA = 'http://locus-url-A.com';
|
|
3635
|
+
const parserA = {state: 'active', handleMessage: sinon.stub()};
|
|
3636
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, initializedFromHashTree: true});
|
|
3637
|
+
|
|
3638
|
+
locusInfo.parse(mockMeeting, {
|
|
3639
|
+
eventType: LOCUSEVENT.SELF_CHANGED,
|
|
3640
|
+
stateElementsMessage: {locusUrl: locusUrlA, locusStateElements: [], dataSets: []},
|
|
3641
|
+
});
|
|
3642
|
+
|
|
3643
|
+
assert.calledOnceWithExactly(
|
|
3644
|
+
sendBehavioralMetricStub,
|
|
3645
|
+
'js_sdk_locus_classic_vs_hash_tree_mismatch',
|
|
3646
|
+
{
|
|
3647
|
+
correlationId: mockMeeting.correlationId,
|
|
3648
|
+
message: `got ${LOCUSEVENT.SELF_CHANGED}, expected ${LOCUSEVENT.HASH_TREE_DATA_UPDATED}`,
|
|
3649
|
+
}
|
|
3650
|
+
);
|
|
3651
|
+
assert.notCalled(parserA.handleMessage);
|
|
3652
|
+
});
|
|
3653
|
+
});
|
|
3654
|
+
|
|
3655
|
+
describe('#sendClassicVsHashTreeMismatchMetric', () => {
|
|
3656
|
+
it('should send the metric when called for the first time', () => {
|
|
3657
|
+
locusInfo.sendClassicVsHashTreeMismatchMetric(mockMeeting, 'some mismatch');
|
|
3658
|
+
|
|
3659
|
+
assert.calledOnceWithExactly(
|
|
3660
|
+
sendBehavioralMetricStub,
|
|
3661
|
+
'js_sdk_locus_classic_vs_hash_tree_mismatch',
|
|
3662
|
+
{
|
|
3663
|
+
correlationId: mockMeeting.correlationId,
|
|
3664
|
+
message: 'some mismatch',
|
|
3665
|
+
}
|
|
3666
|
+
);
|
|
3667
|
+
});
|
|
3668
|
+
|
|
3669
|
+
it('should send the metric up to 5 times and stop after that', () => {
|
|
3670
|
+
for (let i = 0; i < 7; i += 1) {
|
|
3671
|
+
locusInfo.sendClassicVsHashTreeMismatchMetric(mockMeeting, `mismatch ${i}`);
|
|
3672
|
+
}
|
|
3673
|
+
|
|
3674
|
+
assert.callCount(sendBehavioralMetricStub, 5);
|
|
3675
|
+
assert.equal(locusInfo.classicVsHashTreeMismatchMetricCounter, 5);
|
|
3676
|
+
});
|
|
3677
|
+
});
|
|
3678
|
+
|
|
3679
|
+
describe('#handleLocusAPIResponse', () => {
|
|
3680
|
+
it('calls handleLocusDelta when we are not using hash trees', () => {
|
|
3681
|
+
const fakeLocus = {eventType: LOCUSEVENT.DIFFERENCE};
|
|
3682
|
+
|
|
3683
|
+
sinon.stub(locusInfo, 'handleLocusDelta');
|
|
3684
|
+
|
|
3685
|
+
locusInfo.handleLocusAPIResponse(mockMeeting, {locus: fakeLocus});
|
|
3686
|
+
|
|
3687
|
+
assert.calledWith(locusInfo.handleLocusDelta, fakeLocus, mockMeeting);
|
|
3688
|
+
});
|
|
3689
|
+
it('calls hash tree parser when we are using hash trees', () => {
|
|
3690
|
+
const fakeLocus = {eventType: LOCUSEVENT.DIFFERENCE, url: 'http://locus-url.com'};
|
|
2850
3691
|
const fakeDataSets = [{name: 'dataset1', url: 'http://test.com'}];
|
|
2851
3692
|
const responseBody = {locus: fakeLocus, dataSets: fakeDataSets};
|
|
2852
3693
|
|
|
@@ -2854,7 +3695,10 @@ describe('plugin-meetings', () => {
|
|
|
2854
3695
|
const mockHashTreeParser = {
|
|
2855
3696
|
handleLocusUpdate: sinon.stub(),
|
|
2856
3697
|
};
|
|
2857
|
-
locusInfo.
|
|
3698
|
+
locusInfo.hashTreeParsers.set(fakeLocus.url, {
|
|
3699
|
+
parser: mockHashTreeParser,
|
|
3700
|
+
initializedFromHashTree: true,
|
|
3701
|
+
});
|
|
2858
3702
|
|
|
2859
3703
|
sinon.stub(locusInfo, 'onDeltaLocus');
|
|
2860
3704
|
|
|
@@ -2862,6 +3706,210 @@ describe('plugin-meetings', () => {
|
|
|
2862
3706
|
|
|
2863
3707
|
assert.calledOnceWithExactly(mockHashTreeParser.handleLocusUpdate, responseBody);
|
|
2864
3708
|
});
|
|
3709
|
+
|
|
3710
|
+
it('should handle unwrapped LocusDTO (without locus wrapper) when hash tree parser exists', () => {
|
|
3711
|
+
const fakeLocus = {url: 'http://locus-url.com', fullState: {state: 'ACTIVE'}};
|
|
3712
|
+
const mockHashTreeParser = {handleLocusUpdate: sinon.stub()};
|
|
3713
|
+
locusInfo.hashTreeParsers.set(fakeLocus.url, {
|
|
3714
|
+
parser: mockHashTreeParser,
|
|
3715
|
+
initializedFromHashTree: true,
|
|
3716
|
+
});
|
|
3717
|
+
|
|
3718
|
+
locusInfo.handleLocusAPIResponse(mockMeeting, fakeLocus);
|
|
3719
|
+
|
|
3720
|
+
assert.calledOnceWithExactly(mockHashTreeParser.handleLocusUpdate, {locus: fakeLocus});
|
|
3721
|
+
});
|
|
3722
|
+
|
|
3723
|
+
it('should handle unwrapped LocusDTO in classic mode (no hash tree parser)', () => {
|
|
3724
|
+
const fakeLocus = {url: 'http://locus-url.com', fullState: {state: 'ACTIVE'}};
|
|
3725
|
+
sinon.stub(locusInfo, 'handleLocusDelta');
|
|
3726
|
+
|
|
3727
|
+
locusInfo.handleLocusAPIResponse(mockMeeting, fakeLocus);
|
|
3728
|
+
|
|
3729
|
+
assert.calledOnceWithExactly(locusInfo.handleLocusDelta, fakeLocus, mockMeeting);
|
|
3730
|
+
});
|
|
3731
|
+
|
|
3732
|
+
it('should send mismatch metric in classic mode when wrapped response has dataSets', () => {
|
|
3733
|
+
const fakeLocus = {url: 'http://locus-url.com'};
|
|
3734
|
+
sinon.stub(locusInfo, 'handleLocusDelta');
|
|
3735
|
+
|
|
3736
|
+
locusInfo.handleLocusAPIResponse(mockMeeting, {
|
|
3737
|
+
locus: fakeLocus,
|
|
3738
|
+
dataSets: [{name: 'dataset1', url: 'test-url'}],
|
|
3739
|
+
});
|
|
3740
|
+
|
|
3741
|
+
assert.calledOnceWithExactly(
|
|
3742
|
+
sendBehavioralMetricStub,
|
|
3743
|
+
'js_sdk_locus_classic_vs_hash_tree_mismatch',
|
|
3744
|
+
{
|
|
3745
|
+
correlationId: mockMeeting.correlationId,
|
|
3746
|
+
message: 'unexpected hash tree dataSets in API response',
|
|
3747
|
+
}
|
|
3748
|
+
);
|
|
3749
|
+
assert.calledOnce(locusInfo.handleLocusDelta);
|
|
3750
|
+
});
|
|
3751
|
+
|
|
3752
|
+
describe('parser switch via API response', () => {
|
|
3753
|
+
const deviceUrl = 'http://device-url.com';
|
|
3754
|
+
const locusUrlA = 'http://locus-url-A.com';
|
|
3755
|
+
const locusUrlB = 'http://locus-url-B.com';
|
|
3756
|
+
|
|
3757
|
+
let HashTreeParserStub;
|
|
3758
|
+
|
|
3759
|
+
const createMockApiParser = (state = 'active') => ({
|
|
3760
|
+
state,
|
|
3761
|
+
stop: sinon.stub(),
|
|
3762
|
+
resumeFromApiResponse: sinon.stub(),
|
|
3763
|
+
handleLocusUpdate: sinon.stub(),
|
|
3764
|
+
initializeFromGetLociResponse: sinon.stub(),
|
|
3765
|
+
});
|
|
3766
|
+
|
|
3767
|
+
const createLocusWithReplaces = (url, replacedLocusUrl, replacedAt) => ({
|
|
3768
|
+
url,
|
|
3769
|
+
self: {
|
|
3770
|
+
devices: [{url: deviceUrl, replaces: [{locusUrl: replacedLocusUrl, replacedAt}]}],
|
|
3771
|
+
},
|
|
3772
|
+
});
|
|
3773
|
+
|
|
3774
|
+
const createLocusWithoutReplaces = (url) => ({
|
|
3775
|
+
url,
|
|
3776
|
+
self: {devices: [{url: deviceUrl}]},
|
|
3777
|
+
});
|
|
3778
|
+
|
|
3779
|
+
beforeEach(() => {
|
|
3780
|
+
locusInfo.webex.internal.device.url = deviceUrl;
|
|
3781
|
+
HashTreeParserStub = sinon
|
|
3782
|
+
.stub(HashTreeParserModule, 'default')
|
|
3783
|
+
.returns(createMockApiParser());
|
|
3784
|
+
});
|
|
3785
|
+
|
|
3786
|
+
it('should create a new parser and initialize it when no entry exists for the locusUrl', () => {
|
|
3787
|
+
// existing parser for a different url so hashTreeParsers.size > 0
|
|
3788
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: createMockApiParser(), initializedFromHashTree: true});
|
|
3789
|
+
|
|
3790
|
+
const locus = createLocusWithReplaces(locusUrlB, locusUrlA, '2026-01-01T00:00:00Z');
|
|
3791
|
+
sinon.stub(locusInfo, 'handleLocusDelta');
|
|
3792
|
+
|
|
3793
|
+
locusInfo.handleLocusAPIResponse(mockMeeting, {locus});
|
|
3794
|
+
|
|
3795
|
+
assert.isTrue(locusInfo.hashTreeParsers.has(locusUrlB));
|
|
3796
|
+
const newEntry = locusInfo.hashTreeParsers.get(locusUrlB);
|
|
3797
|
+
assert.isFalse(newEntry.initializedFromHashTree);
|
|
3798
|
+
|
|
3799
|
+
// the stub returns the mock, so initializeFromGetLociResponse should be called on it
|
|
3800
|
+
const createdParser = HashTreeParserStub.returnValues[0];
|
|
3801
|
+
assert.calledOnceWithExactly(createdParser.initializeFromGetLociResponse, locus);
|
|
3802
|
+
assert.notCalled(locusInfo.handleLocusDelta);
|
|
3803
|
+
});
|
|
3804
|
+
|
|
3805
|
+
it('should reactivate a stopped parser when replaces info is newer', () => {
|
|
3806
|
+
const parserA = createMockApiParser('stopped');
|
|
3807
|
+
const parserB = createMockApiParser('active');
|
|
3808
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, replacedAt: '2026-01-01T00:00:00Z', initializedFromHashTree: true});
|
|
3809
|
+
locusInfo.hashTreeParsers.set(locusUrlB, {parser: parserB, initializedFromHashTree: true});
|
|
3810
|
+
|
|
3811
|
+
const locus = createLocusWithReplaces(locusUrlA, locusUrlB, '2026-02-01T00:00:00Z');
|
|
3812
|
+
|
|
3813
|
+
locusInfo.handleLocusAPIResponse(mockMeeting, {locus});
|
|
3814
|
+
|
|
3815
|
+
assert.calledOnce(parserA.resumeFromApiResponse);
|
|
3816
|
+
assert.calledWithExactly(parserA.resumeFromApiResponse, locus);
|
|
3817
|
+
assert.calledOnce(parserB.stop);
|
|
3818
|
+
assert.equal(locusInfo.hashTreeParsers.get(locusUrlB).replacedAt, '2026-02-01T00:00:00Z');
|
|
3819
|
+
assert.isFalse(locusInfo.hashTreeParsers.get(locusUrlA).initializedFromHashTree);
|
|
3820
|
+
});
|
|
3821
|
+
|
|
3822
|
+
it('should not reactivate a stopped parser when replaces info is not newer', () => {
|
|
3823
|
+
const parserA = createMockApiParser('stopped');
|
|
3824
|
+
const parserB = createMockApiParser('active');
|
|
3825
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, replacedAt: '2026-03-01T00:00:00Z', initializedFromHashTree: true});
|
|
3826
|
+
locusInfo.hashTreeParsers.set(locusUrlB, {parser: parserB, initializedFromHashTree: true});
|
|
3827
|
+
|
|
3828
|
+
const locus = createLocusWithReplaces(locusUrlA, locusUrlB, '2026-01-01T00:00:00Z');
|
|
3829
|
+
|
|
3830
|
+
locusInfo.handleLocusAPIResponse(mockMeeting, {locus});
|
|
3831
|
+
|
|
3832
|
+
assert.notCalled(parserA.resumeFromApiResponse);
|
|
3833
|
+
assert.notCalled(parserB.stop);
|
|
3834
|
+
});
|
|
3835
|
+
|
|
3836
|
+
it('should not reactivate a stopped parser when no replaces info is available', () => {
|
|
3837
|
+
const parserA = createMockApiParser('stopped');
|
|
3838
|
+
locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, initializedFromHashTree: true});
|
|
3839
|
+
|
|
3840
|
+
const locus = createLocusWithoutReplaces(locusUrlA);
|
|
3841
|
+
|
|
3842
|
+
locusInfo.handleLocusAPIResponse(mockMeeting, {locus});
|
|
3843
|
+
|
|
3844
|
+
assert.notCalled(parserA.resumeFromApiResponse);
|
|
3845
|
+
});
|
|
3846
|
+
});
|
|
3847
|
+
});
|
|
3848
|
+
|
|
3849
|
+
describe('#syncAllHashTreeDatasets', () => {
|
|
3850
|
+
it('should call syncAllDatasets on each parser that has an entry', async () => {
|
|
3851
|
+
const parser1 = {syncAllDatasets: sinon.stub().resolves()};
|
|
3852
|
+
const parser2 = {syncAllDatasets: sinon.stub().resolves()};
|
|
3853
|
+
locusInfo.hashTreeParsers.set('url1', {parser: parser1});
|
|
3854
|
+
locusInfo.hashTreeParsers.set('url2', {parser: parser2});
|
|
3855
|
+
|
|
3856
|
+
await locusInfo.syncAllHashTreeDatasets();
|
|
3857
|
+
|
|
3858
|
+
assert.calledOnce(parser1.syncAllDatasets);
|
|
3859
|
+
assert.calledOnce(parser2.syncAllDatasets);
|
|
3860
|
+
});
|
|
3861
|
+
|
|
3862
|
+
it('should skip parser entries without a parser object', async () => {
|
|
3863
|
+
const parser1 = {syncAllDatasets: sinon.stub().resolves()};
|
|
3864
|
+
locusInfo.hashTreeParsers.set('url1', {parser: parser1});
|
|
3865
|
+
locusInfo.hashTreeParsers.set('url2', {parser: undefined});
|
|
3866
|
+
|
|
3867
|
+
await locusInfo.syncAllHashTreeDatasets();
|
|
3868
|
+
|
|
3869
|
+
assert.calledOnce(parser1.syncAllDatasets);
|
|
3870
|
+
});
|
|
3871
|
+
|
|
3872
|
+
it('should forward options to each parser syncAllDatasets', async () => {
|
|
3873
|
+
const parser1 = {syncAllDatasets: sinon.stub().resolves()};
|
|
3874
|
+
const parser2 = {syncAllDatasets: sinon.stub().resolves()};
|
|
3875
|
+
locusInfo.hashTreeParsers.set('url1', {parser: parser1});
|
|
3876
|
+
locusInfo.hashTreeParsers.set('url2', {parser: parser2});
|
|
3877
|
+
|
|
3878
|
+
await locusInfo.syncAllHashTreeDatasets({onlyLLM: true});
|
|
3879
|
+
|
|
3880
|
+
assert.calledOnceWithExactly(parser1.syncAllDatasets, {onlyLLM: true});
|
|
3881
|
+
assert.calledOnceWithExactly(parser2.syncAllDatasets, {onlyLLM: true});
|
|
3882
|
+
});
|
|
3883
|
+
|
|
3884
|
+
it('should await each parsers syncAllDatasets sequentially', async () => {
|
|
3885
|
+
const callOrder = [];
|
|
3886
|
+
const parser1 = {syncAllDatasets: sinon.stub().callsFake(() => {
|
|
3887
|
+
callOrder.push('start1');
|
|
3888
|
+
return new Promise((resolve) => {
|
|
3889
|
+
setTimeout(() => {
|
|
3890
|
+
callOrder.push('end1');
|
|
3891
|
+
resolve();
|
|
3892
|
+
}, 100);
|
|
3893
|
+
});
|
|
3894
|
+
})};
|
|
3895
|
+
const parser2 = {syncAllDatasets: sinon.stub().callsFake(() => {
|
|
3896
|
+
callOrder.push('start2');
|
|
3897
|
+
return Promise.resolve();
|
|
3898
|
+
})};
|
|
3899
|
+
locusInfo.hashTreeParsers.set('url1', {parser: parser1});
|
|
3900
|
+
locusInfo.hashTreeParsers.set('url2', {parser: parser2});
|
|
3901
|
+
|
|
3902
|
+
const clock = sinon.useFakeTimers();
|
|
3903
|
+
const promise = locusInfo.syncAllHashTreeDatasets();
|
|
3904
|
+
// parser1 started but parser2 not yet
|
|
3905
|
+
assert.deepEqual(callOrder, ['start1']);
|
|
3906
|
+
|
|
3907
|
+
await clock.tickAsync(100);
|
|
3908
|
+
await promise;
|
|
3909
|
+
// parser1 finished, then parser2 started and finished
|
|
3910
|
+
assert.deepEqual(callOrder, ['start1', 'end1', 'start2']);
|
|
3911
|
+
clock.restore();
|
|
3912
|
+
});
|
|
2865
3913
|
});
|
|
2866
3914
|
|
|
2867
3915
|
describe('#LocusDeltaEvents', () => {
|
|
@@ -2923,28 +3971,28 @@ describe('plugin-meetings', () => {
|
|
|
2923
3971
|
assert.isFunction(locusParser.onDeltaAction);
|
|
2924
3972
|
});
|
|
2925
3973
|
|
|
2926
|
-
it(
|
|
3974
|
+
it('#updateLocusInfo invokes updateLocusUrl before updateMeetingInfo', () => {
|
|
2927
3975
|
const callOrder = [];
|
|
2928
|
-
sinon.stub(locusInfo,
|
|
2929
|
-
sinon.stub(locusInfo,
|
|
2930
|
-
sinon.stub(locusInfo,
|
|
2931
|
-
sinon.stub(locusInfo,
|
|
2932
|
-
sinon.stub(locusInfo,
|
|
2933
|
-
sinon.stub(locusInfo,
|
|
2934
|
-
callOrder.push(
|
|
3976
|
+
sinon.stub(locusInfo, 'updateControls');
|
|
3977
|
+
sinon.stub(locusInfo, 'updateConversationUrl');
|
|
3978
|
+
sinon.stub(locusInfo, 'updateCreated');
|
|
3979
|
+
sinon.stub(locusInfo, 'updateFullState');
|
|
3980
|
+
sinon.stub(locusInfo, 'updateHostInfo');
|
|
3981
|
+
sinon.stub(locusInfo, 'updateMeetingInfo').callsFake(() => {
|
|
3982
|
+
callOrder.push('updateMeetingInfo');
|
|
2935
3983
|
});
|
|
2936
|
-
sinon.stub(locusInfo,
|
|
2937
|
-
sinon.stub(locusInfo,
|
|
2938
|
-
sinon.stub(locusInfo,
|
|
2939
|
-
sinon.stub(locusInfo,
|
|
2940
|
-
callOrder.push(
|
|
3984
|
+
sinon.stub(locusInfo, 'updateMediaShares');
|
|
3985
|
+
sinon.stub(locusInfo, 'updateReplaces');
|
|
3986
|
+
sinon.stub(locusInfo, 'updateSelf');
|
|
3987
|
+
sinon.stub(locusInfo, 'updateLocusUrl').callsFake(() => {
|
|
3988
|
+
callOrder.push('updateLocusUrl');
|
|
2941
3989
|
});
|
|
2942
|
-
sinon.stub(locusInfo,
|
|
2943
|
-
sinon.stub(locusInfo,
|
|
2944
|
-
sinon.stub(locusInfo,
|
|
2945
|
-
sinon.stub(locusInfo,
|
|
2946
|
-
sinon.stub(locusInfo,
|
|
2947
|
-
sinon.stub(locusInfo,
|
|
3990
|
+
sinon.stub(locusInfo, 'updateAclUrl');
|
|
3991
|
+
sinon.stub(locusInfo, 'updateBasequence');
|
|
3992
|
+
sinon.stub(locusInfo, 'updateSequence');
|
|
3993
|
+
sinon.stub(locusInfo, 'updateEmbeddedApps');
|
|
3994
|
+
sinon.stub(locusInfo, 'updateLinks');
|
|
3995
|
+
sinon.stub(locusInfo, 'compareAndUpdate');
|
|
2948
3996
|
|
|
2949
3997
|
locusInfo.updateLocusInfo(locus);
|
|
2950
3998
|
|
|
@@ -2952,55 +4000,29 @@ describe('plugin-meetings', () => {
|
|
|
2952
4000
|
assert.deepEqual(callOrder, ['updateLocusUrl', 'updateMeetingInfo']);
|
|
2953
4001
|
});
|
|
2954
4002
|
|
|
2955
|
-
it('#updateLocusInfo ignores
|
|
2956
|
-
const newLocus = {
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
state: 'LEFT',
|
|
2960
|
-
},
|
|
2961
|
-
};
|
|
4003
|
+
it('#updateLocusInfo ignores locus when isSelfMovedOrBreakoutEnded returns true', () => {
|
|
4004
|
+
const newLocus = {self: {state: 'JOINED'}};
|
|
4005
|
+
|
|
4006
|
+
sinon.stub(MeetingsUtil, 'isSelfMovedOrBreakoutEnded').returns(true);
|
|
2962
4007
|
|
|
2963
4008
|
locusInfo.updateControls = sinon.stub();
|
|
2964
|
-
locusInfo.updateConversationUrl = sinon.stub();
|
|
2965
|
-
locusInfo.updateCreated = sinon.stub();
|
|
2966
4009
|
locusInfo.updateFullState = sinon.stub();
|
|
2967
|
-
locusInfo.updateHostInfo = sinon.stub();
|
|
2968
|
-
locusInfo.updateMeetingInfo = sinon.stub();
|
|
2969
|
-
locusInfo.updateMediaShares = sinon.stub();
|
|
2970
|
-
locusInfo.updateReplaces = sinon.stub();
|
|
2971
4010
|
locusInfo.updateSelf = sinon.stub();
|
|
2972
|
-
locusInfo.updateLocusUrl = sinon.stub();
|
|
2973
|
-
locusInfo.updateAclUrl = sinon.stub();
|
|
2974
|
-
locusInfo.updateBasequence = sinon.stub();
|
|
2975
|
-
locusInfo.updateSequence = sinon.stub();
|
|
2976
|
-
locusInfo.updateEmbeddedApps = sinon.stub();
|
|
2977
|
-
locusInfo.updateLinks = sinon.stub();
|
|
2978
|
-
locusInfo.compareAndUpdate = sinon.stub();
|
|
2979
4011
|
|
|
2980
4012
|
locusInfo.updateLocusInfo(newLocus);
|
|
2981
4013
|
|
|
4014
|
+
assert.calledOnceWithExactly(MeetingsUtil.isSelfMovedOrBreakoutEnded, newLocus);
|
|
2982
4015
|
assert.notCalled(locusInfo.updateControls);
|
|
2983
|
-
assert.notCalled(locusInfo.updateConversationUrl);
|
|
2984
|
-
assert.notCalled(locusInfo.updateCreated);
|
|
2985
4016
|
assert.notCalled(locusInfo.updateFullState);
|
|
2986
|
-
assert.notCalled(locusInfo.updateHostInfo);
|
|
2987
|
-
assert.notCalled(locusInfo.updateMeetingInfo);
|
|
2988
|
-
assert.notCalled(locusInfo.updateMediaShares);
|
|
2989
|
-
assert.notCalled(locusInfo.updateReplaces);
|
|
2990
4017
|
assert.notCalled(locusInfo.updateSelf);
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
assert.notCalled(locusInfo.updateBasequence);
|
|
2994
|
-
assert.notCalled(locusInfo.updateSequence);
|
|
2995
|
-
assert.notCalled(locusInfo.updateEmbeddedApps);
|
|
2996
|
-
assert.notCalled(locusInfo.updateLinks);
|
|
2997
|
-
assert.notCalled(locusInfo.compareAndUpdate);
|
|
4018
|
+
|
|
4019
|
+
MeetingsUtil.isSelfMovedOrBreakoutEnded.restore();
|
|
2998
4020
|
});
|
|
2999
4021
|
|
|
3000
4022
|
it('#updateLocusInfo puts the Locus DTO top level properties at the right place in LocusInfo class', () => {
|
|
3001
4023
|
// this test verifies that the top-level properties of Locus DTO are copied
|
|
3002
4024
|
// into LocusInfo class and set as top level properties too
|
|
3003
|
-
// this is important, because the code handling Locus
|
|
4025
|
+
// this is important, because the code handling Locus hash trees relies on it, see updateFromHashTree()
|
|
3004
4026
|
const info = {id: 'info id'};
|
|
3005
4027
|
const fullState = {id: 'fullState id'};
|
|
3006
4028
|
const links = {services: {id: 'service links'}, resources: {id: 'resource links'}};
|
|
@@ -3039,7 +4061,7 @@ describe('plugin-meetings', () => {
|
|
|
3039
4061
|
sandbox.stub(locusInfo, 'handleOneOnOneEvent');
|
|
3040
4062
|
sandbox.stub(locusParser, 'isNewFullLocus').returns(true);
|
|
3041
4063
|
|
|
3042
|
-
locusInfo.onFullLocus(fakeLocus, eventType);
|
|
4064
|
+
locusInfo.onFullLocus('test', fakeLocus, eventType);
|
|
3043
4065
|
|
|
3044
4066
|
assert.equal(fakeLocus, locusParser.workingCopy);
|
|
3045
4067
|
});
|
|
@@ -3060,7 +4082,7 @@ describe('plugin-meetings', () => {
|
|
|
3060
4082
|
|
|
3061
4083
|
sandbox.stub(locusParser, 'isNewFullLocus').returns(false);
|
|
3062
4084
|
|
|
3063
|
-
locusInfo.onFullLocus(fakeLocus, eventType);
|
|
4085
|
+
locusInfo.onFullLocus('test', fakeLocus, eventType);
|
|
3064
4086
|
|
|
3065
4087
|
spies.forEach((spy) => {
|
|
3066
4088
|
assert.notCalled(spy);
|
|
@@ -3210,7 +4232,11 @@ describe('plugin-meetings', () => {
|
|
|
3210
4232
|
}).then(() => {
|
|
3211
4233
|
assert.calledOnceWithExactly(meeting.meetingRequest.getLocusDTO, {url: 'oldLocusUrl'});
|
|
3212
4234
|
|
|
3213
|
-
assert.calledOnceWithExactly(
|
|
4235
|
+
assert.calledOnceWithExactly(
|
|
4236
|
+
meeting.locusInfo.onFullLocus,
|
|
4237
|
+
'classic Locus sync',
|
|
4238
|
+
fakeFullLocusDto
|
|
4239
|
+
);
|
|
3214
4240
|
assert.calledOnce(locusInfo.locusParser.resume);
|
|
3215
4241
|
});
|
|
3216
4242
|
});
|
|
@@ -3308,7 +4334,11 @@ describe('plugin-meetings', () => {
|
|
|
3308
4334
|
});
|
|
3309
4335
|
|
|
3310
4336
|
assert.notCalled(meeting.locusInfo.handleLocusDelta);
|
|
3311
|
-
assert.calledOnceWithExactly(
|
|
4337
|
+
assert.calledOnceWithExactly(
|
|
4338
|
+
meeting.locusInfo.onFullLocus,
|
|
4339
|
+
'classic Locus sync',
|
|
4340
|
+
fakeFullLocusDto
|
|
4341
|
+
);
|
|
3312
4342
|
assert.calledOnce(locusInfo.locusParser.resume);
|
|
3313
4343
|
});
|
|
3314
4344
|
});
|
|
@@ -3476,34 +4506,169 @@ describe('plugin-meetings', () => {
|
|
|
3476
4506
|
|
|
3477
4507
|
locusInfo.locusParser.workingCopy = {syncUrl: 'fake locus DELTA url'};
|
|
3478
4508
|
|
|
3479
|
-
await locusInfo.applyLocusDeltaData(DESYNC, fakeLocus, meeting);
|
|
4509
|
+
await locusInfo.applyLocusDeltaData(DESYNC, fakeLocus, meeting);
|
|
4510
|
+
|
|
4511
|
+
await testUtils.flushPromises();
|
|
4512
|
+
|
|
4513
|
+
assert.calledOnceWithExactly(meeting.meetingRequest.getLocusDTO, {
|
|
4514
|
+
url: 'fake locus DELTA url',
|
|
4515
|
+
});
|
|
4516
|
+
assert.notCalled(meeting.locusInfo.handleLocusDelta);
|
|
4517
|
+
assert.calledOnceWithExactly(
|
|
4518
|
+
meeting.locusInfo.onFullLocus,
|
|
4519
|
+
'classic Locus sync',
|
|
4520
|
+
fakeFullLocusDto
|
|
4521
|
+
);
|
|
4522
|
+
assert.calledOnce(locusInfo.locusParser.resume);
|
|
4523
|
+
});
|
|
4524
|
+
});
|
|
4525
|
+
|
|
4526
|
+
describe('#updateLocusCache', () => {
|
|
4527
|
+
it('cache it if income locus is main session locus', () => {
|
|
4528
|
+
const locus = {url: 'url'};
|
|
4529
|
+
locusInfo.mainSessionLocusCache = null;
|
|
4530
|
+
locusInfo.updateLocusCache(locus);
|
|
4531
|
+
|
|
4532
|
+
assert.deepEqual(locusInfo.mainSessionLocusCache, locus);
|
|
4533
|
+
});
|
|
4534
|
+
|
|
4535
|
+
it('not cache it if income locus is breakout session locus', () => {
|
|
4536
|
+
const locus = {url: 'url', controls: {breakout: {sessionType: 'BREAKOUT'}}};
|
|
4537
|
+
locusInfo.mainSessionLocusCache = null;
|
|
4538
|
+
locusInfo.updateLocusCache(locus);
|
|
4539
|
+
|
|
4540
|
+
assert.isNull(locusInfo.mainSessionLocusCache);
|
|
4541
|
+
});
|
|
4542
|
+
|
|
4543
|
+
it('should map participant with htMeta.elementId.id of 0 (falsy number) to hashTreeObjectId2ParticipantId', () => {
|
|
4544
|
+
const locus = {
|
|
4545
|
+
url: 'url',
|
|
4546
|
+
participants: [
|
|
4547
|
+
{
|
|
4548
|
+
id: 'participant-zero',
|
|
4549
|
+
htMeta: {elementId: {id: 0}},
|
|
4550
|
+
},
|
|
4551
|
+
],
|
|
4552
|
+
};
|
|
4553
|
+
|
|
4554
|
+
sinon.stub(locusInfo.locusParser, 'isNewFullLocus').returns(true);
|
|
4555
|
+
sinon.stub(locusInfo, 'updateLocusInfo');
|
|
4556
|
+
sinon.stub(locusInfo, 'updateParticipants');
|
|
4557
|
+
sinon.stub(locusInfo, 'isMeetingActive');
|
|
4558
|
+
sinon.stub(locusInfo, 'handleOneOnOneEvent');
|
|
4559
|
+
sinon.stub(locusInfo, 'updateEmbeddedApps');
|
|
4560
|
+
locusInfo.locusParser.workingCopy = null;
|
|
4561
|
+
|
|
4562
|
+
locusInfo.onFullLocus('test', locus);
|
|
4563
|
+
|
|
4564
|
+
assert.equal(locusInfo.hashTreeObjectId2ParticipantId.get(0), 'participant-zero');
|
|
4565
|
+
});
|
|
4566
|
+
});
|
|
4567
|
+
|
|
4568
|
+
describe('#onDeltaLocus', () => {
|
|
4569
|
+
it('should use forceReplaceMembers from jsSdkMeta when it is defined', () => {
|
|
4570
|
+
sinon.stub(locusInfo, 'mergeParticipants');
|
|
4571
|
+
sinon.stub(locusInfo, 'updateLocusInfo').returns(true);
|
|
4572
|
+
sinon.stub(locusInfo, 'updateParticipants');
|
|
4573
|
+
sinon.stub(locusInfo, 'isMeetingActive');
|
|
4574
|
+
|
|
4575
|
+
locusInfo.onDeltaLocus({
|
|
4576
|
+
participants: [],
|
|
4577
|
+
jsSdkMeta: {forceReplaceMembers: true, removedParticipantIds: []},
|
|
4578
|
+
});
|
|
4579
|
+
|
|
4580
|
+
assert.calledOnceWithExactly(locusInfo.updateParticipants, [], [], true);
|
|
4581
|
+
});
|
|
4582
|
+
|
|
4583
|
+
it('should fall back to isNeedReplaceMembers when forceReplaceMembers is not in jsSdkMeta', () => {
|
|
4584
|
+
sinon.stub(locusInfo, 'mergeParticipants');
|
|
4585
|
+
sinon.stub(locusInfo, 'updateLocusInfo').returns(true);
|
|
4586
|
+
sinon.stub(locusInfo, 'updateParticipants');
|
|
4587
|
+
sinon.stub(locusInfo, 'isMeetingActive');
|
|
4588
|
+
|
|
4589
|
+
locusInfo.onDeltaLocus({participants: []});
|
|
4590
|
+
|
|
4591
|
+
// without jsSdkMeta.forceReplaceMembers, uses ControlsUtils.isNeedReplaceMembers result (false by default)
|
|
4592
|
+
assert.calledOnceWithExactly(locusInfo.updateParticipants, [], undefined, false);
|
|
4593
|
+
});
|
|
4594
|
+
|
|
4595
|
+
it('should not call updateParticipants when updateLocusInfo returns false', () => {
|
|
4596
|
+
sinon.stub(locusInfo, 'mergeParticipants');
|
|
4597
|
+
sinon.stub(locusInfo, 'updateLocusInfo').returns(false);
|
|
4598
|
+
sinon.stub(locusInfo, 'updateParticipants');
|
|
4599
|
+
sinon.stub(locusInfo, 'isMeetingActive');
|
|
4600
|
+
|
|
4601
|
+
locusInfo.onDeltaLocus({participants: [], self: {state: 'LEFT', reason: 'MOVED'}});
|
|
4602
|
+
|
|
4603
|
+
assert.notCalled(locusInfo.updateParticipants);
|
|
4604
|
+
});
|
|
4605
|
+
|
|
4606
|
+
it('should call updateParticipants when updateLocusInfo returns true', () => {
|
|
4607
|
+
sinon.stub(locusInfo, 'mergeParticipants');
|
|
4608
|
+
sinon.stub(locusInfo, 'updateLocusInfo').returns(true);
|
|
4609
|
+
sinon.stub(locusInfo, 'updateParticipants');
|
|
4610
|
+
sinon.stub(locusInfo, 'isMeetingActive');
|
|
4611
|
+
|
|
4612
|
+
locusInfo.onDeltaLocus({participants: [{id: 'p1'}]});
|
|
4613
|
+
|
|
4614
|
+
assert.calledOnce(locusInfo.updateParticipants);
|
|
4615
|
+
});
|
|
4616
|
+
|
|
4617
|
+
[
|
|
4618
|
+
{forceReplaceMembers: true, selfInParticipants: false, expectedSelfCopied: true},
|
|
4619
|
+
{forceReplaceMembers: true, selfInParticipants: true, expectedSelfCopied: false},
|
|
4620
|
+
{forceReplaceMembers: false, selfInParticipants: false, expectedSelfCopied: false},
|
|
4621
|
+
{forceReplaceMembers: false, selfInParticipants: true, expectedSelfCopied: false},
|
|
4622
|
+
].forEach(({forceReplaceMembers, selfInParticipants, expectedSelfCopied}) => {
|
|
4623
|
+
it(`should ${expectedSelfCopied ? '' : 'not '}copy self into participants when forceReplaceMembers=${forceReplaceMembers} and self ${selfInParticipants ? 'is' : 'is not'} in participants`, () => {
|
|
4624
|
+
const self = {identity: 'selfId', state: 'JOINED', devices: [], status: {}};
|
|
4625
|
+
const participant = {identity: selfInParticipants ? 'selfId' : 'other'};
|
|
4626
|
+
const locus = {
|
|
4627
|
+
participants: [participant],
|
|
4628
|
+
self,
|
|
4629
|
+
jsSdkMeta: {forceReplaceMembers, removedParticipantIds: []},
|
|
4630
|
+
};
|
|
3480
4631
|
|
|
3481
|
-
|
|
4632
|
+
locusInfo.onDeltaLocus(locus);
|
|
3482
4633
|
|
|
3483
|
-
|
|
3484
|
-
|
|
4634
|
+
const expectedParticipants = expectedSelfCopied ? [participant, self] : [participant];
|
|
4635
|
+
assert.deepEqual(locus.participants, expectedParticipants);
|
|
3485
4636
|
});
|
|
3486
|
-
assert.notCalled(meeting.locusInfo.handleLocusDelta);
|
|
3487
|
-
assert.calledOnceWithExactly(meeting.locusInfo.onFullLocus, fakeFullLocusDto);
|
|
3488
|
-
assert.calledOnce(locusInfo.locusParser.resume);
|
|
3489
4637
|
});
|
|
3490
4638
|
});
|
|
3491
4639
|
|
|
3492
|
-
describe('#
|
|
3493
|
-
it('
|
|
3494
|
-
|
|
3495
|
-
locusInfo.mainSessionLocusCache = null;
|
|
3496
|
-
locusInfo.updateLocusCache(locus);
|
|
4640
|
+
describe('#updateLocusInfo', () => {
|
|
4641
|
+
it('should return false when self.reason is MOVED and self.state is LEFT', () => {
|
|
4642
|
+
sinon.stub(locusInfo, 'updateControls');
|
|
3497
4643
|
|
|
3498
|
-
|
|
3499
|
-
});
|
|
4644
|
+
const result = locusInfo.updateLocusInfo({self: {reason: 'MOVED', state: 'LEFT'}});
|
|
3500
4645
|
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
locusInfo.updateLocusCache(locus);
|
|
4646
|
+
assert.isFalse(result);
|
|
4647
|
+
assert.notCalled(locusInfo.updateControls);
|
|
4648
|
+
});
|
|
3505
4649
|
|
|
3506
|
-
|
|
4650
|
+
it('should return true when self is not in MOVED/LEFT state', () => {
|
|
4651
|
+
sinon.stub(locusInfo, 'updateControls');
|
|
4652
|
+
sinon.stub(locusInfo, 'updateConversationUrl');
|
|
4653
|
+
sinon.stub(locusInfo, 'updateCreated');
|
|
4654
|
+
sinon.stub(locusInfo, 'updateFullState');
|
|
4655
|
+
sinon.stub(locusInfo, 'updateHostInfo');
|
|
4656
|
+
sinon.stub(locusInfo, 'updateLocusUrl');
|
|
4657
|
+
sinon.stub(locusInfo, 'updateMeetingInfo');
|
|
4658
|
+
sinon.stub(locusInfo, 'updateMediaShares');
|
|
4659
|
+
sinon.stub(locusInfo, 'updateReplaces');
|
|
4660
|
+
sinon.stub(locusInfo, 'updateSelf');
|
|
4661
|
+
sinon.stub(locusInfo, 'updateAclUrl');
|
|
4662
|
+
sinon.stub(locusInfo, 'updateBasequence');
|
|
4663
|
+
sinon.stub(locusInfo, 'updateSequence');
|
|
4664
|
+
sinon.stub(locusInfo, 'updateEmbeddedApps');
|
|
4665
|
+
sinon.stub(locusInfo, 'updateLinks');
|
|
4666
|
+
sinon.stub(locusInfo, 'compareAndUpdate');
|
|
4667
|
+
|
|
4668
|
+
const result = locusInfo.updateLocusInfo({self: {state: 'JOINED'}});
|
|
4669
|
+
|
|
4670
|
+
assert.isTrue(result);
|
|
4671
|
+
assert.calledOnce(locusInfo.updateControls);
|
|
3507
4672
|
});
|
|
3508
4673
|
});
|
|
3509
4674
|
|
|
@@ -3701,6 +4866,31 @@ describe('plugin-meetings', () => {
|
|
|
3701
4866
|
});
|
|
3702
4867
|
});
|
|
3703
4868
|
|
|
4869
|
+
describe('#cleanUp', () => {
|
|
4870
|
+
it('calls cleanUp on all hash tree parsers and clears maps', () => {
|
|
4871
|
+
const parser1 = {cleanUp: sinon.stub()};
|
|
4872
|
+
const parser2 = {cleanUp: sinon.stub()};
|
|
4873
|
+
|
|
4874
|
+
locusInfo.hashTreeParsers.set('url1', {parser: parser1, initializedFromHashTree: true});
|
|
4875
|
+
locusInfo.hashTreeParsers.set('url2', {parser: parser2, initializedFromHashTree: true});
|
|
4876
|
+
locusInfo.hashTreeObjectId2ParticipantId.set(1, 'participant1');
|
|
4877
|
+
|
|
4878
|
+
locusInfo.cleanUp();
|
|
4879
|
+
|
|
4880
|
+
assert.calledOnce(parser1.cleanUp);
|
|
4881
|
+
assert.calledOnce(parser2.cleanUp);
|
|
4882
|
+
assert.equal(locusInfo.hashTreeParsers.size, 0);
|
|
4883
|
+
assert.equal(locusInfo.hashTreeObjectId2ParticipantId.size, 0);
|
|
4884
|
+
});
|
|
4885
|
+
|
|
4886
|
+
it('works when there are no hash tree parsers', () => {
|
|
4887
|
+
locusInfo.cleanUp();
|
|
4888
|
+
|
|
4889
|
+
assert.equal(locusInfo.hashTreeParsers.size, 0);
|
|
4890
|
+
assert.equal(locusInfo.hashTreeObjectId2ParticipantId.size, 0);
|
|
4891
|
+
});
|
|
4892
|
+
});
|
|
4893
|
+
|
|
3704
4894
|
describe('#handleOneonOneEvent', () => {
|
|
3705
4895
|
beforeEach(() => {
|
|
3706
4896
|
locusInfo.emitScoped = sinon.stub();
|
|
@@ -3743,6 +4933,9 @@ describe('plugin-meetings', () => {
|
|
|
3743
4933
|
});
|
|
3744
4934
|
|
|
3745
4935
|
describe('#isMeetingActive', () => {
|
|
4936
|
+
beforeEach(() => {
|
|
4937
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
4938
|
+
});
|
|
3746
4939
|
forEach([_CALL_, _SIP_BRIDGE_, _SPACE_SHARE_], (type) => {
|
|
3747
4940
|
describe(`type = ${type}`, () => {
|
|
3748
4941
|
it('sends client event correctly for state = inactive', () => {
|
|
@@ -3763,6 +4956,11 @@ describe('plugin-meetings', () => {
|
|
|
3763
4956
|
options: {
|
|
3764
4957
|
meetingId: locusInfo.meetingId,
|
|
3765
4958
|
},
|
|
4959
|
+
payload: {
|
|
4960
|
+
eventData: {
|
|
4961
|
+
joinInProgress: false,
|
|
4962
|
+
},
|
|
4963
|
+
},
|
|
3766
4964
|
});
|
|
3767
4965
|
});
|
|
3768
4966
|
|
|
@@ -3783,6 +4981,11 @@ describe('plugin-meetings', () => {
|
|
|
3783
4981
|
options: {
|
|
3784
4982
|
meetingId: locusInfo.meetingId,
|
|
3785
4983
|
},
|
|
4984
|
+
payload: {
|
|
4985
|
+
eventData: {
|
|
4986
|
+
joinInProgress: false,
|
|
4987
|
+
},
|
|
4988
|
+
},
|
|
3786
4989
|
});
|
|
3787
4990
|
});
|
|
3788
4991
|
|
|
@@ -3804,12 +5007,17 @@ describe('plugin-meetings', () => {
|
|
|
3804
5007
|
options: {
|
|
3805
5008
|
meetingId: locusInfo.meetingId,
|
|
3806
5009
|
},
|
|
5010
|
+
payload: {
|
|
5011
|
+
eventData: {
|
|
5012
|
+
joinInProgress: false,
|
|
5013
|
+
},
|
|
5014
|
+
},
|
|
3807
5015
|
});
|
|
3808
5016
|
});
|
|
3809
5017
|
});
|
|
3810
5018
|
});
|
|
3811
5019
|
|
|
3812
|
-
it('sends client event correctly for state =
|
|
5020
|
+
it('sends client event correctly for state = MEETING_INACTIVE', () => {
|
|
3813
5021
|
locusInfo.getLocusPartner = sinon.stub().returns({state: MEETING_STATE.STATES.LEFT});
|
|
3814
5022
|
locusInfo.parsedLocus = {
|
|
3815
5023
|
fullState: {
|
|
@@ -3831,7 +5039,7 @@ describe('plugin-meetings', () => {
|
|
|
3831
5039
|
});
|
|
3832
5040
|
});
|
|
3833
5041
|
|
|
3834
|
-
it('
|
|
5042
|
+
it('does not send client event when state = INACTIVE and endMeetingReason = BREAKOUT_ENDED', () => {
|
|
3835
5043
|
locusInfo.getLocusPartner = sinon.stub().returns({state: MEETING_STATE.STATES.LEFT});
|
|
3836
5044
|
locusInfo.parsedLocus = {
|
|
3837
5045
|
fullState: {
|
|
@@ -3840,23 +5048,134 @@ describe('plugin-meetings', () => {
|
|
|
3840
5048
|
};
|
|
3841
5049
|
|
|
3842
5050
|
locusInfo.fullState = {
|
|
3843
|
-
|
|
5051
|
+
state: LOCUS.STATE.INACTIVE,
|
|
5052
|
+
endMeetingReason: 'BREAKOUT_ENDED',
|
|
3844
5053
|
};
|
|
3845
5054
|
|
|
3846
5055
|
locusInfo.isMeetingActive();
|
|
3847
5056
|
|
|
3848
|
-
assert.
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
5057
|
+
assert.notCalled(webex.internal.newMetrics.submitClientEvent);
|
|
5058
|
+
});
|
|
5059
|
+
|
|
5060
|
+
it('sends client event correctly for state self removed', () => {
|
|
5061
|
+
locusInfo.emitScoped = sinon.stub();
|
|
5062
|
+
locusInfo.parsedLocus = {
|
|
5063
|
+
fullState: {
|
|
5064
|
+
type: _MEETING_,
|
|
5065
|
+
},
|
|
5066
|
+
self: {
|
|
5067
|
+
removed: true,
|
|
5068
|
+
}
|
|
5069
|
+
};
|
|
5070
|
+
|
|
5071
|
+
locusInfo.isMeetingActive();
|
|
5072
|
+
|
|
5073
|
+
assert.notCalled(webex.internal.newMetrics.submitClientEvent);
|
|
5074
|
+
assert.calledOnceWithExactly(
|
|
5075
|
+
locusInfo.emitScoped,
|
|
5076
|
+
{
|
|
5077
|
+
file: 'locus-info',
|
|
5078
|
+
function: 'isMeetingActive',
|
|
3852
5079
|
},
|
|
5080
|
+
EVENTS.DESTROY_MEETING,
|
|
5081
|
+
{
|
|
5082
|
+
reason: MEETING_REMOVED_REASON.SELF_REMOVED,
|
|
5083
|
+
shouldLeave: false,
|
|
5084
|
+
}
|
|
5085
|
+
);
|
|
5086
|
+
});
|
|
5087
|
+
|
|
5088
|
+
describe('destroyMeetingSuspended', () => {
|
|
5089
|
+
it('suppresses DESTROY_MEETING for SELF_REMOVED when suspended', () => {
|
|
5090
|
+
locusInfo.emitScoped = sinon.stub();
|
|
5091
|
+
locusInfo.suspendDestroyMeeting(true);
|
|
5092
|
+
locusInfo.parsedLocus = {
|
|
5093
|
+
fullState: {
|
|
5094
|
+
type: _MEETING_,
|
|
5095
|
+
},
|
|
5096
|
+
self: {
|
|
5097
|
+
removed: true,
|
|
5098
|
+
}
|
|
5099
|
+
};
|
|
5100
|
+
|
|
5101
|
+
locusInfo.isMeetingActive();
|
|
5102
|
+
|
|
5103
|
+
assert.notCalled(locusInfo.emitScoped);
|
|
5104
|
+
assert.calledOnceWithExactly(
|
|
5105
|
+
sendBehavioralMetricStub,
|
|
5106
|
+
BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED,
|
|
5107
|
+
{
|
|
5108
|
+
meetingId: locusInfo.meetingId,
|
|
5109
|
+
reason: 'SELF_REMOVED',
|
|
5110
|
+
}
|
|
5111
|
+
);
|
|
5112
|
+
});
|
|
5113
|
+
|
|
5114
|
+
it('suppresses DESTROY_MEETING for MEETING_INACTIVE_TERMINATING when suspended', () => {
|
|
5115
|
+
locusInfo.emitScoped = sinon.stub();
|
|
5116
|
+
locusInfo.suspendDestroyMeeting(true);
|
|
5117
|
+
locusInfo.parsedLocus = {
|
|
5118
|
+
fullState: {
|
|
5119
|
+
type: _MEETING_,
|
|
5120
|
+
},
|
|
5121
|
+
};
|
|
5122
|
+
locusInfo.fullState = {
|
|
5123
|
+
state: LOCUS.STATE.INACTIVE,
|
|
5124
|
+
};
|
|
5125
|
+
|
|
5126
|
+
locusInfo.isMeetingActive();
|
|
5127
|
+
|
|
5128
|
+
assert.notCalled(locusInfo.emitScoped);
|
|
5129
|
+
assert.notCalled(webex.internal.newMetrics.submitClientEvent);
|
|
5130
|
+
assert.calledOnceWithExactly(
|
|
5131
|
+
sendBehavioralMetricStub,
|
|
5132
|
+
BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED,
|
|
5133
|
+
{
|
|
5134
|
+
meetingId: locusInfo.meetingId,
|
|
5135
|
+
reason: 'MEETING_INACTIVE_TERMINATING',
|
|
5136
|
+
}
|
|
5137
|
+
);
|
|
5138
|
+
});
|
|
5139
|
+
|
|
5140
|
+
[
|
|
5141
|
+
{reason: 'CALL_INACTIVE', setup: () => {
|
|
5142
|
+
locusInfo.parsedLocus = {fullState: {type: _CALL_}};
|
|
5143
|
+
locusInfo.fullState = {state: LOCUS.STATE.INACTIVE};
|
|
5144
|
+
}},
|
|
5145
|
+
{reason: 'PARTNER_LEFT', setup: () => {
|
|
5146
|
+
locusInfo.getLocusPartner = sinon.stub().returns({state: MEETING_STATE.STATES.LEFT});
|
|
5147
|
+
locusInfo.parsedLocus = {fullState: {type: _CALL_}, self: {state: MEETING_STATE.STATES.JOINED}};
|
|
5148
|
+
}},
|
|
5149
|
+
{reason: 'SELF_LEFT', setup: () => {
|
|
5150
|
+
locusInfo.getLocusPartner = sinon.stub().returns({state: MEETING_STATE.STATES.LEFT});
|
|
5151
|
+
locusInfo.parsedLocus = {fullState: {type: _CALL_}, self: {state: MEETING_STATE.STATES.LEFT}};
|
|
5152
|
+
}},
|
|
5153
|
+
].forEach(({reason, setup}) => {
|
|
5154
|
+
it(`sends joinInProgress=true in client event for ${reason} when suspended`, () => {
|
|
5155
|
+
locusInfo.suspendDestroyMeeting(true);
|
|
5156
|
+
setup();
|
|
5157
|
+
|
|
5158
|
+
locusInfo.isMeetingActive();
|
|
5159
|
+
|
|
5160
|
+
assert.calledWith(webex.internal.newMetrics.submitClientEvent, {
|
|
5161
|
+
name: 'client.call.remote-ended',
|
|
5162
|
+
options: {
|
|
5163
|
+
meetingId: locusInfo.meetingId,
|
|
5164
|
+
},
|
|
5165
|
+
payload: {
|
|
5166
|
+
eventData: {
|
|
5167
|
+
joinInProgress: true,
|
|
5168
|
+
},
|
|
5169
|
+
},
|
|
5170
|
+
});
|
|
5171
|
+
});
|
|
3853
5172
|
});
|
|
3854
5173
|
});
|
|
3855
5174
|
});
|
|
3856
5175
|
|
|
3857
5176
|
describe('#updateLocusUrl', () => {
|
|
3858
5177
|
it('trigger LOCUS_INFO_UPDATE_URL event with isMainLocus is true as default', () => {
|
|
3859
|
-
const fakeUrl =
|
|
5178
|
+
const fakeUrl = 'https://fake.com/locus';
|
|
3860
5179
|
locusInfo.emitScoped = sinon.stub();
|
|
3861
5180
|
locusInfo.updateLocusUrl(fakeUrl);
|
|
3862
5181
|
|
|
@@ -3869,12 +5188,12 @@ describe('plugin-meetings', () => {
|
|
|
3869
5188
|
EVENTS.LOCUS_INFO_UPDATE_URL,
|
|
3870
5189
|
{
|
|
3871
5190
|
url: fakeUrl,
|
|
3872
|
-
isMainLocus: true
|
|
3873
|
-
}
|
|
5191
|
+
isMainLocus: true,
|
|
5192
|
+
}
|
|
3874
5193
|
);
|
|
3875
5194
|
});
|
|
3876
5195
|
it('trigger LOCUS_INFO_UPDATE_URL event with isMainLocus is false', () => {
|
|
3877
|
-
const fakeUrl =
|
|
5196
|
+
const fakeUrl = 'https://fake.com/locus';
|
|
3878
5197
|
locusInfo.emitScoped = sinon.stub();
|
|
3879
5198
|
locusInfo.updateLocusUrl(fakeUrl, false);
|
|
3880
5199
|
|
|
@@ -3887,8 +5206,8 @@ describe('plugin-meetings', () => {
|
|
|
3887
5206
|
EVENTS.LOCUS_INFO_UPDATE_URL,
|
|
3888
5207
|
{
|
|
3889
5208
|
url: fakeUrl,
|
|
3890
|
-
isMainLocus: false
|
|
3891
|
-
}
|
|
5209
|
+
isMainLocus: false,
|
|
5210
|
+
}
|
|
3892
5211
|
);
|
|
3893
5212
|
});
|
|
3894
5213
|
});
|
|
@@ -3940,8 +5259,8 @@ describe('plugin-meetings', () => {
|
|
|
3940
5259
|
|
|
3941
5260
|
sinon.stub(locusInfo, 'updateParticipants');
|
|
3942
5261
|
sinon.stub(locusInfo, 'isMeetingActive');
|
|
3943
|
-
|
|
3944
|
-
|
|
5262
|
+
sinon.stub(locusInfo, 'handleOneOnOneEvent');
|
|
5263
|
+
updateLocusInfoStub = sinon.stub(locusInfo, 'updateLocusInfo');
|
|
3945
5264
|
syncRequestStub = sinon.stub().resolves({body: {}});
|
|
3946
5265
|
|
|
3947
5266
|
mockMeeting.locusInfo = locusInfo;
|
|
@@ -3950,7 +5269,7 @@ describe('plugin-meetings', () => {
|
|
|
3950
5269
|
getLocusDTO: syncRequestStub,
|
|
3951
5270
|
};
|
|
3952
5271
|
|
|
3953
|
-
locusInfo.onFullLocus({
|
|
5272
|
+
locusInfo.onFullLocus('test', {
|
|
3954
5273
|
sequence: {
|
|
3955
5274
|
rangeStart: 0,
|
|
3956
5275
|
rangeEnd: 0,
|
|
@@ -4188,7 +5507,9 @@ describe('plugin-meetings', () => {
|
|
|
4188
5507
|
|
|
4189
5508
|
describe('#parse', () => {
|
|
4190
5509
|
it('handles hash tree messages correctly', () => {
|
|
5510
|
+
const fakeLocusUrl = 'http://locus-url.com';
|
|
4191
5511
|
const fakeHashTreeMessage = {
|
|
5512
|
+
locusUrl: fakeLocusUrl,
|
|
4192
5513
|
locusStateElements: [
|
|
4193
5514
|
{
|
|
4194
5515
|
htMeta: {elementId: {type: 'self'}},
|
|
@@ -4207,12 +5528,403 @@ describe('plugin-meetings', () => {
|
|
|
4207
5528
|
const mockHashTreeParser = {
|
|
4208
5529
|
handleMessage: sinon.stub(),
|
|
4209
5530
|
};
|
|
4210
|
-
locusInfo.
|
|
5531
|
+
locusInfo.hashTreeParsers.set(fakeLocusUrl, {
|
|
5532
|
+
parser: mockHashTreeParser,
|
|
5533
|
+
initializedFromHashTree: true,
|
|
5534
|
+
});
|
|
4211
5535
|
|
|
4212
5536
|
locusInfo.parse(mockMeeting, data);
|
|
4213
5537
|
|
|
4214
5538
|
assert.calledOnceWithExactly(mockHashTreeParser.handleMessage, fakeHashTreeMessage);
|
|
4215
5539
|
});
|
|
5540
|
+
|
|
5541
|
+
it('ignores hash tree event when hashTreeParser is not created yet', () => {
|
|
5542
|
+
const data = {
|
|
5543
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
5544
|
+
stateElementsMessage: {
|
|
5545
|
+
locusStateElements: [],
|
|
5546
|
+
dataSets: [],
|
|
5547
|
+
},
|
|
5548
|
+
};
|
|
5549
|
+
|
|
5550
|
+
const loggerSpy = sinon.spy(LoggerProxy.logger, 'info');
|
|
5551
|
+
const getTheLocusToUpdateStub = sinon.stub(locusInfo, 'getTheLocusToUpdate');
|
|
5552
|
+
|
|
5553
|
+
// Ensure we're not using hash trees
|
|
5554
|
+
assert.equal(locusInfo.hashTreeParsers.size, 0);
|
|
5555
|
+
|
|
5556
|
+
locusInfo.parse(mockMeeting, data);
|
|
5557
|
+
|
|
5558
|
+
assert.calledWith(
|
|
5559
|
+
loggerSpy,
|
|
5560
|
+
'Locus-info:index#parse --> received locus hash tree event before hashTreeParser is created'
|
|
5561
|
+
);
|
|
5562
|
+
assert.notCalled(getTheLocusToUpdateStub);
|
|
5563
|
+
});
|
|
5564
|
+
|
|
5565
|
+
it('should call handleLocusAPIResponse for SDK_LOCUS_FROM_SYNC_MEETINGS when hash tree parsers exist', () => {
|
|
5566
|
+
const fakeLocusUrl = 'http://locus-url.com';
|
|
5567
|
+
const fakeLocus = {url: fakeLocusUrl, fullState: {state: 'ACTIVE'}};
|
|
5568
|
+
const mockHashTreeParser = {
|
|
5569
|
+
handleMessage: sinon.stub(),
|
|
5570
|
+
handleLocusUpdate: sinon.stub(),
|
|
5571
|
+
};
|
|
5572
|
+
locusInfo.hashTreeParsers.set(fakeLocusUrl, {
|
|
5573
|
+
parser: mockHashTreeParser,
|
|
5574
|
+
initializedFromHashTree: true,
|
|
5575
|
+
});
|
|
5576
|
+
|
|
5577
|
+
sinon.stub(locusInfo, 'handleLocusDelta');
|
|
5578
|
+
|
|
5579
|
+
locusInfo.parse(mockMeeting, {
|
|
5580
|
+
eventType: LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS,
|
|
5581
|
+
locus: fakeLocus,
|
|
5582
|
+
});
|
|
5583
|
+
|
|
5584
|
+
// should route through handleLocusAPIResponse which passes unwrapped LocusDTO to parser
|
|
5585
|
+
assert.calledOnce(mockHashTreeParser.handleLocusUpdate);
|
|
5586
|
+
assert.notCalled(mockHashTreeParser.handleMessage);
|
|
5587
|
+
assert.notCalled(locusInfo.handleLocusDelta);
|
|
5588
|
+
});
|
|
5589
|
+
});
|
|
5590
|
+
});
|
|
5591
|
+
|
|
5592
|
+
describe('#createLocusFromHashTreeMessage', () => {
|
|
5593
|
+
const LOCUS_URL = 'https://locus.example.com/loci/abc-123';
|
|
5594
|
+
|
|
5595
|
+
const createElement = (type, data) => ({
|
|
5596
|
+
htMeta: {elementId: {type, id: 1, version: 1}},
|
|
5597
|
+
data,
|
|
5598
|
+
});
|
|
5599
|
+
|
|
5600
|
+
it('returns locus with url and empty participants when no locusStateElements', () => {
|
|
5601
|
+
const result = createLocusFromHashTreeMessage({locusUrl: LOCUS_URL});
|
|
5602
|
+
|
|
5603
|
+
assert.deepEqual(result.locus, {participants: [], url: LOCUS_URL});
|
|
5604
|
+
assert.isUndefined(result.metadata);
|
|
5605
|
+
});
|
|
5606
|
+
|
|
5607
|
+
it('skips elements without data', () => {
|
|
5608
|
+
const result = createLocusFromHashTreeMessage({
|
|
5609
|
+
locusUrl: LOCUS_URL,
|
|
5610
|
+
locusStateElements: [{htMeta: {elementId: {type: 'Self', id: 1, version: 1}}, data: null}],
|
|
5611
|
+
});
|
|
5612
|
+
|
|
5613
|
+
assert.deepEqual(result.locus, {participants: [], url: LOCUS_URL});
|
|
5614
|
+
});
|
|
5615
|
+
|
|
5616
|
+
[
|
|
5617
|
+
{type: 'Self', locusKey: 'self', data: {id: 'self-1', state: 'JOINED'}},
|
|
5618
|
+
{type: 'Info', locusKey: 'info', data: {webExMeetingId: '123'}},
|
|
5619
|
+
{type: 'FullState', locusKey: 'fullState', data: {state: 'ACTIVE'}},
|
|
5620
|
+
{type: 'Links', locusKey: 'links', data: {resources: {}}},
|
|
5621
|
+
].forEach(({type, locusKey, data}) => {
|
|
5622
|
+
it(`maps ${type} element to locus.${locusKey}`, () => {
|
|
5623
|
+
const result = createLocusFromHashTreeMessage({
|
|
5624
|
+
locusUrl: LOCUS_URL,
|
|
5625
|
+
locusStateElements: [createElement(type, data)],
|
|
5626
|
+
});
|
|
5627
|
+
|
|
5628
|
+
assert.deepEqual(result.locus[locusKey], data);
|
|
5629
|
+
});
|
|
5630
|
+
});
|
|
5631
|
+
|
|
5632
|
+
it('pushes Participant elements to locus.participants', () => {
|
|
5633
|
+
const p1 = {id: 'p1', state: 'JOINED'};
|
|
5634
|
+
const p2 = {id: 'p2', state: 'LEFT'};
|
|
5635
|
+
|
|
5636
|
+
const result = createLocusFromHashTreeMessage({
|
|
5637
|
+
locusUrl: LOCUS_URL,
|
|
5638
|
+
locusStateElements: [createElement('Participant', p1), createElement('Participant', p2)],
|
|
5639
|
+
});
|
|
5640
|
+
|
|
5641
|
+
assert.deepEqual(result.locus.participants, [p1, p2]);
|
|
5642
|
+
});
|
|
5643
|
+
|
|
5644
|
+
it('pushes MediaShare elements to locus.mediaShares array', () => {
|
|
5645
|
+
const share1 = {name: 'whiteboard'};
|
|
5646
|
+
const share2 = {name: 'content'};
|
|
5647
|
+
|
|
5648
|
+
const result = createLocusFromHashTreeMessage({
|
|
5649
|
+
locusUrl: LOCUS_URL,
|
|
5650
|
+
locusStateElements: [
|
|
5651
|
+
createElement('MediaShare', share1),
|
|
5652
|
+
createElement('MediaShare', share2),
|
|
5653
|
+
],
|
|
5654
|
+
});
|
|
5655
|
+
|
|
5656
|
+
assert.deepEqual(result.locus.mediaShares, [share1, share2]);
|
|
5657
|
+
});
|
|
5658
|
+
|
|
5659
|
+
it('pushes EmbeddedApp elements to locus.embeddedApps array', () => {
|
|
5660
|
+
const app = {appId: 'app-1', state: 'STARTED'};
|
|
5661
|
+
|
|
5662
|
+
const result = createLocusFromHashTreeMessage({
|
|
5663
|
+
locusUrl: LOCUS_URL,
|
|
5664
|
+
locusStateElements: [createElement('EmbeddedApp', app)],
|
|
5665
|
+
});
|
|
5666
|
+
|
|
5667
|
+
assert.deepEqual(result.locus.embeddedApps, [app]);
|
|
5668
|
+
});
|
|
5669
|
+
|
|
5670
|
+
it('merges ControlEntry elements into locus.controls', () => {
|
|
5671
|
+
const control1 = {record: {recording: true}};
|
|
5672
|
+
const control2 = {lock: {locked: false}};
|
|
5673
|
+
|
|
5674
|
+
const result = createLocusFromHashTreeMessage({
|
|
5675
|
+
locusUrl: LOCUS_URL,
|
|
5676
|
+
locusStateElements: [
|
|
5677
|
+
createElement('ControlEntry', control1),
|
|
5678
|
+
createElement('ControlEntry', control2),
|
|
5679
|
+
],
|
|
5680
|
+
});
|
|
5681
|
+
|
|
5682
|
+
assert.deepEqual(result.locus.controls, {record: {recording: true}, lock: {locked: false}});
|
|
5683
|
+
});
|
|
5684
|
+
|
|
5685
|
+
it('spreads Locus element data onto top level but removes managed keys', () => {
|
|
5686
|
+
const locusData = {
|
|
5687
|
+
url: 'should-be-overridden',
|
|
5688
|
+
someTopLevelField: 'value',
|
|
5689
|
+
// these are managed by other ObjectTypes and should be removed
|
|
5690
|
+
links: {should: 'be removed'},
|
|
5691
|
+
info: {should: 'be removed'},
|
|
5692
|
+
fullState: {should: 'be removed'},
|
|
5693
|
+
self: {should: 'be removed'},
|
|
5694
|
+
participants: [{should: 'be removed'}],
|
|
5695
|
+
mediaShares: [{should: 'be removed'}],
|
|
5696
|
+
controls: {should: 'be removed'},
|
|
5697
|
+
embeddedApps: [{should: 'be removed'}],
|
|
5698
|
+
};
|
|
5699
|
+
|
|
5700
|
+
const result = createLocusFromHashTreeMessage({
|
|
5701
|
+
locusUrl: LOCUS_URL,
|
|
5702
|
+
locusStateElements: [createElement('Locus', locusData)],
|
|
5703
|
+
});
|
|
5704
|
+
|
|
5705
|
+
assert.equal(result.locus.someTopLevelField, 'value');
|
|
5706
|
+
assert.deepEqual(result.locus.participants, []);
|
|
5707
|
+
assert.isUndefined(result.locus.links);
|
|
5708
|
+
assert.isUndefined(result.locus.info);
|
|
5709
|
+
assert.isUndefined(result.locus.fullState);
|
|
5710
|
+
assert.isUndefined(result.locus.self);
|
|
5711
|
+
assert.isUndefined(result.locus.mediaShares);
|
|
5712
|
+
assert.isUndefined(result.locus.controls);
|
|
5713
|
+
assert.isUndefined(result.locus.embeddedApps);
|
|
5714
|
+
});
|
|
5715
|
+
|
|
5716
|
+
it('extracts Metadata element as metadata in the result', () => {
|
|
5717
|
+
const metadataData = {visibleDataSets: [{name: 'ds1', url: 'http://ds1.url'}]};
|
|
5718
|
+
const htMeta = {elementId: {type: 'Metadata', id: 99, version: 3}};
|
|
5719
|
+
|
|
5720
|
+
const result = createLocusFromHashTreeMessage({
|
|
5721
|
+
locusUrl: LOCUS_URL,
|
|
5722
|
+
locusStateElements: [{htMeta, data: metadataData}],
|
|
5723
|
+
});
|
|
5724
|
+
|
|
5725
|
+
assert.deepEqual(result.metadata, {...metadataData, htMeta});
|
|
5726
|
+
assert.isUndefined(result.locus.metadata);
|
|
5727
|
+
});
|
|
5728
|
+
|
|
5729
|
+
it('handles a message with multiple element types', () => {
|
|
5730
|
+
const selfData = {id: 'self-1'};
|
|
5731
|
+
const participantData = {id: 'p1'};
|
|
5732
|
+
const infoData = {webExMeetingId: '456'};
|
|
5733
|
+
|
|
5734
|
+
const result = createLocusFromHashTreeMessage({
|
|
5735
|
+
locusUrl: LOCUS_URL,
|
|
5736
|
+
locusStateElements: [
|
|
5737
|
+
createElement('Self', selfData),
|
|
5738
|
+
createElement('Participant', participantData),
|
|
5739
|
+
createElement('Info', infoData),
|
|
5740
|
+
],
|
|
5741
|
+
});
|
|
5742
|
+
|
|
5743
|
+
assert.deepEqual(result.locus.self, selfData);
|
|
5744
|
+
assert.deepEqual(result.locus.participants, [participantData]);
|
|
5745
|
+
assert.deepEqual(result.locus.info, infoData);
|
|
5746
|
+
assert.equal(result.locus.url, LOCUS_URL);
|
|
5747
|
+
});
|
|
5748
|
+
|
|
5749
|
+
it('ignores unknown element types', () => {
|
|
5750
|
+
const result = createLocusFromHashTreeMessage({
|
|
5751
|
+
locusUrl: LOCUS_URL,
|
|
5752
|
+
locusStateElements: [createElement('UnknownType', {foo: 'bar'})],
|
|
5753
|
+
});
|
|
5754
|
+
|
|
5755
|
+
assert.deepEqual(result.locus, {participants: [], url: LOCUS_URL});
|
|
5756
|
+
});
|
|
5757
|
+
});
|
|
5758
|
+
|
|
5759
|
+
describe('findMeetingForHashTreeMessage', () => {
|
|
5760
|
+
const deviceUrl = 'https://devices.example.com/device1';
|
|
5761
|
+
|
|
5762
|
+
function createMockMeetingCollection(meetings) {
|
|
5763
|
+
return {
|
|
5764
|
+
getAll: () => meetings,
|
|
5765
|
+
};
|
|
5766
|
+
}
|
|
5767
|
+
|
|
5768
|
+
function createMockMeeting(id, hashTreeParsersMap) {
|
|
5769
|
+
return {
|
|
5770
|
+
id,
|
|
5771
|
+
locusInfo: {
|
|
5772
|
+
hashTreeParsers: hashTreeParsersMap,
|
|
5773
|
+
},
|
|
5774
|
+
};
|
|
5775
|
+
}
|
|
5776
|
+
|
|
5777
|
+
function createSelfElement(devices) {
|
|
5778
|
+
return {
|
|
5779
|
+
htMeta: {elementId: {type: 'Self'}},
|
|
5780
|
+
data: {
|
|
5781
|
+
deviceUrl,
|
|
5782
|
+
devices,
|
|
5783
|
+
},
|
|
5784
|
+
};
|
|
5785
|
+
}
|
|
5786
|
+
|
|
5787
|
+
it('returns the meeting when locusUrl matches a hashTreeParser directly', () => {
|
|
5788
|
+
const locusUrl = 'https://locus.example.com/loci/abc123';
|
|
5789
|
+
const parsersMap = new Map([[locusUrl, {state: 'active'}]]);
|
|
5790
|
+
const meeting = createMockMeeting('meeting1', parsersMap);
|
|
5791
|
+
const collection = createMockMeetingCollection({meeting1: meeting});
|
|
5792
|
+
|
|
5793
|
+
const message = {locusUrl, locusStateElements: []};
|
|
5794
|
+
|
|
5795
|
+
const result = findMeetingForHashTreeMessage(message, collection, deviceUrl);
|
|
5796
|
+
|
|
5797
|
+
assert.equal(result, meeting);
|
|
5798
|
+
});
|
|
5799
|
+
|
|
5800
|
+
it('returns undefined when no meeting matches and message has no locusStateElements', () => {
|
|
5801
|
+
const locusUrl = 'https://locus.example.com/loci/unknown';
|
|
5802
|
+
const parsersMap = new Map([['https://locus.example.com/loci/other', {state: 'active'}]]);
|
|
5803
|
+
const meeting = createMockMeeting('meeting1', parsersMap);
|
|
5804
|
+
const collection = createMockMeetingCollection({meeting1: meeting});
|
|
5805
|
+
|
|
5806
|
+
const message = {locusUrl};
|
|
5807
|
+
|
|
5808
|
+
const result = findMeetingForHashTreeMessage(message, collection, deviceUrl);
|
|
5809
|
+
|
|
5810
|
+
assert.isUndefined(result);
|
|
5811
|
+
});
|
|
5812
|
+
|
|
5813
|
+
it('returns undefined when no meeting matches and self element has no replaces', () => {
|
|
5814
|
+
const locusUrl = 'https://locus.example.com/loci/unknown';
|
|
5815
|
+
const parsersMap = new Map([['https://locus.example.com/loci/other', {state: 'active'}]]);
|
|
5816
|
+
const meeting = createMockMeeting('meeting1', parsersMap);
|
|
5817
|
+
const collection = createMockMeetingCollection({meeting1: meeting});
|
|
5818
|
+
|
|
5819
|
+
const selfElement = createSelfElement([{url: deviceUrl}]);
|
|
5820
|
+
const message = {locusUrl, locusStateElements: [selfElement]};
|
|
5821
|
+
|
|
5822
|
+
const result = findMeetingForHashTreeMessage(message, collection, deviceUrl);
|
|
5823
|
+
|
|
5824
|
+
assert.isUndefined(result);
|
|
5825
|
+
});
|
|
5826
|
+
|
|
5827
|
+
it('returns the meeting when locusUrl from replaces matches a hashTreeParser', () => {
|
|
5828
|
+
const oldLocusUrl = 'https://locus.example.com/loci/old';
|
|
5829
|
+
const newLocusUrl = 'https://locus.example.com/loci/new';
|
|
5830
|
+
const parsersMap = new Map([[oldLocusUrl, {state: 'active'}]]);
|
|
5831
|
+
const meeting = createMockMeeting('meeting1', parsersMap);
|
|
5832
|
+
const collection = createMockMeetingCollection({meeting1: meeting});
|
|
5833
|
+
|
|
5834
|
+
const selfElement = createSelfElement([
|
|
5835
|
+
{url: deviceUrl, replaces: [{locusUrl: oldLocusUrl}]},
|
|
5836
|
+
]);
|
|
5837
|
+
const message = {locusUrl: newLocusUrl, locusStateElements: [selfElement]};
|
|
5838
|
+
|
|
5839
|
+
const result = findMeetingForHashTreeMessage(message, collection, deviceUrl);
|
|
5840
|
+
|
|
5841
|
+
assert.equal(result, meeting);
|
|
5842
|
+
});
|
|
5843
|
+
|
|
5844
|
+
it('returns undefined when replaces locusUrl does not match any hashTreeParser', () => {
|
|
5845
|
+
const oldLocusUrl = 'https://locus.example.com/loci/old';
|
|
5846
|
+
const newLocusUrl = 'https://locus.example.com/loci/new';
|
|
5847
|
+
const parsersMap = new Map([
|
|
5848
|
+
['https://locus.example.com/loci/something-else', {state: 'active'}],
|
|
5849
|
+
]);
|
|
5850
|
+
const meeting = createMockMeeting('meeting1', parsersMap);
|
|
5851
|
+
const collection = createMockMeetingCollection({meeting1: meeting});
|
|
5852
|
+
|
|
5853
|
+
const selfElement = createSelfElement([
|
|
5854
|
+
{url: deviceUrl, replaces: [{locusUrl: oldLocusUrl}]},
|
|
5855
|
+
]);
|
|
5856
|
+
const message = {locusUrl: newLocusUrl, locusStateElements: [selfElement]};
|
|
5857
|
+
|
|
5858
|
+
const result = findMeetingForHashTreeMessage(message, collection, deviceUrl);
|
|
5859
|
+
|
|
5860
|
+
assert.isUndefined(result);
|
|
5861
|
+
});
|
|
5862
|
+
|
|
5863
|
+
it('returns undefined when meetingCollection is empty', () => {
|
|
5864
|
+
const collection = createMockMeetingCollection({});
|
|
5865
|
+
const message = {locusUrl: 'https://locus.example.com/loci/abc', locusStateElements: []};
|
|
5866
|
+
|
|
5867
|
+
const result = findMeetingForHashTreeMessage(message, collection, deviceUrl);
|
|
5868
|
+
|
|
5869
|
+
assert.isUndefined(result);
|
|
5870
|
+
});
|
|
5871
|
+
|
|
5872
|
+
it('checks multiple meetings and returns the correct one', () => {
|
|
5873
|
+
const targetLocusUrl = 'https://locus.example.com/loci/target';
|
|
5874
|
+
const meeting1 = createMockMeeting(
|
|
5875
|
+
'meeting1',
|
|
5876
|
+
new Map([['https://locus.example.com/loci/other', {state: 'active'}]])
|
|
5877
|
+
);
|
|
5878
|
+
const meeting2 = createMockMeeting(
|
|
5879
|
+
'meeting2',
|
|
5880
|
+
new Map([[targetLocusUrl, {state: 'active'}]])
|
|
5881
|
+
);
|
|
5882
|
+
const collection = createMockMeetingCollection({meeting1, meeting2});
|
|
5883
|
+
|
|
5884
|
+
const message = {locusUrl: targetLocusUrl, locusStateElements: []};
|
|
5885
|
+
|
|
5886
|
+
const result = findMeetingForHashTreeMessage(message, collection, deviceUrl);
|
|
5887
|
+
|
|
5888
|
+
assert.equal(result, meeting2);
|
|
5889
|
+
});
|
|
5890
|
+
|
|
5891
|
+
it('ignores devices that do not match deviceUrl when looking for replaces', () => {
|
|
5892
|
+
const oldLocusUrl = 'https://locus.example.com/loci/old';
|
|
5893
|
+
const newLocusUrl = 'https://locus.example.com/loci/new';
|
|
5894
|
+
const parsersMap = new Map([[oldLocusUrl, {state: 'active'}]]);
|
|
5895
|
+
const meeting = createMockMeeting('meeting1', parsersMap);
|
|
5896
|
+
const collection = createMockMeetingCollection({meeting1: meeting});
|
|
5897
|
+
|
|
5898
|
+
// self element has replaces, but on a different device
|
|
5899
|
+
const selfElement = createSelfElement([
|
|
5900
|
+
{url: 'https://devices.example.com/other-device', replaces: [{locusUrl: oldLocusUrl}]},
|
|
5901
|
+
]);
|
|
5902
|
+
const message = {locusUrl: newLocusUrl, locusStateElements: [selfElement]};
|
|
5903
|
+
|
|
5904
|
+
const result = findMeetingForHashTreeMessage(message, collection, deviceUrl);
|
|
5905
|
+
|
|
5906
|
+
assert.isUndefined(result);
|
|
5907
|
+
});
|
|
5908
|
+
|
|
5909
|
+
it('does not use self element if it is not of type Self', () => {
|
|
5910
|
+
const oldLocusUrl = 'https://locus.example.com/loci/old';
|
|
5911
|
+
const newLocusUrl = 'https://locus.example.com/loci/new';
|
|
5912
|
+
const parsersMap = new Map([[oldLocusUrl, {state: 'active'}]]);
|
|
5913
|
+
const meeting = createMockMeeting('meeting1', parsersMap);
|
|
5914
|
+
const collection = createMockMeetingCollection({meeting1: meeting});
|
|
5915
|
+
|
|
5916
|
+
// element has replaces data but is not of type Self
|
|
5917
|
+
const nonSelfElement = {
|
|
5918
|
+
htMeta: {elementId: {type: 'Participant'}},
|
|
5919
|
+
data: {
|
|
5920
|
+
devices: [{url: deviceUrl, replaces: [{locusUrl: oldLocusUrl}]}],
|
|
5921
|
+
},
|
|
5922
|
+
};
|
|
5923
|
+
const message = {locusUrl: newLocusUrl, locusStateElements: [nonSelfElement]};
|
|
5924
|
+
|
|
5925
|
+
const result = findMeetingForHashTreeMessage(message, collection, deviceUrl);
|
|
5926
|
+
|
|
5927
|
+
assert.isUndefined(result);
|
|
4216
5928
|
});
|
|
4217
5929
|
});
|
|
4218
5930
|
});
|