@webex/plugin-meetings 3.10.0-next.8 → 3.10.0-webex-services-ready.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/dist/annotation/annotation.types.js.map +1 -1
- package/dist/annotation/constants.js.map +1 -1
- package/dist/annotation/index.js +19 -22
- package/dist/annotation/index.js.map +1 -1
- package/dist/breakouts/breakout.js +6 -6
- package/dist/breakouts/breakout.js.map +1 -1
- package/dist/breakouts/collection.js.map +1 -1
- package/dist/breakouts/edit-lock-error.js +9 -11
- package/dist/breakouts/edit-lock-error.js.map +1 -1
- package/dist/breakouts/events.js.map +1 -1
- package/dist/breakouts/index.js +126 -127
- package/dist/breakouts/index.js.map +1 -1
- package/dist/breakouts/request.js +6 -8
- package/dist/breakouts/request.js.map +1 -1
- package/dist/breakouts/utils.js.map +1 -1
- package/dist/common/browser-detection.js.map +1 -1
- package/dist/common/collection.js +1 -2
- package/dist/common/collection.js.map +1 -1
- package/dist/common/config.js.map +1 -1
- package/dist/common/errors/captcha-error.js +9 -11
- package/dist/common/errors/captcha-error.js.map +1 -1
- package/dist/common/errors/intent-to-join.js +10 -12
- package/dist/common/errors/intent-to-join.js.map +1 -1
- package/dist/common/errors/join-forbidden-error.js +10 -12
- package/dist/common/errors/join-forbidden-error.js.map +1 -1
- package/dist/common/errors/join-meeting.js +10 -12
- package/dist/common/errors/join-meeting.js.map +1 -1
- package/dist/common/errors/join-webinar-error.js +9 -11
- package/dist/common/errors/join-webinar-error.js.map +1 -1
- package/dist/common/errors/media.js +9 -11
- package/dist/common/errors/media.js.map +1 -1
- package/dist/common/errors/multistream-not-supported-error.js +9 -11
- package/dist/common/errors/multistream-not-supported-error.js.map +1 -1
- package/dist/common/errors/no-meeting-info.js +9 -11
- package/dist/common/errors/no-meeting-info.js.map +1 -1
- package/dist/common/errors/parameter.js +11 -14
- package/dist/common/errors/parameter.js.map +1 -1
- package/dist/common/errors/password-error.js +9 -11
- package/dist/common/errors/password-error.js.map +1 -1
- package/dist/common/errors/permission.js +9 -11
- package/dist/common/errors/permission.js.map +1 -1
- package/dist/common/errors/reclaim-host-role-errors.js +32 -38
- package/dist/common/errors/reclaim-host-role-errors.js.map +1 -1
- package/dist/common/errors/reconnection-not-started.js +5 -6
- package/dist/common/errors/reconnection-not-started.js.map +1 -1
- package/dist/common/errors/reconnection.js +9 -11
- package/dist/common/errors/reconnection.js.map +1 -1
- package/dist/common/errors/stats.js +9 -11
- package/dist/common/errors/stats.js.map +1 -1
- package/dist/common/errors/webex-errors.js +20 -29
- package/dist/common/errors/webex-errors.js.map +1 -1
- package/dist/common/errors/webex-meetings-error.js +9 -12
- package/dist/common/errors/webex-meetings-error.js.map +1 -1
- package/dist/common/events/events-scope.js +9 -10
- package/dist/common/events/events-scope.js.map +1 -1
- package/dist/common/events/events.js +9 -10
- package/dist/common/events/events.js.map +1 -1
- package/dist/common/events/trigger-proxy.js.map +1 -1
- package/dist/common/events/util.js.map +1 -1
- package/dist/common/logs/logger-config.js.map +1 -1
- package/dist/common/logs/logger-proxy.js.map +1 -1
- package/dist/common/logs/request.js +17 -17
- package/dist/common/logs/request.js.map +1 -1
- package/dist/common/queue.js +1 -2
- package/dist/common/queue.js.map +1 -1
- package/dist/config.js +0 -1
- package/dist/config.js.map +1 -1
- package/dist/constants.js +11 -8
- package/dist/constants.js.map +1 -1
- package/dist/controls-options-manager/constants.js.map +1 -1
- package/dist/controls-options-manager/enums.js.map +1 -1
- package/dist/controls-options-manager/index.js +1 -2
- package/dist/controls-options-manager/index.js.map +1 -1
- package/dist/controls-options-manager/types.js.map +1 -1
- package/dist/controls-options-manager/util.js +1 -2
- package/dist/controls-options-manager/util.js.map +1 -1
- package/dist/hashTree/constants.js +20 -0
- package/dist/hashTree/constants.js.map +1 -0
- package/dist/hashTree/hashTree.js +515 -0
- package/dist/hashTree/hashTree.js.map +1 -0
- package/dist/hashTree/hashTreeParser.js +1266 -0
- package/dist/hashTree/hashTreeParser.js.map +1 -0
- package/dist/hashTree/types.js +21 -0
- package/dist/hashTree/types.js.map +1 -0
- package/dist/hashTree/utils.js +48 -0
- package/dist/hashTree/utils.js.map +1 -0
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/interceptors/index.js.map +1 -1
- package/dist/interceptors/locusRetry.js +6 -8
- package/dist/interceptors/locusRetry.js.map +1 -1
- package/dist/interceptors/locusRouteToken.js +6 -8
- package/dist/interceptors/locusRouteToken.js.map +1 -1
- package/dist/interpretation/collection.js.map +1 -1
- package/dist/interpretation/index.js +1 -2
- package/dist/interpretation/index.js.map +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/interpretation/siLanguage.js.map +1 -1
- package/dist/locus-info/controlsUtils.js.map +1 -1
- package/dist/locus-info/embeddedAppsUtils.js.map +1 -1
- package/dist/locus-info/fullState.js.map +1 -1
- package/dist/locus-info/hostUtils.js.map +1 -1
- package/dist/locus-info/index.js +551 -94
- package/dist/locus-info/index.js.map +1 -1
- package/dist/locus-info/infoUtils.js.map +1 -1
- package/dist/locus-info/mediaSharesUtils.js.map +1 -1
- package/dist/locus-info/parser.js +3 -4
- package/dist/locus-info/parser.js.map +1 -1
- package/dist/locus-info/selfUtils.js.map +1 -1
- package/dist/locus-info/types.js +7 -0
- package/dist/locus-info/types.js.map +1 -0
- package/dist/media/MediaConnectionAwaiter.js +1 -2
- package/dist/media/MediaConnectionAwaiter.js.map +1 -1
- package/dist/media/index.js +0 -2
- package/dist/media/index.js.map +1 -1
- package/dist/media/properties.js +15 -17
- package/dist/media/properties.js.map +1 -1
- package/dist/media/util.js.map +1 -1
- package/dist/meeting/brbState.js +8 -9
- package/dist/meeting/brbState.js.map +1 -1
- package/dist/meeting/connectionStateHandler.js +10 -13
- package/dist/meeting/connectionStateHandler.js.map +1 -1
- package/dist/meeting/in-meeting-actions.js.map +1 -1
- package/dist/meeting/index.js +1555 -1527
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/locusMediaRequest.js +13 -17
- package/dist/meeting/locusMediaRequest.js.map +1 -1
- package/dist/meeting/muteState.js +11 -12
- package/dist/meeting/muteState.js.map +1 -1
- package/dist/meeting/request.js +101 -104
- package/dist/meeting/request.js.map +1 -1
- package/dist/meeting/request.type.js.map +1 -1
- package/dist/meeting/state.js.map +1 -1
- package/dist/meeting/type.js.map +1 -1
- package/dist/meeting/util.js +24 -23
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting/voicea-meeting.js +3 -3
- package/dist/meeting/voicea-meeting.js.map +1 -1
- package/dist/meeting-info/collection.js +7 -10
- package/dist/meeting-info/collection.js.map +1 -1
- package/dist/meeting-info/index.js +1 -2
- package/dist/meeting-info/index.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +135 -146
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meeting-info/request.js +1 -2
- package/dist/meeting-info/request.js.map +1 -1
- package/dist/meeting-info/util.js +36 -37
- package/dist/meeting-info/util.js.map +1 -1
- package/dist/meeting-info/utilv2.js +30 -31
- package/dist/meeting-info/utilv2.js.map +1 -1
- package/dist/meetings/collection.js +6 -8
- package/dist/meetings/collection.js.map +1 -1
- package/dist/meetings/index.js +179 -141
- package/dist/meetings/index.js.map +1 -1
- package/dist/meetings/meetings.types.js.map +1 -1
- package/dist/meetings/request.js +6 -8
- package/dist/meetings/request.js.map +1 -1
- package/dist/meetings/util.js +25 -23
- package/dist/meetings/util.js.map +1 -1
- package/dist/member/index.js +1 -2
- package/dist/member/index.js.map +1 -1
- package/dist/member/types.js +6 -3
- package/dist/member/types.js.map +1 -1
- package/dist/member/util.js.map +1 -1
- package/dist/members/collection.js +1 -2
- package/dist/members/collection.js.map +1 -1
- package/dist/members/index.js +18 -21
- package/dist/members/index.js.map +1 -1
- package/dist/members/request.js +8 -11
- package/dist/members/request.js.map +1 -1
- package/dist/members/types.js.map +1 -1
- package/dist/members/util.js.map +1 -1
- package/dist/metrics/constants.js +3 -1
- package/dist/metrics/constants.js.map +1 -1
- package/dist/metrics/index.js +3 -4
- package/dist/metrics/index.js.map +1 -1
- package/dist/multistream/mediaRequestManager.js +1 -2
- package/dist/multistream/mediaRequestManager.js.map +1 -1
- package/dist/multistream/receiveSlot.js +34 -45
- package/dist/multistream/receiveSlot.js.map +1 -1
- package/dist/multistream/receiveSlotManager.js +8 -9
- package/dist/multistream/receiveSlotManager.js.map +1 -1
- package/dist/multistream/remoteMedia.js +12 -15
- package/dist/multistream/remoteMedia.js.map +1 -1
- package/dist/multistream/remoteMediaGroup.js +1 -2
- package/dist/multistream/remoteMediaGroup.js.map +1 -1
- package/dist/multistream/remoteMediaManager.js +122 -123
- package/dist/multistream/remoteMediaManager.js.map +1 -1
- package/dist/multistream/sendSlotManager.js +29 -30
- package/dist/multistream/sendSlotManager.js.map +1 -1
- package/dist/personal-meeting-room/index.js +16 -19
- package/dist/personal-meeting-room/index.js.map +1 -1
- package/dist/personal-meeting-room/request.js +7 -10
- package/dist/personal-meeting-room/request.js.map +1 -1
- package/dist/personal-meeting-room/util.js.map +1 -1
- package/dist/reachability/clusterReachability.js +56 -373
- package/dist/reachability/clusterReachability.js.map +1 -1
- package/dist/reachability/index.js +203 -205
- package/dist/reachability/index.js.map +1 -1
- package/dist/reachability/reachability.types.js +14 -1
- package/dist/reachability/reachability.types.js.map +1 -1
- package/dist/reachability/reachabilityPeerConnection.js +445 -0
- package/dist/reachability/reachabilityPeerConnection.js.map +1 -0
- package/dist/reachability/request.js.map +1 -1
- package/dist/reachability/util.js.map +1 -1
- package/dist/reactions/constants.js.map +1 -1
- package/dist/reactions/reactions.js.map +1 -1
- package/dist/reactions/reactions.type.js.map +1 -1
- package/dist/reconnection-manager/index.js +178 -176
- package/dist/reconnection-manager/index.js.map +1 -1
- package/dist/recording-controller/enums.js.map +1 -1
- package/dist/recording-controller/index.js +1 -2
- package/dist/recording-controller/index.js.map +1 -1
- package/dist/recording-controller/util.js.map +1 -1
- package/dist/roap/index.js +12 -15
- package/dist/roap/index.js.map +1 -1
- package/dist/roap/request.js +24 -26
- package/dist/roap/request.js.map +1 -1
- package/dist/roap/turnDiscovery.js +75 -76
- package/dist/roap/turnDiscovery.js.map +1 -1
- package/dist/roap/types.js.map +1 -1
- package/dist/transcription/index.js +4 -5
- package/dist/transcription/index.js.map +1 -1
- package/dist/types/constants.d.ts +26 -21
- package/dist/types/hashTree/constants.d.ts +8 -0
- package/dist/types/hashTree/hashTree.d.ts +129 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +260 -0
- package/dist/types/hashTree/types.d.ts +25 -0
- package/dist/types/hashTree/utils.d.ts +9 -0
- package/dist/types/locus-info/index.d.ts +91 -42
- package/dist/types/locus-info/types.d.ts +46 -0
- package/dist/types/meeting/index.d.ts +22 -9
- package/dist/types/meetings/index.d.ts +9 -2
- package/dist/types/metrics/constants.d.ts +2 -0
- package/dist/types/reachability/clusterReachability.d.ts +10 -88
- package/dist/types/reachability/reachability.types.d.ts +12 -1
- package/dist/types/reachability/reachabilityPeerConnection.d.ts +111 -0
- package/dist/webinar/collection.js +1 -2
- package/dist/webinar/collection.js.map +1 -1
- package/dist/webinar/index.js +148 -158
- package/dist/webinar/index.js.map +1 -1
- package/package.json +22 -21
- package/src/constants.ts +13 -1
- package/src/hashTree/constants.ts +9 -0
- package/src/hashTree/hashTree.ts +463 -0
- package/src/hashTree/hashTreeParser.ts +1161 -0
- package/src/hashTree/types.ts +30 -0
- package/src/hashTree/utils.ts +42 -0
- package/src/locus-info/index.ts +556 -85
- package/src/locus-info/types.ts +48 -0
- package/src/meeting/index.ts +58 -26
- package/src/meeting/util.ts +1 -0
- package/src/meetings/index.ts +104 -51
- package/src/metrics/constants.ts +2 -0
- package/src/reachability/clusterReachability.ts +50 -347
- package/src/reachability/reachability.types.ts +15 -1
- package/src/reachability/reachabilityPeerConnection.ts +416 -0
- package/test/unit/spec/hashTree/hashTree.ts +655 -0
- package/test/unit/spec/hashTree/hashTreeParser.ts +1532 -0
- package/test/unit/spec/hashTree/utils.ts +103 -0
- package/test/unit/spec/locus-info/index.js +667 -1
- package/test/unit/spec/meeting/index.js +91 -20
- package/test/unit/spec/meeting/utils.js +77 -0
- package/test/unit/spec/meetings/index.js +71 -26
- package/test/unit/spec/reachability/clusterReachability.ts +281 -138
|
@@ -12,6 +12,7 @@ import EmbeddedAppsUtils from '@webex/plugin-meetings/src/locus-info/embeddedApp
|
|
|
12
12
|
import MediaSharesUtils from '@webex/plugin-meetings/src/locus-info//mediaSharesUtils';
|
|
13
13
|
import LocusDeltaParser from '@webex/plugin-meetings/src/locus-info/parser';
|
|
14
14
|
import Metrics from '@webex/plugin-meetings/src/metrics';
|
|
15
|
+
import * as HashTreeParserModule from '@webex/plugin-meetings/src/hashTree/hashTreeParser';
|
|
15
16
|
|
|
16
17
|
import {
|
|
17
18
|
LOCUSINFO,
|
|
@@ -28,6 +29,7 @@ import {
|
|
|
28
29
|
} from '../../../../src/constants';
|
|
29
30
|
|
|
30
31
|
import {self, selfWithInactivity} from './selfConstant';
|
|
32
|
+
import { MEETING_REMOVED_REASON } from '@webex/plugin-meetings/src/constants';
|
|
31
33
|
|
|
32
34
|
describe('plugin-meetings', () => {
|
|
33
35
|
describe('LocusInfo index', () => {
|
|
@@ -77,6 +79,624 @@ describe('plugin-meetings', () => {
|
|
|
77
79
|
sinon.restore();
|
|
78
80
|
});
|
|
79
81
|
|
|
82
|
+
describe('#initialSetup', () => {
|
|
83
|
+
let HashTreeParserStub;
|
|
84
|
+
let mockHashTreeParser;
|
|
85
|
+
let updateLocusCacheStub;
|
|
86
|
+
let updateLocusInfoStub;
|
|
87
|
+
let isNewFullLocusStub;
|
|
88
|
+
|
|
89
|
+
beforeEach(() => {
|
|
90
|
+
mockHashTreeParser = {
|
|
91
|
+
initializeFromMessage: sinon.stub().resolves(),
|
|
92
|
+
initializeFromGetLociResponse: sinon.stub().resolves(),
|
|
93
|
+
};
|
|
94
|
+
HashTreeParserStub = sinon
|
|
95
|
+
.stub(HashTreeParserModule, 'default')
|
|
96
|
+
.returns(mockHashTreeParser);
|
|
97
|
+
updateLocusCacheStub = sinon.stub(locusInfo, 'updateLocusCache');
|
|
98
|
+
updateLocusInfoStub = sinon.stub(locusInfo, 'updateLocusInfo');
|
|
99
|
+
isNewFullLocusStub = sinon.stub(locusInfo.locusParser, 'isNewFullLocus').returns(true);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
afterEach(() => {
|
|
103
|
+
sinon.restore();
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const createHashTreeMessage = (visibleDataSets) => ({
|
|
107
|
+
locusStateElements: [
|
|
108
|
+
{
|
|
109
|
+
htMeta: {elementId: {type: 'self'}},
|
|
110
|
+
data: {visibleDataSets},
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
dataSets: [{name: 'dataset1', url: 'test-url'}],
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const createLocusWithVisibleDataSets = (visibleDataSets) => ({
|
|
117
|
+
self: {visibleDataSets},
|
|
118
|
+
participants: [],
|
|
119
|
+
links: {
|
|
120
|
+
resources: {
|
|
121
|
+
visibleDataSets: {url: 'http://visible-datasets-url.com'},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('should initialize the hash tree parser when triggered from a hash tree locus message', async () => {
|
|
127
|
+
const visibleDataSets = ['dataset1', 'dataset2'];
|
|
128
|
+
const hashTreeMessage = createHashTreeMessage(visibleDataSets);
|
|
129
|
+
|
|
130
|
+
await locusInfo.initialSetup({
|
|
131
|
+
trigger: 'locus-message',
|
|
132
|
+
hashTreeMessage,
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
assert.calledOnceWithExactly(
|
|
136
|
+
HashTreeParserStub,
|
|
137
|
+
sinon.match({
|
|
138
|
+
initialLocus: {
|
|
139
|
+
locus: {self: {visibleDataSets}},
|
|
140
|
+
dataSets: [],
|
|
141
|
+
},
|
|
142
|
+
webexRequest: sinon.match.func,
|
|
143
|
+
locusInfoUpdateCallback: sinon.match.func,
|
|
144
|
+
debugId: sinon.match.string,
|
|
145
|
+
})
|
|
146
|
+
);
|
|
147
|
+
assert.calledOnceWithExactly(mockHashTreeParser.initializeFromMessage, hashTreeMessage);
|
|
148
|
+
assert.notCalled(updateLocusCacheStub);
|
|
149
|
+
assert.notCalled(updateLocusInfoStub);
|
|
150
|
+
assert.isTrue(locusInfo.emitChange);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('should not initialize the hash tree when triggered from a non-hash tree locus message', async () => {
|
|
154
|
+
const locus = {url: 'http://locus-url.com', participants: []};
|
|
155
|
+
|
|
156
|
+
await locusInfo.initialSetup({
|
|
157
|
+
trigger: 'locus-message',
|
|
158
|
+
locus,
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
assert.notCalled(HashTreeParserStub);
|
|
162
|
+
assert.notCalled(mockHashTreeParser.initializeFromMessage);
|
|
163
|
+
assert.calledOnceWithExactly(updateLocusCacheStub, locus);
|
|
164
|
+
assert.calledOnce(updateLocusInfoStub);
|
|
165
|
+
assert.isTrue(locusInfo.emitChange);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it('should initialize the hash tree parser correctly when triggered from a join response containing datasets', async () => {
|
|
169
|
+
const visibleDataSets = ['dataset1', 'dataset2'];
|
|
170
|
+
const locus = createLocusWithVisibleDataSets(visibleDataSets);
|
|
171
|
+
const dataSets = [{name: 'dataset1', url: 'http://dataset-url.com'}];
|
|
172
|
+
|
|
173
|
+
await locusInfo.initialSetup({
|
|
174
|
+
trigger: 'join-response',
|
|
175
|
+
locus,
|
|
176
|
+
dataSets,
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
assert.calledOnceWithExactly(
|
|
180
|
+
HashTreeParserStub,
|
|
181
|
+
sinon.match({
|
|
182
|
+
initialLocus: {
|
|
183
|
+
locus,
|
|
184
|
+
dataSets,
|
|
185
|
+
},
|
|
186
|
+
webexRequest: sinon.match.func,
|
|
187
|
+
locusInfoUpdateCallback: sinon.match.func,
|
|
188
|
+
debugId: sinon.match.string,
|
|
189
|
+
})
|
|
190
|
+
);
|
|
191
|
+
assert.calledOnceWithExactly(updateLocusCacheStub, locus);
|
|
192
|
+
assert.calledOnce(updateLocusInfoStub);
|
|
193
|
+
assert.isTrue(locusInfo.emitChange);
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it('should do normal (classic) initialization when triggered from a join response without datasets', async () => {
|
|
197
|
+
const locus = {url: 'http://locus-url.com', participants: []};
|
|
198
|
+
|
|
199
|
+
await locusInfo.initialSetup({
|
|
200
|
+
trigger: 'join-response',
|
|
201
|
+
locus,
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
assert.notCalled(HashTreeParserStub);
|
|
205
|
+
assert.calledOnceWithExactly(updateLocusCacheStub, locus);
|
|
206
|
+
assert.calledOnce(updateLocusInfoStub);
|
|
207
|
+
assert.isTrue(locusInfo.emitChange);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it('should initialize the hash tree parser correctly when triggered from a get loci response containing visible datasets', async () => {
|
|
211
|
+
const visibleDataSets = ['dataset1', 'dataset2'];
|
|
212
|
+
const locus = createLocusWithVisibleDataSets(visibleDataSets);
|
|
213
|
+
|
|
214
|
+
await locusInfo.initialSetup({
|
|
215
|
+
trigger: 'get-loci-response',
|
|
216
|
+
locus,
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
assert.calledOnceWithExactly(
|
|
220
|
+
HashTreeParserStub,
|
|
221
|
+
sinon.match({
|
|
222
|
+
initialLocus: {
|
|
223
|
+
locus: {self: {visibleDataSets}},
|
|
224
|
+
dataSets: [],
|
|
225
|
+
},
|
|
226
|
+
webexRequest: sinon.match.func,
|
|
227
|
+
locusInfoUpdateCallback: sinon.match.func,
|
|
228
|
+
debugId: sinon.match.string,
|
|
229
|
+
})
|
|
230
|
+
);
|
|
231
|
+
assert.calledOnceWithExactly(mockHashTreeParser.initializeFromGetLociResponse, locus);
|
|
232
|
+
assert.notCalled(updateLocusCacheStub);
|
|
233
|
+
assert.notCalled(updateLocusInfoStub);
|
|
234
|
+
assert.isTrue(locusInfo.emitChange);
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it('should do normal (classic) initialization when triggered from a get loci response without visible datasets', async () => {
|
|
238
|
+
const locus = {url: 'http://locus-url.com', participants: []};
|
|
239
|
+
|
|
240
|
+
await locusInfo.initialSetup({
|
|
241
|
+
trigger: 'get-loci-response',
|
|
242
|
+
locus,
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
assert.notCalled(HashTreeParserStub);
|
|
246
|
+
assert.notCalled(mockHashTreeParser.initializeFromGetLociResponse);
|
|
247
|
+
assert.calledOnceWithExactly(updateLocusCacheStub, locus);
|
|
248
|
+
assert.calledOnce(updateLocusInfoStub);
|
|
249
|
+
assert.isTrue(locusInfo.emitChange);
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
describe('should setup correct locusInfoUpdateCallback when creating HashTreeParser', () => {
|
|
253
|
+
const OBJECTS_UPDATED = HashTreeParserModule.LocusInfoUpdateType.OBJECTS_UPDATED;
|
|
254
|
+
const MEETING_ENDED = HashTreeParserModule.LocusInfoUpdateType.MEETING_ENDED;
|
|
255
|
+
|
|
256
|
+
let locusInfoUpdateCallback;
|
|
257
|
+
let onDeltaLocusStub;
|
|
258
|
+
let expectedLocusInfo;
|
|
259
|
+
|
|
260
|
+
beforeEach(async () => {
|
|
261
|
+
onDeltaLocusStub = sinon.stub(locusInfo, 'onDeltaLocus');
|
|
262
|
+
|
|
263
|
+
await locusInfo.initialSetup({
|
|
264
|
+
trigger: 'locus-message',
|
|
265
|
+
hashTreeMessage: {
|
|
266
|
+
locusStateElements: [
|
|
267
|
+
{
|
|
268
|
+
htMeta: {elementId: {type: 'self'}},
|
|
269
|
+
data: {visibleDataSets: ['dataset1']},
|
|
270
|
+
},
|
|
271
|
+
],
|
|
272
|
+
dataSets: [{name: 'dataset1', url: 'test-url'}],
|
|
273
|
+
},
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
locusInfoUpdateCallback = HashTreeParserStub.firstCall.args[0].locusInfoUpdateCallback;
|
|
277
|
+
|
|
278
|
+
assert.isDefined(locusInfoUpdateCallback);
|
|
279
|
+
|
|
280
|
+
// setup fake initial locusInfo state
|
|
281
|
+
locusInfo.controls = {id: 'fake-controls'};
|
|
282
|
+
locusInfo.fullState = {id: 'fake-full-state'};
|
|
283
|
+
locusInfo.host = {id: 'fake-host'};
|
|
284
|
+
locusInfo.info = {id: 'fake-info'};
|
|
285
|
+
locusInfo.links = {id: 'fake-links'};
|
|
286
|
+
locusInfo.mediaShares = [
|
|
287
|
+
{
|
|
288
|
+
id: 'fake-media-share-1',
|
|
289
|
+
htMeta: {elementId: {type: 'mediashare', id: 'fake-ht-mediaShare-1', version: 1}},
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
id: 'fake-media-share-2',
|
|
293
|
+
htMeta: {elementId: {type: 'mediashare', id: 'fake-ht-mediaShare-2', version: 1}},
|
|
294
|
+
},
|
|
295
|
+
];
|
|
296
|
+
locusInfo.meetings = {id: 'fake-meetings'};
|
|
297
|
+
locusInfo.participants = [
|
|
298
|
+
{id: 'fake-participant-1', name: 'Participant One'},
|
|
299
|
+
{id: 'fake-participant-2', name: 'Participant Two'},
|
|
300
|
+
];
|
|
301
|
+
locusInfo.hashTreeObjectId2ParticipantId.set(
|
|
302
|
+
'fake-ht-participant-1',
|
|
303
|
+
'fake-participant-1'
|
|
304
|
+
);
|
|
305
|
+
locusInfo.hashTreeObjectId2ParticipantId.set(
|
|
306
|
+
'fake-ht-participant-2',
|
|
307
|
+
'fake-participant-2'
|
|
308
|
+
);
|
|
309
|
+
locusInfo.replaces = {id: 'fake-replaces'};
|
|
310
|
+
locusInfo.self = {id: 'fake-self'};
|
|
311
|
+
locusInfo.url = 'fake-locus-url';
|
|
312
|
+
locusInfo.htMeta = {elementId: {type: 'locus', id: 'fake-ht-locus-id', version: 1}};
|
|
313
|
+
|
|
314
|
+
// setup the default expected locus info state that each test builds upon
|
|
315
|
+
expectedLocusInfo = {
|
|
316
|
+
controls: {id: 'fake-controls'},
|
|
317
|
+
fullState: {id: 'fake-full-state'},
|
|
318
|
+
host: {id: 'fake-host'},
|
|
319
|
+
info: {id: 'fake-info'},
|
|
320
|
+
links: {id: 'fake-links'},
|
|
321
|
+
mediaShares: [
|
|
322
|
+
{
|
|
323
|
+
id: 'fake-media-share-1',
|
|
324
|
+
htMeta: {elementId: {type: 'mediashare', id: 'fake-ht-mediaShare-1', version: 1}},
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
id: 'fake-media-share-2',
|
|
328
|
+
htMeta: {elementId: {type: 'mediashare', id: 'fake-ht-mediaShare-2', version: 1}},
|
|
329
|
+
},
|
|
330
|
+
],
|
|
331
|
+
meetings: {id: 'fake-meetings'},
|
|
332
|
+
jsSdkMeta: {removedParticipantIds: []},
|
|
333
|
+
participants: [], // empty means there were no participant updates
|
|
334
|
+
replaces: {id: 'fake-replaces'},
|
|
335
|
+
self: {id: 'fake-self'},
|
|
336
|
+
url: 'fake-locus-url',
|
|
337
|
+
htMeta: {elementId: {type: 'locus', id: 'fake-ht-locus-id', version: 1}},
|
|
338
|
+
sequence: null, // not relevant for hash trees, so should remain null
|
|
339
|
+
syncUrl: undefined, // not relevant for hash trees, so should remain undefined
|
|
340
|
+
};
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
it('should process locus update correctly when called with updated SELF', () => {
|
|
344
|
+
const newSelf = {
|
|
345
|
+
id: 'new-self',
|
|
346
|
+
visibleDataSets: ['dataset1', 'dataset2'],
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
350
|
+
locusInfoUpdateCallback(OBJECTS_UPDATED, {
|
|
351
|
+
updatedObjects: [{htMeta: {elementId: {type: 'self'}}, data: newSelf}],
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
// check onDeltaLocus() was called with correctly updated locus info
|
|
355
|
+
assert.calledOnceWithExactly(onDeltaLocusStub, {
|
|
356
|
+
...expectedLocusInfo,
|
|
357
|
+
self: newSelf,
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
it('should process locus update correctly when called with updated fullState', () => {
|
|
362
|
+
const newFullState = {
|
|
363
|
+
id: 'new-fullState',
|
|
364
|
+
visibleDataSets: ['dataset1', 'dataset2'],
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
368
|
+
locusInfoUpdateCallback(OBJECTS_UPDATED, {
|
|
369
|
+
updatedObjects: [{htMeta: {elementId: {type: 'fullState'}}, data: newFullState}],
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
// check onDeltaLocus() was called with correctly updated locus info
|
|
373
|
+
assert.calledOnceWithExactly(onDeltaLocusStub, {
|
|
374
|
+
...expectedLocusInfo,
|
|
375
|
+
fullState: newFullState,
|
|
376
|
+
});
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
it('should process locus update correctly when called with updated info', () => {
|
|
380
|
+
const newInfo = {
|
|
381
|
+
id: 'new-info',
|
|
382
|
+
visibleDataSets: ['dataset1', 'dataset2'],
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
386
|
+
locusInfoUpdateCallback(OBJECTS_UPDATED, {
|
|
387
|
+
updatedObjects: [{htMeta: {elementId: {type: 'info'}}, data: newInfo}],
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
// check onDeltaLocus() was called with correctly updated locus info
|
|
391
|
+
assert.calledOnceWithExactly(onDeltaLocusStub, {
|
|
392
|
+
...expectedLocusInfo,
|
|
393
|
+
info: newInfo,
|
|
394
|
+
});
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
it('should process locus update correctly when called with updated LOCUS object', () => {
|
|
398
|
+
// setup new updated locus that has many things missing
|
|
399
|
+
const newLocusHtMeta = {elementId: {type: 'locus', version: 42}};
|
|
400
|
+
const newLocus = {
|
|
401
|
+
controls: 'new-controls',
|
|
402
|
+
host: 'new-host',
|
|
403
|
+
htMeta: newLocusHtMeta,
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
407
|
+
locusInfoUpdateCallback(OBJECTS_UPDATED, {
|
|
408
|
+
updatedObjects: [{htMeta: newLocusHtMeta, data: newLocus}],
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
// check onDeltaLocus() was called with correctly updated locus info
|
|
412
|
+
assert.calledOnceWithExactly(onDeltaLocusStub, {
|
|
413
|
+
// these fields are not part of Locus object, so should keep their old values:
|
|
414
|
+
info: {id: 'fake-info'},
|
|
415
|
+
fullState: {id: 'fake-full-state'},
|
|
416
|
+
self: {id: 'fake-self'},
|
|
417
|
+
mediaShares: expectedLocusInfo.mediaShares,
|
|
418
|
+
// and now the new fields
|
|
419
|
+
...newLocus,
|
|
420
|
+
htMeta: newLocusHtMeta,
|
|
421
|
+
participants: [], // empty means there were no participant updates
|
|
422
|
+
jsSdkMeta: {removedParticipantIds: []}, // no participants were removed
|
|
423
|
+
});
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
// this test is checking that we cope with an edge case if Locus
|
|
427
|
+
// sends us something that they shouldn't
|
|
428
|
+
it('should process locus update correctly when called with updated LOCUS object that contains info/fullState/self/participants etc', () => {
|
|
429
|
+
// setup new updated locus that has many things missing
|
|
430
|
+
const newLocusHtMeta = {elementId: {type: 'locus', version: 42}};
|
|
431
|
+
const newLocus = {
|
|
432
|
+
controls: 'new-controls',
|
|
433
|
+
host: 'new-host',
|
|
434
|
+
htMeta: newLocusHtMeta,
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
438
|
+
locusInfoUpdateCallback(OBJECTS_UPDATED, {
|
|
439
|
+
updatedObjects: [
|
|
440
|
+
{
|
|
441
|
+
htMeta: newLocusHtMeta,
|
|
442
|
+
data: {
|
|
443
|
+
...newLocus,
|
|
444
|
+
// all these fields below should be ignored and not override the existing ones in our "old" Locus
|
|
445
|
+
info: 'new-info',
|
|
446
|
+
fullState: 'new-fullState',
|
|
447
|
+
self: 'new-self',
|
|
448
|
+
participants: 'new-participants',
|
|
449
|
+
mediaShares: 'new-mediaShares',
|
|
450
|
+
},
|
|
451
|
+
},
|
|
452
|
+
],
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
// check onDeltaLocus() was called with correctly updated locus info
|
|
456
|
+
// with old values for the fields that should be ignored (like "info" or "fullState")
|
|
457
|
+
assert.calledOnceWithExactly(onDeltaLocusStub, {
|
|
458
|
+
// these fields have the "old" values:
|
|
459
|
+
info: {id: 'fake-info'},
|
|
460
|
+
fullState: {id: 'fake-full-state'},
|
|
461
|
+
self: {id: 'fake-self'},
|
|
462
|
+
mediaShares: expectedLocusInfo.mediaShares,
|
|
463
|
+
participants: [], // empty means there were no participant updates
|
|
464
|
+
jsSdkMeta: {removedParticipantIds: []}, // no participants were removed
|
|
465
|
+
...newLocus,
|
|
466
|
+
htMeta: newLocusHtMeta,
|
|
467
|
+
});
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
it('should process locus update correctly when called with removed LOCUS object followed by updated LOCUS object', () => {
|
|
471
|
+
// setup new updated locus that has many things missing
|
|
472
|
+
const newLocusHtMeta = {elementId: {type: 'locus', version: 99}};
|
|
473
|
+
const newLocus = {
|
|
474
|
+
info: 'new-info',
|
|
475
|
+
links: 'new-links',
|
|
476
|
+
htMeta: newLocusHtMeta,
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
480
|
+
locusInfoUpdateCallback(OBJECTS_UPDATED, {
|
|
481
|
+
updatedObjects: [
|
|
482
|
+
// first, a removal of LOCUS object
|
|
483
|
+
{htMeta: {elementId: {type: 'locus'}}, data: null},
|
|
484
|
+
// followed by an update of LOCUS object
|
|
485
|
+
{htMeta: newLocusHtMeta, data: newLocus},
|
|
486
|
+
],
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
// check onDeltaLocus() was called with correctly updated locus info
|
|
490
|
+
assert.calledOnceWithExactly(onDeltaLocusStub, {
|
|
491
|
+
// these fields are not part of Locus object, so should keep their old values:
|
|
492
|
+
info: {id: 'fake-info'},
|
|
493
|
+
fullState: {id: 'fake-full-state'},
|
|
494
|
+
self: {id: 'fake-self'},
|
|
495
|
+
mediaShares: expectedLocusInfo.mediaShares,
|
|
496
|
+
// and now the new fields
|
|
497
|
+
...newLocus,
|
|
498
|
+
htMeta: newLocusHtMeta,
|
|
499
|
+
participants: [], // empty means there were no participant updates
|
|
500
|
+
jsSdkMeta: {removedParticipantIds: []}, // no participants were removed
|
|
501
|
+
});
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
it('should send a metric if unsupported sequence of LOCUS object updates occurs (update followed by removal)', () => {
|
|
505
|
+
const newLocus = {
|
|
506
|
+
info: 'new-info',
|
|
507
|
+
};
|
|
508
|
+
const newLocusHtMeta = {elementId: {type: 'locus', version: 99}};
|
|
509
|
+
|
|
510
|
+
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
511
|
+
locusInfoUpdateCallback(OBJECTS_UPDATED, {
|
|
512
|
+
updatedObjects: [
|
|
513
|
+
// first, an update
|
|
514
|
+
{htMeta: newLocusHtMeta, data: newLocus},
|
|
515
|
+
// followed by removal
|
|
516
|
+
{htMeta: {elementId: {type: 'locus'}}, data: null},
|
|
517
|
+
],
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
assert.calledWith(
|
|
521
|
+
sendBehavioralMetricStub,
|
|
522
|
+
'js_sdk_locus_hash_tree_unsupported_operation',
|
|
523
|
+
{
|
|
524
|
+
locusUrl: 'fake-locus-url',
|
|
525
|
+
message: 'LOCUS object update followed by removal',
|
|
526
|
+
}
|
|
527
|
+
);
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
it('should send a metric if unsupported sequence of LOCUS object updates occurs (multiple updates)', () => {
|
|
531
|
+
const newLocus1 = {
|
|
532
|
+
info: 'new-info-1',
|
|
533
|
+
};
|
|
534
|
+
const newLocus2 = {
|
|
535
|
+
info: 'new-info-2',
|
|
536
|
+
url: 'new-url-2',
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
540
|
+
locusInfoUpdateCallback(OBJECTS_UPDATED, {
|
|
541
|
+
updatedObjects: [
|
|
542
|
+
// first, an update
|
|
543
|
+
{htMeta: {elementId: {type: 'locus'}}, data: newLocus1},
|
|
544
|
+
// followed by another update
|
|
545
|
+
{htMeta: {elementId: {type: 'locus'}}, data: newLocus2},
|
|
546
|
+
],
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
assert.calledWith(
|
|
550
|
+
sendBehavioralMetricStub,
|
|
551
|
+
'js_sdk_locus_hash_tree_unsupported_operation',
|
|
552
|
+
{
|
|
553
|
+
locusUrl: 'new-url-2',
|
|
554
|
+
message: 'multiple LOCUS object updates',
|
|
555
|
+
}
|
|
556
|
+
);
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
it('should process locus update correctly when called with added/updated/removed PARTICIPANT objects', () => {
|
|
560
|
+
const newParticipant = {
|
|
561
|
+
id: 'fake-participant-3',
|
|
562
|
+
name: 'New Participant',
|
|
563
|
+
};
|
|
564
|
+
const updatedParticipant2 = {
|
|
565
|
+
id: 'fake-participant-2',
|
|
566
|
+
name: 'Updated Participant Two',
|
|
567
|
+
};
|
|
568
|
+
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
569
|
+
// with 1 participant added, 1 updated, and 1 removed
|
|
570
|
+
locusInfoUpdateCallback(OBJECTS_UPDATED, {
|
|
571
|
+
updatedObjects: [
|
|
572
|
+
{htMeta: {elementId: {type: 'participant', id: 'fake-ht-participant-1'}}, data: null},
|
|
573
|
+
{
|
|
574
|
+
htMeta: {elementId: {type: 'participant', id: 'fake-ht-participant-3'}},
|
|
575
|
+
data: newParticipant,
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
htMeta: {elementId: {type: 'participant', id: 'fake-ht-participant-2'}},
|
|
579
|
+
data: updatedParticipant2,
|
|
580
|
+
},
|
|
581
|
+
],
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
// check onDeltaLocus() was called with correctly updated locus info
|
|
585
|
+
assert.calledOnceWithExactly(onDeltaLocusStub, {
|
|
586
|
+
...expectedLocusInfo,
|
|
587
|
+
participants: [newParticipant, updatedParticipant2],
|
|
588
|
+
jsSdkMeta: {removedParticipantIds: ['fake-participant-1']},
|
|
589
|
+
});
|
|
590
|
+
// and that the hashTreeObjectId2ParticipantId map was updated correctly
|
|
591
|
+
assert.isUndefined(locusInfo.hashTreeObjectId2ParticipantId.get('fake-ht-participant-1'));
|
|
592
|
+
assert.equal(
|
|
593
|
+
locusInfo.hashTreeObjectId2ParticipantId.get('fake-ht-participant-2'),
|
|
594
|
+
'fake-participant-2'
|
|
595
|
+
);
|
|
596
|
+
assert.equal(
|
|
597
|
+
locusInfo.hashTreeObjectId2ParticipantId.get('fake-ht-participant-3'),
|
|
598
|
+
'fake-participant-3'
|
|
599
|
+
);
|
|
600
|
+
});
|
|
601
|
+
|
|
602
|
+
it('should process locus update correctly when called with updated MEDIASHARE objects', () => {
|
|
603
|
+
const newMediaShare = {
|
|
604
|
+
id: 'new-mediaShare-3',
|
|
605
|
+
htMeta: {elementId: {type: 'mediashare', id: 'fake-ht-mediaShare-3', version: 100}},
|
|
606
|
+
};
|
|
607
|
+
const updatedMediaShare2 = {
|
|
608
|
+
id: 'fake-media-share-2',
|
|
609
|
+
someNewProp: 'newValue',
|
|
610
|
+
htMeta: {elementId: {type: 'mediashare', id: 'fake-ht-mediaShare-2', version: 100}},
|
|
611
|
+
};
|
|
612
|
+
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
613
|
+
// with 1 participant added, 1 updated, and 1 removed
|
|
614
|
+
locusInfoUpdateCallback(OBJECTS_UPDATED, {
|
|
615
|
+
updatedObjects: [
|
|
616
|
+
{htMeta: {elementId: {type: 'mediashare', id: 'fake-ht-mediaShare-1'}}, data: null},
|
|
617
|
+
{
|
|
618
|
+
htMeta: {elementId: {type: 'mediashare', id: 'fake-ht-mediaShare-2'}},
|
|
619
|
+
data: updatedMediaShare2,
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
htMeta: {elementId: {type: 'mediashare', id: 'fake-ht-mediaShare-3'}},
|
|
623
|
+
data: newMediaShare,
|
|
624
|
+
},
|
|
625
|
+
],
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
// check onDeltaLocus() was called with correctly updated locus info
|
|
629
|
+
assert.calledOnceWithExactly(onDeltaLocusStub, {
|
|
630
|
+
...expectedLocusInfo,
|
|
631
|
+
mediaShares: [updatedMediaShare2, newMediaShare],
|
|
632
|
+
});
|
|
633
|
+
});
|
|
634
|
+
|
|
635
|
+
it('should process locus update correctly when called with a combination of various updated objects', () => {
|
|
636
|
+
const newSelf = {
|
|
637
|
+
id: 'new-self',
|
|
638
|
+
visibleDataSets: ['dataset1', 'dataset2'],
|
|
639
|
+
};
|
|
640
|
+
const updatedMediaShare2 = {
|
|
641
|
+
id: 'fake-media-share-2',
|
|
642
|
+
someNewProp: 'newValue',
|
|
643
|
+
htMeta: {elementId: {type: 'mediashare', id: 'fake-ht-mediaShare-2', version: 100}},
|
|
644
|
+
};
|
|
645
|
+
const updatedParticipant2 = {
|
|
646
|
+
id: 'fake-participant-2',
|
|
647
|
+
name: 'Updated Participant Two',
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
651
|
+
locusInfoUpdateCallback(OBJECTS_UPDATED, {
|
|
652
|
+
updatedObjects: [
|
|
653
|
+
{
|
|
654
|
+
htMeta: {elementId: {type: 'mediashare', id: 'fake-ht-mediaShare-2'}},
|
|
655
|
+
data: updatedMediaShare2,
|
|
656
|
+
},
|
|
657
|
+
{htMeta: {elementId: {type: 'self'}}, data: newSelf},
|
|
658
|
+
{
|
|
659
|
+
htMeta: {elementId: {type: 'participant', id: 'fake-ht-participant-2'}},
|
|
660
|
+
data: updatedParticipant2,
|
|
661
|
+
},
|
|
662
|
+
],
|
|
663
|
+
});
|
|
664
|
+
|
|
665
|
+
// check onDeltaLocus() was called with correctly updated locus info
|
|
666
|
+
assert.calledOnceWithExactly(onDeltaLocusStub, {
|
|
667
|
+
...expectedLocusInfo,
|
|
668
|
+
mediaShares: [
|
|
669
|
+
{
|
|
670
|
+
id: 'fake-media-share-1',
|
|
671
|
+
htMeta: {elementId: {type: 'mediashare', id: 'fake-ht-mediaShare-1', version: 1}},
|
|
672
|
+
},
|
|
673
|
+
updatedMediaShare2,
|
|
674
|
+
],
|
|
675
|
+
participants: [updatedParticipant2],
|
|
676
|
+
self: newSelf,
|
|
677
|
+
});
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
it('should handle MEETING_ENDED correctly', () => {
|
|
681
|
+
const fakeMeeting = {id: 'fake-meeting-from-collection'};
|
|
682
|
+
const collectionGetStub = sinon
|
|
683
|
+
.stub(locusInfo.webex.meetings.meetingCollection, 'get')
|
|
684
|
+
.returns(fakeMeeting);
|
|
685
|
+
const destroyStub = sinon.stub(locusInfo.webex.meetings, 'destroy');
|
|
686
|
+
|
|
687
|
+
// simulate an update from the HashTreeParser (normally this would be triggered by incoming locus messages)
|
|
688
|
+
locusInfoUpdateCallback(MEETING_ENDED);
|
|
689
|
+
|
|
690
|
+
assert.calledOnceWithExactly(collectionGetStub, locusInfo.meetingId);
|
|
691
|
+
assert.calledOnceWithExactly(
|
|
692
|
+
destroyStub,
|
|
693
|
+
fakeMeeting,
|
|
694
|
+
MEETING_REMOVED_REASON.SELF_REMOVED
|
|
695
|
+
);
|
|
696
|
+
});
|
|
697
|
+
});
|
|
698
|
+
});
|
|
699
|
+
|
|
80
700
|
describe('#updateControls', () => {
|
|
81
701
|
let newControls;
|
|
82
702
|
|
|
@@ -2041,7 +2661,7 @@ describe('plugin-meetings', () => {
|
|
|
2041
2661
|
});
|
|
2042
2662
|
|
|
2043
2663
|
describe('#handleLocusAPIResponse', () => {
|
|
2044
|
-
it('calls handleLocusDelta', () => {
|
|
2664
|
+
it('calls handleLocusDelta when we are not using hash trees', () => {
|
|
2045
2665
|
const fakeLocus = {eventType: LOCUSEVENT.DIFFERENCE};
|
|
2046
2666
|
|
|
2047
2667
|
sinon.stub(locusInfo, 'handleLocusDelta');
|
|
@@ -2050,6 +2670,23 @@ describe('plugin-meetings', () => {
|
|
|
2050
2670
|
|
|
2051
2671
|
assert.calledWith(locusInfo.handleLocusDelta, fakeLocus, mockMeeting);
|
|
2052
2672
|
});
|
|
2673
|
+
it('calls hash tree parser when we are using hash trees', () => {
|
|
2674
|
+
const fakeLocus = {eventType: LOCUSEVENT.DIFFERENCE};
|
|
2675
|
+
const fakeDataSets = [{name: 'dataset1', url: 'http://test.com'}];
|
|
2676
|
+
const responseBody = {locus: fakeLocus, dataSets: fakeDataSets};
|
|
2677
|
+
|
|
2678
|
+
// Create a mock hash tree parser
|
|
2679
|
+
const mockHashTreeParser = {
|
|
2680
|
+
handleLocusUpdate: sinon.stub(),
|
|
2681
|
+
};
|
|
2682
|
+
locusInfo.hashTreeParser = mockHashTreeParser;
|
|
2683
|
+
|
|
2684
|
+
sinon.stub(locusInfo, 'onDeltaLocus');
|
|
2685
|
+
|
|
2686
|
+
locusInfo.handleLocusAPIResponse(mockMeeting, responseBody);
|
|
2687
|
+
|
|
2688
|
+
assert.calledOnceWithExactly(mockHashTreeParser.handleLocusUpdate, responseBody);
|
|
2689
|
+
});
|
|
2053
2690
|
});
|
|
2054
2691
|
|
|
2055
2692
|
describe('#LocusDeltaEvents', () => {
|
|
@@ -3351,5 +3988,34 @@ describe('plugin-meetings', () => {
|
|
|
3351
3988
|
assert.calledWith(updateLocusInfoStub.getCall(2), deltaEvents[7]);
|
|
3352
3989
|
});
|
|
3353
3990
|
});
|
|
3991
|
+
|
|
3992
|
+
describe('#parse', () => {
|
|
3993
|
+
it('handles hash tree messages correctly', () => {
|
|
3994
|
+
const fakeHashTreeMessage = {
|
|
3995
|
+
locusStateElements: [
|
|
3996
|
+
{
|
|
3997
|
+
htMeta: {elementId: {type: 'self'}},
|
|
3998
|
+
data: {visibleDataSets: ['dataset1']},
|
|
3999
|
+
},
|
|
4000
|
+
],
|
|
4001
|
+
dataSets: [{name: 'dataset1', url: 'http://test.com'}],
|
|
4002
|
+
};
|
|
4003
|
+
|
|
4004
|
+
const data = {
|
|
4005
|
+
eventType: LOCUSEVENT.HASH_TREE_DATA_UPDATED,
|
|
4006
|
+
stateElementsMessage: fakeHashTreeMessage,
|
|
4007
|
+
};
|
|
4008
|
+
|
|
4009
|
+
// Create a mock hash tree parser
|
|
4010
|
+
const mockHashTreeParser = {
|
|
4011
|
+
handleMessage: sinon.stub(),
|
|
4012
|
+
};
|
|
4013
|
+
locusInfo.hashTreeParser = mockHashTreeParser;
|
|
4014
|
+
|
|
4015
|
+
locusInfo.parse(mockMeeting, data);
|
|
4016
|
+
|
|
4017
|
+
assert.calledOnceWithExactly(mockHashTreeParser.handleMessage, fakeHashTreeMessage);
|
|
4018
|
+
});
|
|
4019
|
+
});
|
|
3354
4020
|
});
|
|
3355
4021
|
});
|