@webex/internal-plugin-board 3.0.0-beta.9 → 3.0.0-bnr.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -3
- package/dist/board.js +28 -108
- package/dist/board.js.map +1 -1
- package/dist/config.js +0 -8
- package/dist/config.js.map +1 -1
- package/dist/index.js +7 -28
- package/dist/index.js.map +1 -1
- package/dist/realtime-channel-collection.js +2 -8
- package/dist/realtime-channel-collection.js.map +1 -1
- package/dist/realtime-channel.js +1 -5
- package/dist/realtime-channel.js.map +1 -1
- package/dist/realtime.js +38 -82
- package/dist/realtime.js.map +1 -1
- package/dist/types/board.d.ts +2 -0
- package/dist/types/config.d.ts +11 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/realtime-channel-collection.d.ts +2 -0
- package/dist/types/realtime-channel.d.ts +2 -0
- package/dist/types/realtime.d.ts +7 -0
- package/package.json +14 -14
- package/src/board.js +257 -205
- package/src/config.js +2 -2
- package/src/index.js +19 -21
- package/src/realtime-channel-collection.js +2 -2
- package/src/realtime-channel.js +8 -9
- package/src/realtime.js +109 -93
- package/test/integration/spec/board.js +347 -221
- package/test/integration/spec/realtime.js +82 -56
- package/test/integration/spec/sharing-mercury.js +154 -73
- package/test/unit/spec/board.js +301 -215
- package/test/unit/spec/encryption.js +152 -120
- package/test/unit/spec/realtime.js +131 -89
|
@@ -18,7 +18,7 @@ function generateTonsOfContents(numOfContents) {
|
|
|
18
18
|
for (let i = 0; i < numOfContents; i += 1) {
|
|
19
19
|
contents.push({
|
|
20
20
|
type: 'curve',
|
|
21
|
-
payload: JSON.stringify({id: i, type: 'curve'})
|
|
21
|
+
payload: JSON.stringify({id: i, type: 'curve'}),
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
resolve(contents);
|
|
@@ -29,51 +29,66 @@ describe('plugin-board', () => {
|
|
|
29
29
|
describe('service', () => {
|
|
30
30
|
let board, conversation, fixture, participants;
|
|
31
31
|
|
|
32
|
-
before('create users', () =>
|
|
33
|
-
.then((users) => {
|
|
32
|
+
before('create users', () =>
|
|
33
|
+
testUsers.create({count: 3}).then((users) => {
|
|
34
34
|
participants = users;
|
|
35
35
|
|
|
36
|
-
return Promise.all(
|
|
37
|
-
participant
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
36
|
+
return Promise.all(
|
|
37
|
+
map(participants, (participant) => {
|
|
38
|
+
participant.webex = new WebexCore({
|
|
39
|
+
credentials: {
|
|
40
|
+
authorization: participant.token,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
return participant.webex.internal.device
|
|
45
|
+
.register()
|
|
46
|
+
.then(() =>
|
|
47
|
+
participant.webex.internal.feature.setFeature('developer', 'files-acl-write', true)
|
|
48
|
+
);
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
})
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
before('create conversation', () =>
|
|
55
|
+
participants[0].webex.internal.conversation
|
|
56
|
+
.create({
|
|
57
|
+
displayName: 'Test Board Conversation',
|
|
58
|
+
participants,
|
|
59
|
+
})
|
|
60
|
+
.then((c) => {
|
|
61
|
+
conversation = c;
|
|
54
62
|
|
|
55
|
-
|
|
56
|
-
|
|
63
|
+
return conversation;
|
|
64
|
+
})
|
|
65
|
+
);
|
|
57
66
|
|
|
58
|
-
before('create channel (board)', () =>
|
|
59
|
-
.then((channel) => {
|
|
67
|
+
before('create channel (board)', () =>
|
|
68
|
+
participants[0].webex.internal.board.createChannel(conversation).then((channel) => {
|
|
60
69
|
board = channel;
|
|
61
70
|
|
|
62
71
|
return channel;
|
|
63
|
-
})
|
|
72
|
+
})
|
|
73
|
+
);
|
|
64
74
|
|
|
65
|
-
before('load fixture image', () =>
|
|
66
|
-
.then((fetchedFixture) => {
|
|
75
|
+
before('load fixture image', () =>
|
|
76
|
+
fh.fetch('sample-image-small-one.png').then((fetchedFixture) => {
|
|
67
77
|
fixture = fetchedFixture;
|
|
68
78
|
|
|
69
79
|
return fetchedFixture;
|
|
70
|
-
})
|
|
80
|
+
})
|
|
81
|
+
);
|
|
71
82
|
|
|
72
|
-
after('disconnect mercury', () =>
|
|
83
|
+
after('disconnect mercury', () =>
|
|
84
|
+
Promise.all(
|
|
85
|
+
map(participants, (participant) => participant.webex.internal.mercury.disconnect())
|
|
86
|
+
)
|
|
87
|
+
);
|
|
73
88
|
|
|
74
89
|
describe('#getChannel', () => {
|
|
75
|
-
it('gets the channel metadata', () =>
|
|
76
|
-
.then((channel) => {
|
|
90
|
+
it('gets the channel metadata', () =>
|
|
91
|
+
participants[0].webex.internal.board.getChannel(board).then((channel) => {
|
|
77
92
|
assert.property(channel, 'kmsResourceUrl');
|
|
78
93
|
assert.property(channel, 'aclUrl');
|
|
79
94
|
|
|
@@ -81,17 +96,25 @@ describe('plugin-board', () => {
|
|
|
81
96
|
assert.equal(channel.aclUrlLink, conversation.aclUrl);
|
|
82
97
|
assert.notEqual(channel.kmsResourceUrl, conversation.kmsResourceObjectUrl);
|
|
83
98
|
assert.notEqual(channel.aclUrl, conversation.aclUrl);
|
|
84
|
-
assert.notEqual(
|
|
99
|
+
assert.notEqual(
|
|
100
|
+
channel.defaultEncryptionKeyUrl,
|
|
101
|
+
conversation.defaultActivityEncryptionKeyUrl
|
|
102
|
+
);
|
|
85
103
|
}));
|
|
86
104
|
});
|
|
87
105
|
|
|
88
106
|
describe('#_uploadImage()', () => {
|
|
89
107
|
after(() => participants[0].webex.internal.board.deleteAllContent(board));
|
|
90
108
|
|
|
91
|
-
it('uploads image to webex files', () =>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
.then((
|
|
109
|
+
it('uploads image to webex files', () =>
|
|
110
|
+
participants[0].webex.internal.board
|
|
111
|
+
._uploadImage(board, fixture)
|
|
112
|
+
.then((scr) => participants[1].webex.internal.encryption.download(scr))
|
|
113
|
+
.then((downloadedFile) =>
|
|
114
|
+
fh
|
|
115
|
+
.isMatchingFile(downloadedFile, fixture)
|
|
116
|
+
.then((result) => assert.deepEqual(result, true))
|
|
117
|
+
));
|
|
95
118
|
});
|
|
96
119
|
|
|
97
120
|
describe('#setSnapshotImage()', () => {
|
|
@@ -100,7 +123,8 @@ describe('plugin-board', () => {
|
|
|
100
123
|
it('uploads image to webex files and adds to channel', () => {
|
|
101
124
|
let imageRes;
|
|
102
125
|
|
|
103
|
-
return participants[0].webex.internal.board
|
|
126
|
+
return participants[0].webex.internal.board
|
|
127
|
+
.setSnapshotImage(board, fixture)
|
|
104
128
|
.then((res) => {
|
|
105
129
|
imageRes = res.image;
|
|
106
130
|
assert.isDefined(res.image, 'image field is included');
|
|
@@ -113,11 +137,15 @@ describe('plugin-board', () => {
|
|
|
113
137
|
assert.deepEqual(imageRes, res.image);
|
|
114
138
|
|
|
115
139
|
// ensure others can download the image
|
|
116
|
-
return participants[2].webex.internal.encryption.decryptScr(
|
|
140
|
+
return participants[2].webex.internal.encryption.decryptScr(
|
|
141
|
+
board.defaultEncryptionKeyUrl,
|
|
142
|
+
res.image.scr
|
|
143
|
+
);
|
|
117
144
|
})
|
|
118
145
|
.then((decryptedScr) => participants[2].webex.internal.encryption.download(decryptedScr))
|
|
119
|
-
.then((file) =>
|
|
120
|
-
.then((result) => assert.deepEqual(result, true))
|
|
146
|
+
.then((file) =>
|
|
147
|
+
fh.isMatchingFile(file, fixture).then((result) => assert.deepEqual(result, true))
|
|
148
|
+
);
|
|
121
149
|
});
|
|
122
150
|
});
|
|
123
151
|
|
|
@@ -130,19 +158,25 @@ describe('plugin-board', () => {
|
|
|
130
158
|
|
|
131
159
|
after(() => participants[0].webex.internal.board.deleteAllContent(board));
|
|
132
160
|
|
|
133
|
-
it('uploads image to webex files', () =>
|
|
134
|
-
.
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
161
|
+
it('uploads image to webex files', () =>
|
|
162
|
+
participants[0].webex.internal.board
|
|
163
|
+
.addImage(board, fixture, {displayName: fixture.name})
|
|
164
|
+
.then((fileContent) => {
|
|
165
|
+
testContent = fileContent[0].items[0];
|
|
166
|
+
assert.equal(testContent.type, 'FILE', 'content type should be image');
|
|
167
|
+
assert.property(testContent, 'contentUrl', 'content should contain contentId property');
|
|
168
|
+
assert.property(
|
|
169
|
+
testContent,
|
|
170
|
+
'channelUrl',
|
|
171
|
+
'content should contain contentUrl property'
|
|
172
|
+
);
|
|
173
|
+
assert.property(testContent, 'metadata', 'content should contain metadata property');
|
|
174
|
+
assert.property(testContent, 'file', 'content should contain file property');
|
|
175
|
+
assert.property(testContent.file, 'scr', 'content file should contain scr property');
|
|
176
|
+
}));
|
|
143
177
|
|
|
144
|
-
it('adds to presistence', () =>
|
|
145
|
-
.then((allContents) => {
|
|
178
|
+
it('adds to presistence', () =>
|
|
179
|
+
participants[0].webex.internal.board.getContents(board).then((allContents) => {
|
|
146
180
|
const imageContent = find(allContents.items, {contentId: testContent.contentId});
|
|
147
181
|
|
|
148
182
|
assert.isDefined(imageContent);
|
|
@@ -154,13 +188,23 @@ describe('plugin-board', () => {
|
|
|
154
188
|
return imageContent.file.scr;
|
|
155
189
|
}));
|
|
156
190
|
|
|
157
|
-
it('matches file file downloaded', () =>
|
|
158
|
-
.
|
|
159
|
-
.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
191
|
+
it('matches file file downloaded', () =>
|
|
192
|
+
participants[0].webex.internal.encryption
|
|
193
|
+
.download(testScr)
|
|
194
|
+
.then((downloadedFile) =>
|
|
195
|
+
fh
|
|
196
|
+
.isMatchingFile(downloadedFile, fixture)
|
|
197
|
+
.then((result) => assert.deepEqual(result, true))
|
|
198
|
+
));
|
|
199
|
+
|
|
200
|
+
it('allows others to download image', () =>
|
|
201
|
+
participants[2].webex.internal.encryption
|
|
202
|
+
.download(testScr)
|
|
203
|
+
.then((downloadedFile) =>
|
|
204
|
+
fh
|
|
205
|
+
.isMatchingFile(downloadedFile, fixture)
|
|
206
|
+
.then((result) => assert.deepEqual(result, true))
|
|
207
|
+
));
|
|
164
208
|
|
|
165
209
|
describe('when image content has no metadata', () => {
|
|
166
210
|
before(() => participants[0].webex.internal.board.deleteAllContent(board));
|
|
@@ -168,12 +212,21 @@ describe('plugin-board', () => {
|
|
|
168
212
|
it('decrypts no meta', () => {
|
|
169
213
|
let testContent, testScr;
|
|
170
214
|
|
|
171
|
-
return participants[0].webex.internal.board
|
|
215
|
+
return participants[0].webex.internal.board
|
|
216
|
+
.addImage(board, fixture)
|
|
172
217
|
.then((fileContent) => {
|
|
173
218
|
testContent = fileContent[0].items[0];
|
|
174
219
|
assert.equal(testContent.type, 'FILE', 'content type should be image');
|
|
175
|
-
assert.property(
|
|
176
|
-
|
|
220
|
+
assert.property(
|
|
221
|
+
testContent,
|
|
222
|
+
'contentUrl',
|
|
223
|
+
'content should contain contentId property'
|
|
224
|
+
);
|
|
225
|
+
assert.property(
|
|
226
|
+
testContent,
|
|
227
|
+
'channelUrl',
|
|
228
|
+
'content should contain contentUrl property'
|
|
229
|
+
);
|
|
177
230
|
assert.property(testContent, 'file', 'content should contain file property');
|
|
178
231
|
assert.property(testContent.file, 'scr', 'content file should contain scr property');
|
|
179
232
|
assert.deepEqual(testContent.metadata, {});
|
|
@@ -190,16 +243,19 @@ describe('plugin-board', () => {
|
|
|
190
243
|
|
|
191
244
|
return imageContent.file.scr;
|
|
192
245
|
})
|
|
193
|
-
.then(() =>
|
|
194
|
-
.
|
|
195
|
-
|
|
246
|
+
.then(() =>
|
|
247
|
+
participants[0].webex.internal.encryption
|
|
248
|
+
.download(testScr)
|
|
249
|
+
.then((downloadedFile) => fh.isMatchingFile(downloadedFile, fixture))
|
|
250
|
+
.then((res) => assert.isTrue(res))
|
|
251
|
+
);
|
|
196
252
|
});
|
|
197
253
|
});
|
|
198
254
|
});
|
|
199
255
|
|
|
200
256
|
describe('#getChannels()', () => {
|
|
201
|
-
it('retrieves a newly created board for a specified conversation within a single page', () =>
|
|
202
|
-
.then((getChannelsResp) => {
|
|
257
|
+
it('retrieves a newly created board for a specified conversation within a single page', () =>
|
|
258
|
+
participants[0].webex.internal.board.getChannels(conversation).then((getChannelsResp) => {
|
|
203
259
|
const channelFound = find(getChannelsResp.items, {channelId: board.channelId});
|
|
204
260
|
|
|
205
261
|
assert.isDefined(channelFound);
|
|
@@ -209,11 +265,14 @@ describe('plugin-board', () => {
|
|
|
209
265
|
it('retrieves annotated board', () => {
|
|
210
266
|
let annotatedBoard;
|
|
211
267
|
|
|
212
|
-
return participants[0].webex.internal.board
|
|
268
|
+
return participants[0].webex.internal.board
|
|
269
|
+
.createChannel(conversation, {type: 'annotated'})
|
|
213
270
|
.then((res) => {
|
|
214
271
|
annotatedBoard = res;
|
|
215
272
|
|
|
216
|
-
return participants[0].webex.internal.board.getChannels(conversation, {
|
|
273
|
+
return participants[0].webex.internal.board.getChannels(conversation, {
|
|
274
|
+
type: 'annotated',
|
|
275
|
+
});
|
|
217
276
|
})
|
|
218
277
|
.then((getChannelsResp) => {
|
|
219
278
|
const channelFound = find(getChannelsResp.items, {channelId: annotatedBoard.channelId});
|
|
@@ -231,59 +290,63 @@ describe('plugin-board', () => {
|
|
|
231
290
|
let channelsReceived = [];
|
|
232
291
|
let convo;
|
|
233
292
|
|
|
234
|
-
return
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
293
|
+
return (
|
|
294
|
+
participants[0].webex.internal.conversation
|
|
295
|
+
.create({
|
|
296
|
+
displayName: `Test Get Channels Conversation ${uuid.v4()}`,
|
|
297
|
+
participants,
|
|
298
|
+
})
|
|
299
|
+
.then((c) => {
|
|
300
|
+
convo = c;
|
|
301
|
+
const promises = [];
|
|
302
|
+
|
|
303
|
+
for (let i = 0; i < numChannelsToAdd; i += 1) {
|
|
304
|
+
promises.push(
|
|
305
|
+
participants[0].webex.internal.board.createChannel(convo).then((channel) => {
|
|
306
|
+
Reflect.deleteProperty(channel, 'kmsMessage');
|
|
307
|
+
channelsCreated.push(channel);
|
|
308
|
+
})
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return Promise.all(promises);
|
|
313
|
+
})
|
|
314
|
+
// get boards, page 1
|
|
315
|
+
.then(() =>
|
|
316
|
+
participants[0].webex.internal.board.getChannels(convo, {
|
|
317
|
+
channelsLimit: pageLimit,
|
|
318
|
+
})
|
|
319
|
+
)
|
|
320
|
+
// get boards, page 2
|
|
321
|
+
.then((channelPage) => {
|
|
322
|
+
assert.lengthOf(channelPage.items, pageLimit);
|
|
323
|
+
assert.isTrue(channelPage.hasNext());
|
|
324
|
+
channelsReceived = channelsReceived.concat(channelPage.items);
|
|
325
|
+
|
|
326
|
+
return channelPage.next();
|
|
327
|
+
})
|
|
328
|
+
// get boards, page 3
|
|
329
|
+
.then((channelPage) => {
|
|
330
|
+
assert.lengthOf(channelPage.items, pageLimit);
|
|
331
|
+
assert.isTrue(channelPage.hasNext());
|
|
332
|
+
channelsReceived = channelsReceived.concat(channelPage.items);
|
|
269
333
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
});
|
|
334
|
+
return channelPage.next();
|
|
335
|
+
})
|
|
336
|
+
.then((channelPage) => {
|
|
337
|
+
assert.lengthOf(channelPage, 2);
|
|
338
|
+
assert.isFalse(channelPage.hasNext());
|
|
339
|
+
channelsReceived = channelsReceived.concat(channelPage.items);
|
|
340
|
+
|
|
341
|
+
if (channelsCreated.length === channelsReceived.length) {
|
|
342
|
+
channelsReceived.forEach((received) => {
|
|
343
|
+
const created = channelsCreated.find((channel) => channel.channelId === received.channelId);
|
|
344
|
+
|
|
345
|
+
assert.deepEqual(received, created);
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
})
|
|
349
|
+
);
|
|
287
350
|
});
|
|
288
351
|
});
|
|
289
352
|
|
|
@@ -292,12 +355,15 @@ describe('plugin-board', () => {
|
|
|
292
355
|
|
|
293
356
|
it('adds and gets contents from the specified board', () => {
|
|
294
357
|
const contents = [{type: 'curve'}];
|
|
295
|
-
const data = [
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
358
|
+
const data = [
|
|
359
|
+
{
|
|
360
|
+
type: contents[0].type,
|
|
361
|
+
payload: JSON.stringify(contents[0]),
|
|
362
|
+
},
|
|
363
|
+
];
|
|
299
364
|
|
|
300
|
-
return participants[0].webex.internal.board
|
|
365
|
+
return participants[0].webex.internal.board
|
|
366
|
+
.deleteAllContent(board)
|
|
301
367
|
.then(() => participants[0].webex.internal.board.addContent(board, data))
|
|
302
368
|
.then(() => participants[0].webex.internal.board.getContents(board))
|
|
303
369
|
.then((contentPage) => {
|
|
@@ -310,12 +376,15 @@ describe('plugin-board', () => {
|
|
|
310
376
|
|
|
311
377
|
it('allows other people to read contents', () => {
|
|
312
378
|
const contents = [{type: 'curve', points: [1, 2, 3, 4]}];
|
|
313
|
-
const data = [
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
379
|
+
const data = [
|
|
380
|
+
{
|
|
381
|
+
type: contents[0].type,
|
|
382
|
+
payload: JSON.stringify(contents[0]),
|
|
383
|
+
},
|
|
384
|
+
];
|
|
317
385
|
|
|
318
|
-
return participants[0].webex.internal.board
|
|
386
|
+
return participants[0].webex.internal.board
|
|
387
|
+
.addContent(board, data)
|
|
319
388
|
.then(() => participants[1].webex.internal.board.getContents(board))
|
|
320
389
|
.then((contentPage) => {
|
|
321
390
|
assert.equal(contentPage.length, data.length);
|
|
@@ -331,12 +400,15 @@ describe('plugin-board', () => {
|
|
|
331
400
|
|
|
332
401
|
it('allows other people to write contents', () => {
|
|
333
402
|
const contents = [{type: 'curve', points: [1, 2, 3, 4]}];
|
|
334
|
-
const data = [
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
403
|
+
const data = [
|
|
404
|
+
{
|
|
405
|
+
type: contents[0].type,
|
|
406
|
+
payload: JSON.stringify(contents[0]),
|
|
407
|
+
},
|
|
408
|
+
];
|
|
338
409
|
|
|
339
|
-
return participants[2].webex.internal.board
|
|
410
|
+
return participants[2].webex.internal.board
|
|
411
|
+
.addContent(board, data)
|
|
340
412
|
.then(() => participants[1].webex.internal.board.getContents(board))
|
|
341
413
|
.then((contentPage) => {
|
|
342
414
|
assert.equal(contentPage.length, data.length);
|
|
@@ -348,15 +420,18 @@ describe('plugin-board', () => {
|
|
|
348
420
|
const numberOfContents = 30;
|
|
349
421
|
let tonsOfContents;
|
|
350
422
|
|
|
351
|
-
before('generate contents', () =>
|
|
352
|
-
.then((res) => {
|
|
423
|
+
before('generate contents', () =>
|
|
424
|
+
generateTonsOfContents(numberOfContents).then((res) => {
|
|
353
425
|
tonsOfContents = res;
|
|
354
|
-
})
|
|
426
|
+
})
|
|
427
|
+
);
|
|
355
428
|
|
|
356
|
-
beforeEach('create contents', () =>
|
|
429
|
+
beforeEach('create contents', () =>
|
|
430
|
+
participants[0].webex.internal.board.addContent(board, tonsOfContents)
|
|
431
|
+
);
|
|
357
432
|
|
|
358
|
-
it('using the default page limit', () =>
|
|
359
|
-
.then((res) => {
|
|
433
|
+
it('using the default page limit', () =>
|
|
434
|
+
participants[0].webex.internal.board.getContents(board).then((res) => {
|
|
360
435
|
assert.lengthOf(res, numberOfContents);
|
|
361
436
|
assert.isFalse(res.hasNext());
|
|
362
437
|
|
|
@@ -365,17 +440,19 @@ describe('plugin-board', () => {
|
|
|
365
440
|
}
|
|
366
441
|
}));
|
|
367
442
|
|
|
368
|
-
it('using a client defined page limit', () =>
|
|
369
|
-
.
|
|
370
|
-
|
|
371
|
-
|
|
443
|
+
it('using a client defined page limit', () =>
|
|
444
|
+
participants[0].webex.internal.board
|
|
445
|
+
.getContents(board, {contentsLimit: 25})
|
|
446
|
+
.then((res) => {
|
|
447
|
+
assert.lengthOf(res, 25);
|
|
448
|
+
assert.isTrue(res.hasNext());
|
|
372
449
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
450
|
+
return res.next();
|
|
451
|
+
})
|
|
452
|
+
.then((res) => {
|
|
453
|
+
assert.lengthOf(res, numberOfContents - 25);
|
|
454
|
+
assert.isFalse(res.hasNext());
|
|
455
|
+
}));
|
|
379
456
|
});
|
|
380
457
|
});
|
|
381
458
|
|
|
@@ -387,25 +464,26 @@ describe('plugin-board', () => {
|
|
|
387
464
|
const contents = [
|
|
388
465
|
{
|
|
389
466
|
id: uuid.v4(),
|
|
390
|
-
type: 'file'
|
|
467
|
+
type: 'file',
|
|
391
468
|
},
|
|
392
469
|
{
|
|
393
470
|
id: uuid.v4(),
|
|
394
|
-
type: 'string'
|
|
395
|
-
}
|
|
471
|
+
type: 'string',
|
|
472
|
+
},
|
|
396
473
|
];
|
|
397
474
|
const data = [
|
|
398
475
|
{
|
|
399
476
|
type: contents[0].type,
|
|
400
|
-
payload: JSON.stringify(contents[0])
|
|
477
|
+
payload: JSON.stringify(contents[0]),
|
|
401
478
|
},
|
|
402
479
|
{
|
|
403
480
|
type: contents[1].type,
|
|
404
|
-
payload: JSON.stringify(contents[1])
|
|
405
|
-
}
|
|
481
|
+
payload: JSON.stringify(contents[1]),
|
|
482
|
+
},
|
|
406
483
|
];
|
|
407
484
|
|
|
408
|
-
return participants[0].webex.internal.board
|
|
485
|
+
return participants[0].webex.internal.board
|
|
486
|
+
.addContent(channel, data)
|
|
409
487
|
.then(() => participants[0].webex.internal.board.deleteAllContent(channel))
|
|
410
488
|
.then(() => participants[0].webex.internal.board.getContents(channel))
|
|
411
489
|
.then((res) => {
|
|
@@ -416,7 +494,8 @@ describe('plugin-board', () => {
|
|
|
416
494
|
});
|
|
417
495
|
});
|
|
418
496
|
|
|
419
|
-
|
|
497
|
+
// THE SERVICE API FOR REMOVING PARTIAL CONTENT HAS CHANGED. SEE SPARK-412694.
|
|
498
|
+
describe.skip('#deletePartialContent()', () => {
|
|
420
499
|
after(() => participants[0].webex.internal.board.deleteAllContent(board));
|
|
421
500
|
|
|
422
501
|
it('deletes some contents from the specified board', () => {
|
|
@@ -424,20 +503,23 @@ describe('plugin-board', () => {
|
|
|
424
503
|
const data = [
|
|
425
504
|
{
|
|
426
505
|
type: 'STRING',
|
|
427
|
-
payload: JSON.stringify({id: uuid.v4()})
|
|
506
|
+
payload: JSON.stringify({id: uuid.v4()}),
|
|
428
507
|
},
|
|
429
508
|
{
|
|
430
509
|
type: 'FILE',
|
|
431
|
-
payload: JSON.stringify({id: uuid.v4()})
|
|
432
|
-
}
|
|
510
|
+
payload: JSON.stringify({id: uuid.v4()}),
|
|
511
|
+
},
|
|
433
512
|
];
|
|
434
513
|
const contentsToKeep = [];
|
|
435
514
|
|
|
436
|
-
return participants[0].webex.internal.board
|
|
515
|
+
return participants[0].webex.internal.board
|
|
516
|
+
.addContent(channel, data)
|
|
437
517
|
.then(([firstPageRes]) => {
|
|
438
518
|
contentsToKeep.push(firstPageRes.items[1]);
|
|
439
519
|
})
|
|
440
|
-
.then(() =>
|
|
520
|
+
.then(() =>
|
|
521
|
+
participants[0].webex.internal.board.deletePartialContent(channel, contentsToKeep)
|
|
522
|
+
)
|
|
441
523
|
.then(() => participants[0].webex.internal.board.getContents(channel))
|
|
442
524
|
.then((page) => {
|
|
443
525
|
assert.lengthOf(page, 1);
|
|
@@ -453,50 +535,69 @@ describe('plugin-board', () => {
|
|
|
453
535
|
it('does not allow board user to create board', () => {
|
|
454
536
|
let currentConvo;
|
|
455
537
|
|
|
456
|
-
return participants[0].webex.internal.conversation
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
538
|
+
return participants[0].webex.internal.conversation
|
|
539
|
+
.create({
|
|
540
|
+
displayName: 'Test Board Member Leave Conversation',
|
|
541
|
+
participants,
|
|
542
|
+
})
|
|
460
543
|
.then((c) => {
|
|
461
544
|
currentConvo = c;
|
|
462
545
|
|
|
463
546
|
return participants[1].webex.internal.conversation.leave(currentConvo);
|
|
464
547
|
})
|
|
465
|
-
.then(() =>
|
|
548
|
+
.then(() =>
|
|
549
|
+
assert.isRejected(participants[1].webex.internal.board.createChannel(currentConvo))
|
|
550
|
+
);
|
|
466
551
|
});
|
|
467
552
|
|
|
468
553
|
it('does not allow board creator to access and decrypt contents', () => {
|
|
469
554
|
let currentConvo;
|
|
470
555
|
let currentBoard;
|
|
471
556
|
const encryptedBoardContent = {};
|
|
472
|
-
const data = [
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
displayName: 'Test Board Creator Leave Conversation',
|
|
479
|
-
participants
|
|
480
|
-
})
|
|
481
|
-
.then((c) => {
|
|
482
|
-
currentConvo = c;
|
|
557
|
+
const data = [
|
|
558
|
+
{
|
|
559
|
+
type: 'curve',
|
|
560
|
+
payload: JSON.stringify({type: 'curve'}),
|
|
561
|
+
},
|
|
562
|
+
];
|
|
483
563
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
564
|
+
return (
|
|
565
|
+
participants[1].webex.internal.conversation
|
|
566
|
+
.create({
|
|
567
|
+
displayName: 'Test Board Creator Leave Conversation',
|
|
568
|
+
participants,
|
|
569
|
+
})
|
|
570
|
+
.then((c) => {
|
|
571
|
+
currentConvo = c;
|
|
488
572
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
encryptedBoardContent.items = encryptedData;
|
|
573
|
+
return participants[1].webex.internal.board.createChannel(currentConvo);
|
|
574
|
+
})
|
|
575
|
+
.then((b) => {
|
|
576
|
+
currentBoard = b;
|
|
494
577
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
578
|
+
return participants[1].webex.internal.conversation.leave(currentConvo);
|
|
579
|
+
})
|
|
580
|
+
.then(() =>
|
|
581
|
+
participants[0].webex.internal.board.encryptContents(
|
|
582
|
+
currentBoard.defaultEncryptionKeyUrl,
|
|
583
|
+
data
|
|
584
|
+
)
|
|
585
|
+
)
|
|
586
|
+
.then((encryptedData) => {
|
|
587
|
+
encryptedBoardContent.items = encryptedData;
|
|
588
|
+
|
|
589
|
+
return assert.isRejected(
|
|
590
|
+
participants[1].webex.internal.board.getContents(currentBoard)
|
|
591
|
+
);
|
|
592
|
+
})
|
|
593
|
+
// ensure keys aren't cached
|
|
594
|
+
.then(() => participants[1].webex.unboundedStorage.clear())
|
|
595
|
+
.then(() =>
|
|
596
|
+
assert.isRejected(
|
|
597
|
+
participants[1].webex.internal.board.decryptContents(encryptedBoardContent)
|
|
598
|
+
)
|
|
599
|
+
)
|
|
600
|
+
);
|
|
500
601
|
});
|
|
501
602
|
});
|
|
502
603
|
|
|
@@ -504,44 +605,63 @@ describe('plugin-board', () => {
|
|
|
504
605
|
it('deletes channel', () => {
|
|
505
606
|
let newChannel;
|
|
506
607
|
|
|
507
|
-
return participants[1].webex.internal.board
|
|
608
|
+
return participants[1].webex.internal.board
|
|
609
|
+
.createChannel(conversation)
|
|
508
610
|
.then((res) => {
|
|
509
611
|
newChannel = res;
|
|
510
612
|
|
|
511
613
|
return participants[1].webex.internal.board.deleteChannel(conversation, newChannel);
|
|
512
614
|
})
|
|
513
|
-
.then(() =>
|
|
615
|
+
.then(() =>
|
|
616
|
+
assert.isRejected(participants[1].webex.internal.board.getChannel(newChannel))
|
|
617
|
+
);
|
|
514
618
|
});
|
|
515
619
|
|
|
516
620
|
describe('when preventDeleteActiveChannel is enabled', () => {
|
|
517
621
|
it('does not delete when a channel is being used', () => {
|
|
518
622
|
let activeChannel;
|
|
519
623
|
|
|
520
|
-
return participants[1].webex.internal.board
|
|
624
|
+
return participants[1].webex.internal.board
|
|
625
|
+
.createChannel(conversation)
|
|
521
626
|
.then((res) => {
|
|
522
627
|
activeChannel = res;
|
|
523
|
-
const data = [
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
628
|
+
const data = [
|
|
629
|
+
{
|
|
630
|
+
type: 'curve',
|
|
631
|
+
payload: JSON.stringify({type: 'curve'}),
|
|
632
|
+
},
|
|
633
|
+
];
|
|
527
634
|
|
|
528
635
|
// this will mark the channel as being used
|
|
529
636
|
return participants[0].webex.internal.board.addContent(activeChannel, data);
|
|
530
637
|
})
|
|
531
|
-
.then(() =>
|
|
638
|
+
.then(() =>
|
|
639
|
+
assert.isRejected(
|
|
640
|
+
participants[1].webex.internal.board.deleteChannel(conversation, activeChannel, {
|
|
641
|
+
preventDeleteActiveChannel: true,
|
|
642
|
+
})
|
|
643
|
+
)
|
|
644
|
+
)
|
|
532
645
|
.then(() => participants[1].webex.internal.board.getChannel(activeChannel));
|
|
533
646
|
});
|
|
534
647
|
|
|
535
648
|
it('deletes inactive channel', () => {
|
|
536
649
|
let inActiveChannel;
|
|
537
650
|
|
|
538
|
-
return participants[1].webex.internal.board
|
|
651
|
+
return participants[1].webex.internal.board
|
|
652
|
+
.createChannel(conversation)
|
|
539
653
|
.then((res) => {
|
|
540
654
|
inActiveChannel = res;
|
|
541
655
|
|
|
542
|
-
return participants[1].webex.internal.board.deleteChannel(
|
|
656
|
+
return participants[1].webex.internal.board.deleteChannel(
|
|
657
|
+
conversation,
|
|
658
|
+
inActiveChannel,
|
|
659
|
+
{preventDeleteActiveChannel: true}
|
|
660
|
+
);
|
|
543
661
|
})
|
|
544
|
-
.then(() =>
|
|
662
|
+
.then(() =>
|
|
663
|
+
assert.isRejected(participants[1].webex.internal.board.getChannel(inActiveChannel))
|
|
664
|
+
);
|
|
545
665
|
});
|
|
546
666
|
});
|
|
547
667
|
});
|
|
@@ -550,19 +670,24 @@ describe('plugin-board', () => {
|
|
|
550
670
|
it('locks a channel for deletion which rejects any incoming activities', () => {
|
|
551
671
|
let newChannel;
|
|
552
672
|
|
|
553
|
-
return participants[1].webex.internal.board
|
|
673
|
+
return participants[1].webex.internal.board
|
|
674
|
+
.createChannel(conversation)
|
|
554
675
|
.then((res) => {
|
|
555
676
|
newChannel = res;
|
|
556
677
|
|
|
557
678
|
return participants[1].webex.internal.board.lockChannelForDeletion(newChannel);
|
|
558
679
|
})
|
|
559
680
|
.then(() => {
|
|
560
|
-
const data = [
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
681
|
+
const data = [
|
|
682
|
+
{
|
|
683
|
+
type: 'curve',
|
|
684
|
+
payload: JSON.stringify({type: 'curve'}),
|
|
685
|
+
},
|
|
686
|
+
];
|
|
564
687
|
|
|
565
|
-
return assert.isRejected(
|
|
688
|
+
return assert.isRejected(
|
|
689
|
+
participants[0].webex.internal.board.addContent(newChannel, data)
|
|
690
|
+
);
|
|
566
691
|
});
|
|
567
692
|
});
|
|
568
693
|
});
|
|
@@ -571,19 +696,20 @@ describe('plugin-board', () => {
|
|
|
571
696
|
it('keeps a channel status as active', () => {
|
|
572
697
|
let newChannel;
|
|
573
698
|
|
|
574
|
-
return participants[1].webex.internal.board
|
|
699
|
+
return participants[1].webex.internal.board
|
|
700
|
+
.createChannel(conversation)
|
|
575
701
|
.then((res) => {
|
|
576
702
|
newChannel = res;
|
|
577
703
|
|
|
578
704
|
return participants[1].webex.internal.board.keepActive(newChannel);
|
|
579
705
|
})
|
|
580
|
-
.then(() =>
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
)
|
|
706
|
+
.then(() =>
|
|
707
|
+
assert.isRejected(
|
|
708
|
+
participants[0].webex.internal.board.deleteChannel(conversation, newChannel, {
|
|
709
|
+
preventDeleteActiveChannel: true,
|
|
710
|
+
})
|
|
711
|
+
)
|
|
712
|
+
);
|
|
587
713
|
});
|
|
588
714
|
});
|
|
589
715
|
});
|