@webex/internal-plugin-board 3.0.0-beta.3 → 3.0.0-beta.300

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