@webex/internal-plugin-board 2.59.1 → 2.59.3-next.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/.eslintrc.js +6 -6
- package/README.md +42 -42
- package/babel.config.js +3 -3
- package/dist/board.js +161 -161
- package/dist/board.js.map +1 -1
- package/dist/config.js +21 -21
- package/dist/config.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/realtime-channel-collection.js +4 -4
- package/dist/realtime-channel-collection.js.map +1 -1
- package/dist/realtime-channel.js +4 -4
- package/dist/realtime-channel.js.map +1 -1
- package/dist/realtime.js +48 -48
- package/dist/realtime.js.map +1 -1
- package/jest.config.js +3 -3
- package/package.json +20 -19
- package/process +1 -1
- package/src/board.js +764 -764
- package/src/config.js +44 -44
- package/src/index.js +105 -105
- package/src/realtime-channel-collection.js +18 -18
- package/src/realtime-channel.js +40 -40
- package/src/realtime.js +252 -252
- package/test/integration/spec/board.js +717 -717
- package/test/integration/spec/realtime.js +194 -194
- package/test/integration/spec/sharing-mercury.js +285 -285
- package/test/unit/spec/board.js +635 -635
- package/test/unit/spec/encryption.js +255 -255
- package/test/unit/spec/realtime.js +473 -473
|
@@ -1,285 +1,285 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import '@webex/internal-plugin-board';
|
|
6
|
-
|
|
7
|
-
import {assert} from '@webex/test-helper-chai';
|
|
8
|
-
import {maxWaitForEvent} from '@webex/test-helper-mocha';
|
|
9
|
-
import WebexCore from '@webex/webex-core';
|
|
10
|
-
import testUsers from '@webex/test-helper-test-users';
|
|
11
|
-
import uuid from 'uuid';
|
|
12
|
-
import promiseSeries from 'es6-promise-series';
|
|
13
|
-
|
|
14
|
-
describe.skip('plugin-board', () => {
|
|
15
|
-
describe('realtime - sharing mercury', () => {
|
|
16
|
-
let board, conversation, participants, secondBoard;
|
|
17
|
-
let mccoy, spock;
|
|
18
|
-
let uniqueRealtimeData;
|
|
19
|
-
|
|
20
|
-
before('create users', () =>
|
|
21
|
-
testUsers.create({count: 2}).then((users) => {
|
|
22
|
-
participants = [spock, mccoy] = users;
|
|
23
|
-
|
|
24
|
-
return Promise.all(
|
|
25
|
-
participants.map((participant) => {
|
|
26
|
-
participant.webex = new WebexCore({
|
|
27
|
-
credentials: {
|
|
28
|
-
authorization: participant.token,
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
return participant.webex.internal.device
|
|
33
|
-
.register()
|
|
34
|
-
.then(() =>
|
|
35
|
-
participant.webex.internal.feature.setFeature(
|
|
36
|
-
'developer',
|
|
37
|
-
'web-shared-mercury',
|
|
38
|
-
true
|
|
39
|
-
)
|
|
40
|
-
);
|
|
41
|
-
})
|
|
42
|
-
);
|
|
43
|
-
})
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
before('create conversation', () =>
|
|
47
|
-
spock.webex.internal.conversation
|
|
48
|
-
.create({
|
|
49
|
-
displayName: 'Test Board Mercury',
|
|
50
|
-
participants,
|
|
51
|
-
})
|
|
52
|
-
.then((c) => {
|
|
53
|
-
conversation = c;
|
|
54
|
-
|
|
55
|
-
return conversation;
|
|
56
|
-
})
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
before('create channel (board)', () =>
|
|
60
|
-
spock.webex.internal.board.createChannel(conversation).then((channel) => {
|
|
61
|
-
board = channel;
|
|
62
|
-
|
|
63
|
-
return channel;
|
|
64
|
-
})
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
before('create second channel (board)', () =>
|
|
68
|
-
mccoy.webex.internal.board.createChannel(conversation).then((channel) => {
|
|
69
|
-
secondBoard = channel;
|
|
70
|
-
|
|
71
|
-
return channel;
|
|
72
|
-
})
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
beforeEach('connect to mercury channel', () =>
|
|
76
|
-
Promise.all(participants.map((participant) => participant.webex.internal.mercury.connect()))
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
afterEach('disconnect mercury', () =>
|
|
80
|
-
Promise.all(
|
|
81
|
-
participants.map((participant) => participant.webex.internal.mercury.disconnect())
|
|
82
|
-
)
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
describe('#publish()', () => {
|
|
86
|
-
describe('string payload', () => {
|
|
87
|
-
let spockRealtimeChannel;
|
|
88
|
-
let mccoyRealtimeChannel;
|
|
89
|
-
|
|
90
|
-
before('open two connections', () =>
|
|
91
|
-
Promise.all([
|
|
92
|
-
spock.webex.internal.board.realtime.connectToSharedMercury(board),
|
|
93
|
-
mccoy.webex.internal.board.realtime.connectByOpenNewMercuryConnection(board),
|
|
94
|
-
])
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
before('get realtime channels', () => {
|
|
98
|
-
spockRealtimeChannel = spock.webex.internal.board.realtime.realtimeChannels.get(
|
|
99
|
-
board.channelId
|
|
100
|
-
);
|
|
101
|
-
mccoyRealtimeChannel = mccoy.webex.internal.board.realtime.realtimeChannels.get(
|
|
102
|
-
board.channelId
|
|
103
|
-
);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
after(() =>
|
|
107
|
-
Promise.all(
|
|
108
|
-
participants.map((participant) =>
|
|
109
|
-
participant.webex.internal.board.realtime.disconnectFromSharedMercury(board)
|
|
110
|
-
)
|
|
111
|
-
)
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
it('posts a message from shared connection to the specified board', () => {
|
|
115
|
-
uniqueRealtimeData = uuid.v4();
|
|
116
|
-
const data = {
|
|
117
|
-
envelope: {
|
|
118
|
-
channelId: board,
|
|
119
|
-
roomId: conversation.id,
|
|
120
|
-
},
|
|
121
|
-
payload: {
|
|
122
|
-
msg: uniqueRealtimeData,
|
|
123
|
-
},
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
// confirm that both are connected.
|
|
127
|
-
assert.isTrue(
|
|
128
|
-
spockRealtimeChannel.isSharingMercury,
|
|
129
|
-
'spock is sharing mercury connection'
|
|
130
|
-
);
|
|
131
|
-
assert.isTrue(spock.webex.internal.mercury.connected, 'spock is connected');
|
|
132
|
-
assert.isFalse(
|
|
133
|
-
mccoyRealtimeChannel.isSharingMercury,
|
|
134
|
-
'mccoy should not share mercury connection'
|
|
135
|
-
);
|
|
136
|
-
assert.isTrue(mccoy.webex.internal.mercury.connected, 'mccoy is connected');
|
|
137
|
-
|
|
138
|
-
spock.webex.internal.board.realtime.publish(board, data);
|
|
139
|
-
|
|
140
|
-
// mccoy listens and verifies data received
|
|
141
|
-
return maxWaitForEvent(5000, 'event:board.activity', mccoyRealtimeChannel).then(
|
|
142
|
-
({data}) => {
|
|
143
|
-
assert.equal(data.contentType, 'STRING');
|
|
144
|
-
assert.equal(data.payload.msg, uniqueRealtimeData);
|
|
145
|
-
}
|
|
146
|
-
);
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it('posts a message from separated socket connection to the specified board', () => {
|
|
150
|
-
uniqueRealtimeData = uuid.v4();
|
|
151
|
-
const data = {
|
|
152
|
-
envelope: {
|
|
153
|
-
channelId: board,
|
|
154
|
-
roomId: conversation.id,
|
|
155
|
-
},
|
|
156
|
-
payload: {
|
|
157
|
-
msg: uniqueRealtimeData,
|
|
158
|
-
},
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
assert.isTrue(spock.webex.internal.mercury.connected, 'spock is connected');
|
|
162
|
-
assert.isTrue(
|
|
163
|
-
spockRealtimeChannel.isSharingMercury,
|
|
164
|
-
'spock is sharing mercury connection'
|
|
165
|
-
);
|
|
166
|
-
assert.isTrue(mccoy.webex.internal.mercury.connected, 'mccoy is connected');
|
|
167
|
-
assert.isFalse(
|
|
168
|
-
mccoyRealtimeChannel.isSharingMercury,
|
|
169
|
-
'mccoy does not share mercury connection'
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
mccoy.webex.internal.board.realtime.publish(board, data);
|
|
173
|
-
|
|
174
|
-
return maxWaitForEvent(5000, 'event:board.activity', spockRealtimeChannel).then(
|
|
175
|
-
({data}) => {
|
|
176
|
-
assert.equal(data.contentType, 'STRING');
|
|
177
|
-
assert.equal(data.payload.msg, uniqueRealtimeData);
|
|
178
|
-
}
|
|
179
|
-
);
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
describe('multiple boards sharing a connection', () => {
|
|
185
|
-
beforeEach(() => {
|
|
186
|
-
uniqueRealtimeData = uuid.v4();
|
|
187
|
-
|
|
188
|
-
return promiseSeries([
|
|
189
|
-
spock.webex.internal.board.realtime.connectToSharedMercury.bind(
|
|
190
|
-
spock.webex.internal.board.realtime,
|
|
191
|
-
board
|
|
192
|
-
),
|
|
193
|
-
mccoy.webex.internal.board.realtime.connectToSharedMercury.bind(
|
|
194
|
-
mccoy.webex.internal.board.realtime,
|
|
195
|
-
board
|
|
196
|
-
),
|
|
197
|
-
spock.webex.internal.board.realtime.connectToSharedMercury.bind(
|
|
198
|
-
spock.webex.internal.board.realtime,
|
|
199
|
-
secondBoard
|
|
200
|
-
),
|
|
201
|
-
mccoy.webex.internal.board.realtime.connectToSharedMercury.bind(
|
|
202
|
-
mccoy.webex.internal.board.realtime,
|
|
203
|
-
secondBoard
|
|
204
|
-
),
|
|
205
|
-
]);
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
afterEach(() =>
|
|
209
|
-
Promise.all(
|
|
210
|
-
participants.map((participant) =>
|
|
211
|
-
promiseSeries([
|
|
212
|
-
participant.webex.internal.board.realtime.disconnectFromSharedMercury.bind(
|
|
213
|
-
participant.webex.internal.board.realtime,
|
|
214
|
-
board
|
|
215
|
-
),
|
|
216
|
-
participant.webex.internal.board.realtime.disconnectFromSharedMercury.bind(
|
|
217
|
-
participant.webex.internal.board.realtime,
|
|
218
|
-
secondBoard
|
|
219
|
-
),
|
|
220
|
-
])
|
|
221
|
-
)
|
|
222
|
-
)
|
|
223
|
-
);
|
|
224
|
-
|
|
225
|
-
it('receives correct message for the corresponding board', (done) => {
|
|
226
|
-
const data1 = {
|
|
227
|
-
envelope: {
|
|
228
|
-
channelId: board,
|
|
229
|
-
roomId: conversation.id,
|
|
230
|
-
},
|
|
231
|
-
payload: {
|
|
232
|
-
msg: `first message for ${board.channelId} ${uniqueRealtimeData}`,
|
|
233
|
-
},
|
|
234
|
-
};
|
|
235
|
-
const data2 = {
|
|
236
|
-
envelope: {
|
|
237
|
-
channelId: secondBoard,
|
|
238
|
-
roomId: conversation.id,
|
|
239
|
-
},
|
|
240
|
-
payload: {
|
|
241
|
-
msg: `second message for ${secondBoard.channelId} ${uniqueRealtimeData}`,
|
|
242
|
-
},
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
let receivedFirstMsg = false;
|
|
246
|
-
let receivedSecondMsg = false;
|
|
247
|
-
const mccoyRealtimeChannel0 = mccoy.webex.internal.board.realtime.realtimeChannels.get(
|
|
248
|
-
board.channelId
|
|
249
|
-
);
|
|
250
|
-
const mccoyRealtimeChannel1 = mccoy.webex.internal.board.realtime.realtimeChannels.get(
|
|
251
|
-
secondBoard.channelId
|
|
252
|
-
);
|
|
253
|
-
|
|
254
|
-
mccoyRealtimeChannel0.once('event:board.activity', ({data}) => {
|
|
255
|
-
assert.equal(data.contentType, 'STRING');
|
|
256
|
-
assert.equal(
|
|
257
|
-
data.payload.msg,
|
|
258
|
-
`first message for ${board.channelId} ${uniqueRealtimeData}`
|
|
259
|
-
);
|
|
260
|
-
receivedFirstMsg = true;
|
|
261
|
-
if (receivedFirstMsg && receivedSecondMsg) {
|
|
262
|
-
done();
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
mccoyRealtimeChannel1.once('event:board.activity', ({data}) => {
|
|
267
|
-
assert.equal(data.contentType, 'STRING');
|
|
268
|
-
assert.equal(
|
|
269
|
-
data.payload.msg,
|
|
270
|
-
`second message for ${secondBoard.channelId} ${uniqueRealtimeData}`
|
|
271
|
-
);
|
|
272
|
-
receivedSecondMsg = true;
|
|
273
|
-
if (receivedFirstMsg && receivedSecondMsg) {
|
|
274
|
-
done();
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
Promise.all([
|
|
279
|
-
spock.webex.internal.board.realtime.publish(board, data1),
|
|
280
|
-
spock.webex.internal.board.realtime.publish(secondBoard, data2),
|
|
281
|
-
]);
|
|
282
|
-
});
|
|
283
|
-
});
|
|
284
|
-
});
|
|
285
|
-
});
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import '@webex/internal-plugin-board';
|
|
6
|
+
|
|
7
|
+
import {assert} from '@webex/test-helper-chai';
|
|
8
|
+
import {maxWaitForEvent} from '@webex/test-helper-mocha';
|
|
9
|
+
import WebexCore from '@webex/webex-core';
|
|
10
|
+
import testUsers from '@webex/test-helper-test-users';
|
|
11
|
+
import uuid from 'uuid';
|
|
12
|
+
import promiseSeries from 'es6-promise-series';
|
|
13
|
+
|
|
14
|
+
describe.skip('plugin-board', () => {
|
|
15
|
+
describe('realtime - sharing mercury', () => {
|
|
16
|
+
let board, conversation, participants, secondBoard;
|
|
17
|
+
let mccoy, spock;
|
|
18
|
+
let uniqueRealtimeData;
|
|
19
|
+
|
|
20
|
+
before('create users', () =>
|
|
21
|
+
testUsers.create({count: 2}).then((users) => {
|
|
22
|
+
participants = [spock, mccoy] = users;
|
|
23
|
+
|
|
24
|
+
return Promise.all(
|
|
25
|
+
participants.map((participant) => {
|
|
26
|
+
participant.webex = new WebexCore({
|
|
27
|
+
credentials: {
|
|
28
|
+
authorization: participant.token,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return participant.webex.internal.device
|
|
33
|
+
.register()
|
|
34
|
+
.then(() =>
|
|
35
|
+
participant.webex.internal.feature.setFeature(
|
|
36
|
+
'developer',
|
|
37
|
+
'web-shared-mercury',
|
|
38
|
+
true
|
|
39
|
+
)
|
|
40
|
+
);
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
})
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
before('create conversation', () =>
|
|
47
|
+
spock.webex.internal.conversation
|
|
48
|
+
.create({
|
|
49
|
+
displayName: 'Test Board Mercury',
|
|
50
|
+
participants,
|
|
51
|
+
})
|
|
52
|
+
.then((c) => {
|
|
53
|
+
conversation = c;
|
|
54
|
+
|
|
55
|
+
return conversation;
|
|
56
|
+
})
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
before('create channel (board)', () =>
|
|
60
|
+
spock.webex.internal.board.createChannel(conversation).then((channel) => {
|
|
61
|
+
board = channel;
|
|
62
|
+
|
|
63
|
+
return channel;
|
|
64
|
+
})
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
before('create second channel (board)', () =>
|
|
68
|
+
mccoy.webex.internal.board.createChannel(conversation).then((channel) => {
|
|
69
|
+
secondBoard = channel;
|
|
70
|
+
|
|
71
|
+
return channel;
|
|
72
|
+
})
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
beforeEach('connect to mercury channel', () =>
|
|
76
|
+
Promise.all(participants.map((participant) => participant.webex.internal.mercury.connect()))
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
afterEach('disconnect mercury', () =>
|
|
80
|
+
Promise.all(
|
|
81
|
+
participants.map((participant) => participant.webex.internal.mercury.disconnect())
|
|
82
|
+
)
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
describe('#publish()', () => {
|
|
86
|
+
describe('string payload', () => {
|
|
87
|
+
let spockRealtimeChannel;
|
|
88
|
+
let mccoyRealtimeChannel;
|
|
89
|
+
|
|
90
|
+
before('open two connections', () =>
|
|
91
|
+
Promise.all([
|
|
92
|
+
spock.webex.internal.board.realtime.connectToSharedMercury(board),
|
|
93
|
+
mccoy.webex.internal.board.realtime.connectByOpenNewMercuryConnection(board),
|
|
94
|
+
])
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
before('get realtime channels', () => {
|
|
98
|
+
spockRealtimeChannel = spock.webex.internal.board.realtime.realtimeChannels.get(
|
|
99
|
+
board.channelId
|
|
100
|
+
);
|
|
101
|
+
mccoyRealtimeChannel = mccoy.webex.internal.board.realtime.realtimeChannels.get(
|
|
102
|
+
board.channelId
|
|
103
|
+
);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
after(() =>
|
|
107
|
+
Promise.all(
|
|
108
|
+
participants.map((participant) =>
|
|
109
|
+
participant.webex.internal.board.realtime.disconnectFromSharedMercury(board)
|
|
110
|
+
)
|
|
111
|
+
)
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
it('posts a message from shared connection to the specified board', () => {
|
|
115
|
+
uniqueRealtimeData = uuid.v4();
|
|
116
|
+
const data = {
|
|
117
|
+
envelope: {
|
|
118
|
+
channelId: board,
|
|
119
|
+
roomId: conversation.id,
|
|
120
|
+
},
|
|
121
|
+
payload: {
|
|
122
|
+
msg: uniqueRealtimeData,
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// confirm that both are connected.
|
|
127
|
+
assert.isTrue(
|
|
128
|
+
spockRealtimeChannel.isSharingMercury,
|
|
129
|
+
'spock is sharing mercury connection'
|
|
130
|
+
);
|
|
131
|
+
assert.isTrue(spock.webex.internal.mercury.connected, 'spock is connected');
|
|
132
|
+
assert.isFalse(
|
|
133
|
+
mccoyRealtimeChannel.isSharingMercury,
|
|
134
|
+
'mccoy should not share mercury connection'
|
|
135
|
+
);
|
|
136
|
+
assert.isTrue(mccoy.webex.internal.mercury.connected, 'mccoy is connected');
|
|
137
|
+
|
|
138
|
+
spock.webex.internal.board.realtime.publish(board, data);
|
|
139
|
+
|
|
140
|
+
// mccoy listens and verifies data received
|
|
141
|
+
return maxWaitForEvent(5000, 'event:board.activity', mccoyRealtimeChannel).then(
|
|
142
|
+
({data}) => {
|
|
143
|
+
assert.equal(data.contentType, 'STRING');
|
|
144
|
+
assert.equal(data.payload.msg, uniqueRealtimeData);
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('posts a message from separated socket connection to the specified board', () => {
|
|
150
|
+
uniqueRealtimeData = uuid.v4();
|
|
151
|
+
const data = {
|
|
152
|
+
envelope: {
|
|
153
|
+
channelId: board,
|
|
154
|
+
roomId: conversation.id,
|
|
155
|
+
},
|
|
156
|
+
payload: {
|
|
157
|
+
msg: uniqueRealtimeData,
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
assert.isTrue(spock.webex.internal.mercury.connected, 'spock is connected');
|
|
162
|
+
assert.isTrue(
|
|
163
|
+
spockRealtimeChannel.isSharingMercury,
|
|
164
|
+
'spock is sharing mercury connection'
|
|
165
|
+
);
|
|
166
|
+
assert.isTrue(mccoy.webex.internal.mercury.connected, 'mccoy is connected');
|
|
167
|
+
assert.isFalse(
|
|
168
|
+
mccoyRealtimeChannel.isSharingMercury,
|
|
169
|
+
'mccoy does not share mercury connection'
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
mccoy.webex.internal.board.realtime.publish(board, data);
|
|
173
|
+
|
|
174
|
+
return maxWaitForEvent(5000, 'event:board.activity', spockRealtimeChannel).then(
|
|
175
|
+
({data}) => {
|
|
176
|
+
assert.equal(data.contentType, 'STRING');
|
|
177
|
+
assert.equal(data.payload.msg, uniqueRealtimeData);
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
describe('multiple boards sharing a connection', () => {
|
|
185
|
+
beforeEach(() => {
|
|
186
|
+
uniqueRealtimeData = uuid.v4();
|
|
187
|
+
|
|
188
|
+
return promiseSeries([
|
|
189
|
+
spock.webex.internal.board.realtime.connectToSharedMercury.bind(
|
|
190
|
+
spock.webex.internal.board.realtime,
|
|
191
|
+
board
|
|
192
|
+
),
|
|
193
|
+
mccoy.webex.internal.board.realtime.connectToSharedMercury.bind(
|
|
194
|
+
mccoy.webex.internal.board.realtime,
|
|
195
|
+
board
|
|
196
|
+
),
|
|
197
|
+
spock.webex.internal.board.realtime.connectToSharedMercury.bind(
|
|
198
|
+
spock.webex.internal.board.realtime,
|
|
199
|
+
secondBoard
|
|
200
|
+
),
|
|
201
|
+
mccoy.webex.internal.board.realtime.connectToSharedMercury.bind(
|
|
202
|
+
mccoy.webex.internal.board.realtime,
|
|
203
|
+
secondBoard
|
|
204
|
+
),
|
|
205
|
+
]);
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
afterEach(() =>
|
|
209
|
+
Promise.all(
|
|
210
|
+
participants.map((participant) =>
|
|
211
|
+
promiseSeries([
|
|
212
|
+
participant.webex.internal.board.realtime.disconnectFromSharedMercury.bind(
|
|
213
|
+
participant.webex.internal.board.realtime,
|
|
214
|
+
board
|
|
215
|
+
),
|
|
216
|
+
participant.webex.internal.board.realtime.disconnectFromSharedMercury.bind(
|
|
217
|
+
participant.webex.internal.board.realtime,
|
|
218
|
+
secondBoard
|
|
219
|
+
),
|
|
220
|
+
])
|
|
221
|
+
)
|
|
222
|
+
)
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
it('receives correct message for the corresponding board', (done) => {
|
|
226
|
+
const data1 = {
|
|
227
|
+
envelope: {
|
|
228
|
+
channelId: board,
|
|
229
|
+
roomId: conversation.id,
|
|
230
|
+
},
|
|
231
|
+
payload: {
|
|
232
|
+
msg: `first message for ${board.channelId} ${uniqueRealtimeData}`,
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
const data2 = {
|
|
236
|
+
envelope: {
|
|
237
|
+
channelId: secondBoard,
|
|
238
|
+
roomId: conversation.id,
|
|
239
|
+
},
|
|
240
|
+
payload: {
|
|
241
|
+
msg: `second message for ${secondBoard.channelId} ${uniqueRealtimeData}`,
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
let receivedFirstMsg = false;
|
|
246
|
+
let receivedSecondMsg = false;
|
|
247
|
+
const mccoyRealtimeChannel0 = mccoy.webex.internal.board.realtime.realtimeChannels.get(
|
|
248
|
+
board.channelId
|
|
249
|
+
);
|
|
250
|
+
const mccoyRealtimeChannel1 = mccoy.webex.internal.board.realtime.realtimeChannels.get(
|
|
251
|
+
secondBoard.channelId
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
mccoyRealtimeChannel0.once('event:board.activity', ({data}) => {
|
|
255
|
+
assert.equal(data.contentType, 'STRING');
|
|
256
|
+
assert.equal(
|
|
257
|
+
data.payload.msg,
|
|
258
|
+
`first message for ${board.channelId} ${uniqueRealtimeData}`
|
|
259
|
+
);
|
|
260
|
+
receivedFirstMsg = true;
|
|
261
|
+
if (receivedFirstMsg && receivedSecondMsg) {
|
|
262
|
+
done();
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
mccoyRealtimeChannel1.once('event:board.activity', ({data}) => {
|
|
267
|
+
assert.equal(data.contentType, 'STRING');
|
|
268
|
+
assert.equal(
|
|
269
|
+
data.payload.msg,
|
|
270
|
+
`second message for ${secondBoard.channelId} ${uniqueRealtimeData}`
|
|
271
|
+
);
|
|
272
|
+
receivedSecondMsg = true;
|
|
273
|
+
if (receivedFirstMsg && receivedSecondMsg) {
|
|
274
|
+
done();
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
Promise.all([
|
|
279
|
+
spock.webex.internal.board.realtime.publish(board, data1),
|
|
280
|
+
spock.webex.internal.board.realtime.publish(secondBoard, data2),
|
|
281
|
+
]);
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
});
|