@webex/internal-plugin-board 3.0.0-beta.2 → 3.0.0-beta.21

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,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(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) => 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.setSnapshotImage(board, fixture)
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(board.defaultEncryptionKeyUrl, res.image.scr);
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) => fh.isMatchingFile(file, fixture)
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', () => 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
- }));
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', () => participants[0].webex.internal.board.getContents(board)
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', () => 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))));
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.addImage(board, fixture)
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(testContent, 'contentUrl', 'content should contain contentId property');
176
- assert.property(testContent, 'channelUrl', 'content should contain contentUrl property');
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(() => participants[0].webex.internal.encryption.download(testScr)
194
- .then((downloadedFile) => fh.isMatchingFile(downloadedFile, fixture))
195
- .then((res) => assert.isTrue(res)));
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', () => participants[0].webex.internal.board.getChannels(conversation)
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.createChannel(conversation, {type: 'annotated'})
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, {type: 'annotated'});
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,65 @@ describe('plugin-board', () => {
231
290
  let channelsReceived = [];
232
291
  let convo;
233
292
 
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);
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
- 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
- });
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
+ channelsCreated.sort((a, b) => a.createdTime - b.createdTime);
342
+ channelsReceived.sort((a, b) => a.createdTime - b.createdTime);
343
+
344
+ if (channelsCreated.length === channelsReceived.length) {
345
+ channelsReceived.forEach((channel, i) => {
346
+ delete channel.format;
347
+ assert.deepEqual(channel, channelsCreated[i]);
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) => {
@@ -424,20 +504,23 @@ describe('plugin-board', () => {
424
504
  const data = [
425
505
  {
426
506
  type: 'STRING',
427
- payload: JSON.stringify({id: uuid.v4()})
507
+ payload: JSON.stringify({id: uuid.v4()}),
428
508
  },
429
509
  {
430
510
  type: 'FILE',
431
- payload: JSON.stringify({id: uuid.v4()})
432
- }
511
+ payload: JSON.stringify({id: uuid.v4()}),
512
+ },
433
513
  ];
434
514
  const contentsToKeep = [];
435
515
 
436
- return participants[0].webex.internal.board.addContent(channel, data)
516
+ return participants[0].webex.internal.board
517
+ .addContent(channel, data)
437
518
  .then(([firstPageRes]) => {
438
519
  contentsToKeep.push(firstPageRes.items[1]);
439
520
  })
440
- .then(() => participants[0].webex.internal.board.deletePartialContent(channel, contentsToKeep))
521
+ .then(() =>
522
+ participants[0].webex.internal.board.deletePartialContent(channel, contentsToKeep)
523
+ )
441
524
  .then(() => participants[0].webex.internal.board.getContents(channel))
442
525
  .then((page) => {
443
526
  assert.lengthOf(page, 1);
@@ -453,50 +536,69 @@ describe('plugin-board', () => {
453
536
  it('does not allow board user to create board', () => {
454
537
  let currentConvo;
455
538
 
456
- return participants[0].webex.internal.conversation.create({
457
- displayName: 'Test Board Member Leave Conversation',
458
- participants
459
- })
539
+ return participants[0].webex.internal.conversation
540
+ .create({
541
+ displayName: 'Test Board Member Leave Conversation',
542
+ participants,
543
+ })
460
544
  .then((c) => {
461
545
  currentConvo = c;
462
546
 
463
547
  return participants[1].webex.internal.conversation.leave(currentConvo);
464
548
  })
465
- .then(() => assert.isRejected(participants[1].webex.internal.board.createChannel(currentConvo)));
549
+ .then(() =>
550
+ assert.isRejected(participants[1].webex.internal.board.createChannel(currentConvo))
551
+ );
466
552
  });
467
553
 
468
554
  it('does not allow board creator to access and decrypt contents', () => {
469
555
  let currentConvo;
470
556
  let currentBoard;
471
557
  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;
558
+ const data = [
559
+ {
560
+ type: 'curve',
561
+ payload: JSON.stringify({type: 'curve'}),
562
+ },
563
+ ];
483
564
 
484
- return participants[1].webex.internal.board.createChannel(currentConvo);
485
- })
486
- .then((b) => {
487
- currentBoard = b;
565
+ return (
566
+ participants[1].webex.internal.conversation
567
+ .create({
568
+ displayName: 'Test Board Creator Leave Conversation',
569
+ participants,
570
+ })
571
+ .then((c) => {
572
+ currentConvo = c;
488
573
 
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;
574
+ return participants[1].webex.internal.board.createChannel(currentConvo);
575
+ })
576
+ .then((b) => {
577
+ currentBoard = b;
494
578
 
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)));
579
+ return participants[1].webex.internal.conversation.leave(currentConvo);
580
+ })
581
+ .then(() =>
582
+ participants[0].webex.internal.board.encryptContents(
583
+ currentBoard.defaultEncryptionKeyUrl,
584
+ data
585
+ )
586
+ )
587
+ .then((encryptedData) => {
588
+ encryptedBoardContent.items = encryptedData;
589
+
590
+ return assert.isRejected(
591
+ participants[1].webex.internal.board.getContents(currentBoard)
592
+ );
593
+ })
594
+ // ensure keys aren't cached
595
+ .then(() => participants[1].webex.unboundedStorage.clear())
596
+ .then(() =>
597
+ assert.isRejected(
598
+ participants[1].webex.internal.board.decryptContents(encryptedBoardContent)
599
+ )
600
+ )
601
+ );
500
602
  });
501
603
  });
502
604
 
@@ -504,44 +606,63 @@ describe('plugin-board', () => {
504
606
  it('deletes channel', () => {
505
607
  let newChannel;
506
608
 
507
- return participants[1].webex.internal.board.createChannel(conversation)
609
+ return participants[1].webex.internal.board
610
+ .createChannel(conversation)
508
611
  .then((res) => {
509
612
  newChannel = res;
510
613
 
511
614
  return participants[1].webex.internal.board.deleteChannel(conversation, newChannel);
512
615
  })
513
- .then(() => assert.isRejected(participants[1].webex.internal.board.getChannel(newChannel)));
616
+ .then(() =>
617
+ assert.isRejected(participants[1].webex.internal.board.getChannel(newChannel))
618
+ );
514
619
  });
515
620
 
516
621
  describe('when preventDeleteActiveChannel is enabled', () => {
517
622
  it('does not delete when a channel is being used', () => {
518
623
  let activeChannel;
519
624
 
520
- return participants[1].webex.internal.board.createChannel(conversation)
625
+ return participants[1].webex.internal.board
626
+ .createChannel(conversation)
521
627
  .then((res) => {
522
628
  activeChannel = res;
523
- const data = [{
524
- type: 'curve',
525
- payload: JSON.stringify({type: 'curve'})
526
- }];
629
+ const data = [
630
+ {
631
+ type: 'curve',
632
+ payload: JSON.stringify({type: 'curve'}),
633
+ },
634
+ ];
527
635
 
528
636
  // this will mark the channel as being used
529
637
  return participants[0].webex.internal.board.addContent(activeChannel, data);
530
638
  })
531
- .then(() => assert.isRejected(participants[1].webex.internal.board.deleteChannel(conversation, activeChannel, {preventDeleteActiveChannel: true})))
639
+ .then(() =>
640
+ assert.isRejected(
641
+ participants[1].webex.internal.board.deleteChannel(conversation, activeChannel, {
642
+ preventDeleteActiveChannel: true,
643
+ })
644
+ )
645
+ )
532
646
  .then(() => participants[1].webex.internal.board.getChannel(activeChannel));
533
647
  });
534
648
 
535
649
  it('deletes inactive channel', () => {
536
650
  let inActiveChannel;
537
651
 
538
- return participants[1].webex.internal.board.createChannel(conversation)
652
+ return participants[1].webex.internal.board
653
+ .createChannel(conversation)
539
654
  .then((res) => {
540
655
  inActiveChannel = res;
541
656
 
542
- return participants[1].webex.internal.board.deleteChannel(conversation, inActiveChannel, {preventDeleteActiveChannel: true});
657
+ return participants[1].webex.internal.board.deleteChannel(
658
+ conversation,
659
+ inActiveChannel,
660
+ {preventDeleteActiveChannel: true}
661
+ );
543
662
  })
544
- .then(() => assert.isRejected(participants[1].webex.internal.board.getChannel(inActiveChannel)));
663
+ .then(() =>
664
+ assert.isRejected(participants[1].webex.internal.board.getChannel(inActiveChannel))
665
+ );
545
666
  });
546
667
  });
547
668
  });
@@ -550,19 +671,24 @@ describe('plugin-board', () => {
550
671
  it('locks a channel for deletion which rejects any incoming activities', () => {
551
672
  let newChannel;
552
673
 
553
- return participants[1].webex.internal.board.createChannel(conversation)
674
+ return participants[1].webex.internal.board
675
+ .createChannel(conversation)
554
676
  .then((res) => {
555
677
  newChannel = res;
556
678
 
557
679
  return participants[1].webex.internal.board.lockChannelForDeletion(newChannel);
558
680
  })
559
681
  .then(() => {
560
- const data = [{
561
- type: 'curve',
562
- payload: JSON.stringify({type: 'curve'})
563
- }];
682
+ const data = [
683
+ {
684
+ type: 'curve',
685
+ payload: JSON.stringify({type: 'curve'}),
686
+ },
687
+ ];
564
688
 
565
- return assert.isRejected(participants[0].webex.internal.board.addContent(newChannel, data));
689
+ return assert.isRejected(
690
+ participants[0].webex.internal.board.addContent(newChannel, data)
691
+ );
566
692
  });
567
693
  });
568
694
  });
@@ -571,19 +697,20 @@ describe('plugin-board', () => {
571
697
  it('keeps a channel status as active', () => {
572
698
  let newChannel;
573
699
 
574
- return participants[1].webex.internal.board.createChannel(conversation)
700
+ return participants[1].webex.internal.board
701
+ .createChannel(conversation)
575
702
  .then((res) => {
576
703
  newChannel = res;
577
704
 
578
705
  return participants[1].webex.internal.board.keepActive(newChannel);
579
706
  })
580
- .then(() => assert.isRejected(participants[0].webex.internal.board.deleteChannel(
581
- conversation,
582
- newChannel,
583
- {
584
- preventDeleteActiveChannel: true
585
- }
586
- )));
707
+ .then(() =>
708
+ assert.isRejected(
709
+ participants[0].webex.internal.board.deleteChannel(conversation, newChannel, {
710
+ preventDeleteActiveChannel: true,
711
+ })
712
+ )
713
+ );
587
714
  });
588
715
  });
589
716
  });