@webex/internal-plugin-board 3.0.0-beta.8 → 3.0.0-bnr.0

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.
@@ -13,26 +13,32 @@ describe('plugin-board', () => {
13
13
  let webex;
14
14
  const encryptedData = 'encryptedData';
15
15
  const decryptedText = 'decryptedText';
16
- const fakeURL = `${process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'}/encryption/api/v1/keys/8a7d3d78-ce75-48aa-a943-2e8acf63fbc9`;
16
+ const fakeURL = `${
17
+ process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'
18
+ }/encryption/api/v1/keys/8a7d3d78-ce75-48aa-a943-2e8acf63fbc9`;
17
19
  const file = 'dataURL://base64;';
18
20
  const boardServiceUrl = 'https://awesome.service.url';
19
21
  const boardId = 'boardId';
20
22
 
21
23
  const mockKey = {
22
- uri: `${process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'}/encryption/api/v1/keys/7ad503ec-854b-4fce-a7f0-182e1997bdb6`
24
+ uri: `${
25
+ process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'
26
+ }/encryption/api/v1/keys/7ad503ec-854b-4fce-a7f0-182e1997bdb6`,
23
27
  };
24
28
 
25
29
  const image = {
26
30
  height: 900,
27
31
  width: 1600,
28
- size: 15000
32
+ size: 15000,
29
33
  };
30
34
 
31
35
  const conversation = {
32
36
  id: '7c7e69a0-a086-11e6-8670-d7b4b51d7641',
33
37
  defaultActivityEncryptionKeyUrl: fakeURL,
34
- kmsResourceObjectUrl: `${process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'}/encryption/api/v1/resources/8693f702-2012-40c6-9ec4-f1392f0a620a`,
35
- aclUrl: 'https://acl-a.wbx2.com/acl/api/v1/acls/7ca94a30-a086-11e6-b599-d90deb9846ed'
38
+ kmsResourceObjectUrl: `${
39
+ process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'
40
+ }/encryption/api/v1/resources/8693f702-2012-40c6-9ec4-f1392f0a620a`,
41
+ aclUrl: 'https://acl-a.wbx2.com/acl/api/v1/acls/7ca94a30-a086-11e6-b599-d90deb9846ed',
36
42
  };
37
43
 
38
44
  const channel = {
@@ -41,13 +47,15 @@ describe('plugin-board', () => {
41
47
  aclUrlLink: conversation.aclUrl,
42
48
  aclUrl: 'https://acl-a.wbx2.com/acl/api/v1/acls/e2947ee0-972b-11e7-a041-d564bb1fbb45',
43
49
  defaultEncryptionKeyUrl: mockKey.uri,
44
- kmsResourceUrl: `${process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'}/encryption/api/v1/resources/18f7c618-2eff-461e-ac46-819a0fd2b476`,
50
+ kmsResourceUrl: `${
51
+ process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'
52
+ }/encryption/api/v1/resources/18f7c618-2eff-461e-ac46-819a0fd2b476`,
45
53
  kmsMessage: {
46
54
  method: 'create',
47
55
  uri: '/resources',
48
56
  userIds: [conversation.kmsResourceObjectUrl],
49
- keyUris: []
50
- }
57
+ keyUris: [],
58
+ },
51
59
  };
52
60
 
53
61
  const channelRes = {
@@ -57,62 +65,80 @@ describe('plugin-board', () => {
57
65
  aclUrl: 'https://acl-a.wbx2.com/acl/api/v1/acls/e2947ee0-972b-11e7-a041-d564bb1fbb45',
58
66
  defaultEncryptionKeyUrl: mockKey.uri,
59
67
  creatorId: 'c321e329-28d6-4d52-a9d1-374010411530',
60
- kmsResourceUrl: `${process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'}/encryption/api/v1/resources/18f7c618-2eff-461e-ac46-819a0fd2b476`,
68
+ kmsResourceUrl: `${
69
+ process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'
70
+ }/encryption/api/v1/resources/18f7c618-2eff-461e-ac46-819a0fd2b476`,
61
71
  kmsMessage: {
62
72
  status: 201,
63
73
  resource: {
64
- uri: `${process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'}/encryption/api/v1/resources/2853285c-c46b-4b35-9542-9a81d4e3c87f`,
65
- keyUris: [`${process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'}/encryption/api/v1/keys/5042787d-510b-46f3-b83c-ea73032de851`],
74
+ uri: `${
75
+ process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'
76
+ }/encryption/api/v1/resources/2853285c-c46b-4b35-9542-9a81d4e3c87f`,
77
+ keyUris: [
78
+ `${
79
+ process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'
80
+ }/encryption/api/v1/keys/5042787d-510b-46f3-b83c-ea73032de851`,
81
+ ],
66
82
  authorizationUris: [
67
- `${process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'}/encryption/api/v1/authorizations/aHR0cHM6Ly9lbmNyeXB0aW9uLWEud2J4Mi5jb20vZW5jcnlwdGlvbi9hcGkvdjEvcmVzb3VyY2VzLzI3OWIyMjgyLWZmYTItNGM3ZC04NGRmLTRkNDVlZmUzYTMzNQBodHRwczovL2VuY3J5cHRpb24tYS53YngyLmNvbS9lbmNyeXB0aW9uL2FwaS92MS9yZXNvdXJjZXMvMjg1MzI4NWMtYzQ2Yi00YjM1LTk1NDItOWE4MWQ0ZTNjODdm`,
68
- `${process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'}/encryption/api/v1/authorizations/YzMyMWUzMjktMjhkNi00ZDUyLWE5ZDEtMzc0MDEwNDExNTMwAGh0dHBzOi8vZW5jcnlwdGlvbi1hLndieDIuY29tL2VuY3J5cHRpb24vYXBpL3YxL3Jlc291cmNlcy8yODUzMjg1Yy1jNDZiLTRiMzUtOTU0Mi05YTgxZDRlM2M4N2Y`
69
- ]
70
- }
71
- }
83
+ `${
84
+ process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'
85
+ }/encryption/api/v1/authorizations/aHR0cHM6Ly9lbmNyeXB0aW9uLWEud2J4Mi5jb20vZW5jcnlwdGlvbi9hcGkvdjEvcmVzb3VyY2VzLzI3OWIyMjgyLWZmYTItNGM3ZC04NGRmLTRkNDVlZmUzYTMzNQBodHRwczovL2VuY3J5cHRpb24tYS53YngyLmNvbS9lbmNyeXB0aW9uL2FwaS92MS9yZXNvdXJjZXMvMjg1MzI4NWMtYzQ2Yi00YjM1LTk1NDItOWE4MWQ0ZTNjODdm`,
86
+ `${
87
+ process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'
88
+ }/encryption/api/v1/authorizations/YzMyMWUzMjktMjhkNi00ZDUyLWE5ZDEtMzc0MDEwNDExNTMwAGh0dHBzOi8vZW5jcnlwdGlvbi1hLndieDIuY29tL2VuY3J5cHRpb24vYXBpL3YxL3Jlc291cmNlcy8yODUzMjg1Yy1jNDZiLTRiMzUtOTU0Mi05YTgxZDRlM2M4N2Y`,
89
+ ],
90
+ },
91
+ },
72
92
  };
73
93
 
74
94
  const data1 = {
75
95
  contentUrl: `${channel.channelUrl}/contents/data1`,
76
96
  contentId: 'data1',
77
97
  type: 'test',
78
- data: 'data1'
98
+ data: 'data1',
79
99
  };
80
100
 
81
101
  const data2 = {
82
102
  type: 'test',
83
- data: 'data2'
103
+ data: 'data2',
84
104
  };
85
105
 
86
106
  before(() => {
87
107
  webex = new MockWebex({
88
108
  children: {
89
- board: Board
109
+ board: Board,
90
110
  },
91
- request: sinon.stub().returns(Promise.resolve({
92
- headers: {},
93
- body: ''
94
- })),
95
- upload: sinon.stub().returns(Promise.resolve({body: {downloadUrl: fakeURL}}))
111
+ request: sinon.stub().returns(
112
+ Promise.resolve({
113
+ headers: {},
114
+ body: '',
115
+ })
116
+ ),
117
+ upload: sinon.stub().returns(Promise.resolve({body: {downloadUrl: fakeURL}})),
96
118
  });
97
119
 
98
120
  Object.assign(webex.internal, {
99
121
  device: {
100
122
  deviceType: 'FAKE_DEVICE',
101
- getServiceUrl: () => boardServiceUrl
123
+ getServiceUrl: () => boardServiceUrl,
102
124
  },
103
125
  encryption: {
104
126
  decryptText: sinon.stub().returns(Promise.resolve(decryptedText)),
105
127
  encryptText: sinon.stub().returns(Promise.resolve(encryptedData)),
106
- encryptBinary: sinon.stub().returns(Promise.resolve({
107
- scr: {},
108
- cdata: encryptedData
109
- })),
110
- download: sinon.stub().returns(Promise.resolve({
111
- toArrayBuffer: sinon.stub()
112
- })),
128
+ encryptBinary: sinon.stub().returns(
129
+ Promise.resolve({
130
+ scr: {},
131
+ cdata: encryptedData,
132
+ })
133
+ ),
134
+ download: sinon.stub().returns(
135
+ Promise.resolve({
136
+ toArrayBuffer: sinon.stub(),
137
+ })
138
+ ),
113
139
  decryptScr: sinon.stub().returns(Promise.resolve('decryptedFoo')),
114
- encryptScr: sinon.stub().returns(Promise.resolve('encryptedFoo'))
115
- }
140
+ encryptScr: sinon.stub().returns(Promise.resolve('encryptedFoo')),
141
+ },
116
142
  });
117
143
 
118
144
  webex.config.board = boardConfig.board;
@@ -123,23 +149,29 @@ describe('plugin-board', () => {
123
149
  webex.request.resetHistory();
124
150
  });
125
151
 
126
- it('requests POST all contents to contents', () => webex.internal.board.addContent(channel, [data1, data2])
127
- .then(() => {
128
- assert.calledWith(webex.request, sinon.match({
129
- method: 'POST',
130
- uri: `${boardServiceUrl}/channels/${boardId}/contents`,
131
- body: [{
132
- device: 'FAKE_DEVICE',
133
- type: 'STRING',
134
- encryptionKeyUrl: mockKey.uri,
135
- payload: 'encryptedData'
136
- }, {
137
- device: 'FAKE_DEVICE',
138
- type: 'STRING',
139
- encryptionKeyUrl: mockKey.uri,
140
- payload: 'encryptedData'
141
- }]
142
- }));
152
+ it('requests POST all contents to contents', () =>
153
+ webex.internal.board.addContent(channel, [data1, data2]).then(() => {
154
+ assert.calledWith(
155
+ webex.request,
156
+ sinon.match({
157
+ method: 'POST',
158
+ uri: `${boardServiceUrl}/channels/${boardId}/contents`,
159
+ body: [
160
+ {
161
+ device: 'FAKE_DEVICE',
162
+ type: 'STRING',
163
+ encryptionKeyUrl: mockKey.uri,
164
+ payload: 'encryptedData',
165
+ },
166
+ {
167
+ device: 'FAKE_DEVICE',
168
+ type: 'STRING',
169
+ encryptionKeyUrl: mockKey.uri,
170
+ payload: 'encryptedData',
171
+ },
172
+ ],
173
+ })
174
+ );
143
175
  }));
144
176
 
145
177
  it('sends large data using multiple requests', () => {
@@ -149,19 +181,20 @@ describe('plugin-board', () => {
149
181
  largeData.push({data: i});
150
182
  }
151
183
 
152
- return webex.internal.board.addContent(channel, largeData)
153
- .then(() => {
154
- assert.equal(webex.request.callCount, 3);
155
- });
184
+ return webex.internal.board.addContent(channel, largeData).then(() => {
185
+ assert.equal(webex.request.callCount, 3);
186
+ });
156
187
  });
157
188
  });
158
189
 
159
190
  describe('#setSnapshotImage()', () => {
160
191
  beforeEach(() => {
161
192
  webex.request.resetHistory();
162
- sinon.stub(webex.internal.board, '_uploadImageToWebexFiles').returns(Promise.resolve({
163
- downloadUrl: fakeURL
164
- }));
193
+ sinon.stub(webex.internal.board, '_uploadImageToWebexFiles').returns(
194
+ Promise.resolve({
195
+ downloadUrl: fakeURL,
196
+ })
197
+ );
165
198
  webex.internal.encryption.encryptScr.resetHistory();
166
199
  });
167
200
 
@@ -170,30 +203,33 @@ describe('plugin-board', () => {
170
203
  webex.internal.encryption.encryptScr.resetHistory();
171
204
  });
172
205
 
173
- it('requests PATCH to board service', () => webex.internal.board.setSnapshotImage(channel, image)
174
- .then(() => {
175
- assert.calledWith(webex.request, sinon.match({
176
- method: 'PATCH',
177
- uri: channel.channelUrl,
178
- body: {
179
- image: {
180
- url: fakeURL,
181
- height: image.height,
182
- width: image.width,
183
- mimeType: 'image/png',
184
- scr: 'encryptedFoo',
185
- encryptionKeyUrl: channel.defaultEncryptionKeyUrl,
186
- fileSize: image.size
187
- }
188
- }
189
- }));
206
+ it('requests PATCH to board service', () =>
207
+ webex.internal.board.setSnapshotImage(channel, image).then(() => {
208
+ assert.calledWith(
209
+ webex.request,
210
+ sinon.match({
211
+ method: 'PATCH',
212
+ uri: channel.channelUrl,
213
+ body: {
214
+ image: {
215
+ url: fakeURL,
216
+ height: image.height,
217
+ width: image.width,
218
+ mimeType: 'image/png',
219
+ scr: 'encryptedFoo',
220
+ encryptionKeyUrl: channel.defaultEncryptionKeyUrl,
221
+ fileSize: image.size,
222
+ },
223
+ },
224
+ })
225
+ );
190
226
  }));
191
227
  });
192
228
 
193
229
  describe('#createChannel()', () => {
194
230
  const channelRequestBody = {
195
231
  aclUrlLink: channel.aclUrlLink,
196
- kmsMessage: channel.kmsMessage
232
+ kmsMessage: channel.kmsMessage,
197
233
  };
198
234
 
199
235
  before(() => {
@@ -205,19 +241,24 @@ describe('plugin-board', () => {
205
241
 
206
242
  after(() => {
207
243
  // reset request to its original behavior
208
- webex.request.returns(Promise.resolve({
209
- headers: {},
210
- body: ''
211
- }));
244
+ webex.request.returns(
245
+ Promise.resolve({
246
+ headers: {},
247
+ body: '',
248
+ })
249
+ );
212
250
  });
213
251
 
214
252
  it('requests POST to channels service', () => {
215
- assert.calledWith(webex.request, sinon.match({
216
- method: 'POST',
217
- api: 'board',
218
- resource: '/channels',
219
- body: channelRequestBody
220
- }));
253
+ assert.calledWith(
254
+ webex.request,
255
+ sinon.match({
256
+ method: 'POST',
257
+ api: 'board',
258
+ resource: '/channels',
259
+ body: channelRequestBody,
260
+ })
261
+ );
221
262
  });
222
263
  });
223
264
 
@@ -225,9 +266,10 @@ describe('plugin-board', () => {
225
266
  it('requests PUT to ACL service to remove the link between conversation and board', () => {
226
267
  webex.request.resetHistory();
227
268
 
228
- return webex.internal.board.deleteChannel(conversation, channel)
229
- .then(() => {
230
- assert.calledWith(webex.request, sinon.match({
269
+ return webex.internal.board.deleteChannel(conversation, channel).then(() => {
270
+ assert.calledWith(
271
+ webex.request,
272
+ sinon.match({
231
273
  method: 'PUT',
232
274
  uri: `${channel.aclUrl}/links`,
233
275
  body: {
@@ -235,40 +277,52 @@ describe('plugin-board', () => {
235
277
  linkedAcl: conversation.aclUrl,
236
278
  kmsMessage: {
237
279
  method: 'delete',
238
- uri: `${channel.kmsResourceUrl}/authorizations?${querystring.stringify({authId: conversation.kmsResourceObjectUrl})}`
280
+ uri: `${channel.kmsResourceUrl}/authorizations?${querystring.stringify({
281
+ authId: conversation.kmsResourceObjectUrl,
282
+ })}`,
239
283
  },
240
- aclLinkOperation: 'DELETE'
241
- }
242
- }));
243
- });
284
+ aclLinkOperation: 'DELETE',
285
+ },
286
+ })
287
+ );
288
+ });
244
289
  });
245
290
 
246
291
  it('requests locks channel before delete when preventDeleteActiveChannel is enabled', () => {
247
292
  webex.request.resetHistory();
248
293
 
249
- return webex.internal.board.deleteChannel(conversation, channel, {preventDeleteActiveChannel: true})
294
+ return webex.internal.board
295
+ .deleteChannel(conversation, channel, {preventDeleteActiveChannel: true})
250
296
  .then(() => {
251
- assert.calledWith(webex.request, sinon.match({
252
- method: 'POST',
253
- uri: `${channel.channelUrl}/lock`,
254
- qs: {
255
- intent: 'delete'
256
- }
257
- }));
258
-
259
- assert.calledWith(webex.request, sinon.match({
260
- method: 'PUT',
261
- uri: `${channel.aclUrl}/links`,
262
- body: {
263
- aclLinkType: 'INCOMING',
264
- linkedAcl: conversation.aclUrl,
265
- kmsMessage: {
266
- method: 'delete',
267
- uri: `${channel.kmsResourceUrl}/authorizations?${querystring.stringify({authId: conversation.kmsResourceObjectUrl})}`
297
+ assert.calledWith(
298
+ webex.request,
299
+ sinon.match({
300
+ method: 'POST',
301
+ uri: `${channel.channelUrl}/lock`,
302
+ qs: {
303
+ intent: 'delete',
268
304
  },
269
- aclLinkOperation: 'DELETE'
270
- }
271
- }));
305
+ })
306
+ );
307
+
308
+ assert.calledWith(
309
+ webex.request,
310
+ sinon.match({
311
+ method: 'PUT',
312
+ uri: `${channel.aclUrl}/links`,
313
+ body: {
314
+ aclLinkType: 'INCOMING',
315
+ linkedAcl: conversation.aclUrl,
316
+ kmsMessage: {
317
+ method: 'delete',
318
+ uri: `${channel.kmsResourceUrl}/authorizations?${querystring.stringify({
319
+ authId: conversation.kmsResourceObjectUrl,
320
+ })}`,
321
+ },
322
+ aclLinkOperation: 'DELETE',
323
+ },
324
+ })
325
+ );
272
326
  });
273
327
  });
274
328
  });
@@ -277,16 +331,18 @@ describe('plugin-board', () => {
277
331
  it('requests POST with delete lock intent', () => {
278
332
  webex.request.resetHistory();
279
333
 
280
- return webex.internal.board.lockChannelForDeletion(channel)
281
- .then(() => {
282
- assert.calledWith(webex.request, sinon.match({
334
+ return webex.internal.board.lockChannelForDeletion(channel).then(() => {
335
+ assert.calledWith(
336
+ webex.request,
337
+ sinon.match({
283
338
  method: 'POST',
284
339
  uri: `${channel.channelUrl}/lock`,
285
340
  qs: {
286
- intent: 'delete'
287
- }
288
- }));
289
- });
341
+ intent: 'delete',
342
+ },
343
+ })
344
+ );
345
+ });
290
346
  });
291
347
  });
292
348
 
@@ -294,13 +350,15 @@ describe('plugin-board', () => {
294
350
  it('requests POST to keep channel status active', () => {
295
351
  webex.request.resetHistory();
296
352
 
297
- return webex.internal.board.keepActive(channel)
298
- .then(() => {
299
- assert.calledWith(webex.request, sinon.match({
353
+ return webex.internal.board.keepActive(channel).then(() => {
354
+ assert.calledWith(
355
+ webex.request,
356
+ sinon.match({
300
357
  method: 'POST',
301
- uri: `${channel.channelUrl}/keepAlive`
302
- }));
303
- });
358
+ uri: `${channel.channelUrl}/keepAlive`,
359
+ })
360
+ );
361
+ });
304
362
  });
305
363
  });
306
364
 
@@ -312,10 +370,13 @@ describe('plugin-board', () => {
312
370
  });
313
371
 
314
372
  it('requests DELETE contents', () => {
315
- assert.calledWith(webex.request, sinon.match({
316
- method: 'DELETE',
317
- uri: `${boardServiceUrl}/channels/${boardId}/contents`
318
- }));
373
+ assert.calledWith(
374
+ webex.request,
375
+ sinon.match({
376
+ method: 'DELETE',
377
+ uri: `${boardServiceUrl}/channels/${boardId}/contents`,
378
+ })
379
+ );
319
380
  });
320
381
  });
321
382
 
@@ -323,25 +384,31 @@ describe('plugin-board', () => {
323
384
  it('requests POST contents with body contains the content to keep', () => {
324
385
  webex.request.resetHistory();
325
386
 
326
- return webex.internal.board.deletePartialContent(channel, [data1])
327
- .then(() => {
328
- assert.calledWith(webex.request, sinon.match({
387
+ return webex.internal.board.deletePartialContent(channel, [data1]).then(() => {
388
+ assert.calledWith(
389
+ webex.request,
390
+ sinon.match({
329
391
  method: 'POST',
330
392
  uri: `${boardServiceUrl}/channels/${boardId}/contents`,
331
393
  qs: {clearBoard: true},
332
- body: [{
333
- contentId: data1.contentId
334
- }]
335
- }));
336
- });
394
+ body: [
395
+ {
396
+ contentId: data1.contentId,
397
+ },
398
+ ],
399
+ })
400
+ );
401
+ });
337
402
  });
338
403
  });
339
404
 
340
405
  describe('#_uploadImage()', () => {
341
406
  before(() => {
342
- sinon.stub(webex.internal.board, '_uploadImageToWebexFiles').returns(Promise.resolve({
343
- downloadUrl: fakeURL
344
- }));
407
+ sinon.stub(webex.internal.board, '_uploadImageToWebexFiles').returns(
408
+ Promise.resolve({
409
+ downloadUrl: fakeURL,
410
+ })
411
+ );
345
412
 
346
413
  return webex.internal.board._uploadImage(conversation, file);
347
414
  });
@@ -373,74 +440,79 @@ describe('plugin-board', () => {
373
440
  webex.internal.board._getSpaceUrl.resetHistory();
374
441
  });
375
442
 
376
-
377
443
  it('uses length for upload filesize', () => {
378
444
  const blob = {
379
445
  length: 4444,
380
446
  size: 3333,
381
- byteLength: 2222
447
+ byteLength: 2222,
382
448
  };
383
449
 
384
- return webex.internal.board._uploadImageToWebexFiles(conversation, blob)
385
- .then(() => {
386
- assert.calledWith(webex.upload, sinon.match({
450
+ return webex.internal.board._uploadImageToWebexFiles(conversation, blob).then(() => {
451
+ assert.calledWith(
452
+ webex.upload,
453
+ sinon.match({
387
454
  phases: {
388
455
  initialize: {
389
- fileSize: 4444
456
+ fileSize: 4444,
390
457
  },
391
458
  finalize: {
392
459
  body: {
393
- fileSize: 4444
394
- }
395
- }
396
- }
397
- }));
398
- });
460
+ fileSize: 4444,
461
+ },
462
+ },
463
+ },
464
+ })
465
+ );
466
+ });
399
467
  });
400
468
 
401
469
  it('uses size for upload filesize when length is not available', () => {
402
470
  const blob = {
403
471
  size: 3333,
404
- byteLength: 2222
472
+ byteLength: 2222,
405
473
  };
406
474
 
407
- return webex.internal.board._uploadImageToWebexFiles(conversation, blob)
408
- .then(() => {
409
- assert.calledWith(webex.upload, sinon.match({
475
+ return webex.internal.board._uploadImageToWebexFiles(conversation, blob).then(() => {
476
+ assert.calledWith(
477
+ webex.upload,
478
+ sinon.match({
410
479
  phases: {
411
480
  initialize: {
412
- fileSize: 3333
481
+ fileSize: 3333,
413
482
  },
414
483
  finalize: {
415
484
  body: {
416
- fileSize: 3333
417
- }
418
- }
419
- }
420
- }));
421
- });
485
+ fileSize: 3333,
486
+ },
487
+ },
488
+ },
489
+ })
490
+ );
491
+ });
422
492
  });
423
493
 
424
494
  it('uses byteLenght for upload filesize when length and size are not available', () => {
425
495
  const blob = {
426
- byteLength: 2222
496
+ byteLength: 2222,
427
497
  };
428
498
 
429
- return webex.internal.board._uploadImageToWebexFiles(conversation, blob)
430
- .then(() => {
431
- assert.calledWith(webex.upload, sinon.match({
499
+ return webex.internal.board._uploadImageToWebexFiles(conversation, blob).then(() => {
500
+ assert.calledWith(
501
+ webex.upload,
502
+ sinon.match({
432
503
  phases: {
433
504
  initialize: {
434
- fileSize: 2222
505
+ fileSize: 2222,
435
506
  },
436
507
  finalize: {
437
508
  body: {
438
- fileSize: 2222
439
- }
440
- }
441
- }
442
- }));
443
- });
509
+ fileSize: 2222,
510
+ },
511
+ },
512
+ },
513
+ })
514
+ );
515
+ });
444
516
  });
445
517
  });
446
518
 
@@ -458,16 +530,19 @@ describe('plugin-board', () => {
458
530
  });
459
531
 
460
532
  it('requests GET to channels service', () => {
461
- assert.calledWith(webex.request, sinon.match({
462
- method: 'GET',
463
- uri: `${boardServiceUrl}/channels/${boardId}`
464
- }));
533
+ assert.calledWith(
534
+ webex.request,
535
+ sinon.match({
536
+ method: 'GET',
537
+ uri: `${boardServiceUrl}/channels/${boardId}`,
538
+ })
539
+ );
465
540
  });
466
541
 
467
- it('requires conversationId', () => assert.isRejected(webex.internal.board.getChannels(), '`conversation` is required'));
542
+ it('requires conversationId', () =>
543
+ assert.isRejected(webex.internal.board.getChannels(), '`conversation` is required'));
468
544
  });
469
545
 
470
-
471
546
  describe('#getContents()', () => {
472
547
  beforeEach(() => {
473
548
  sinon.stub(webex.internal.board, 'decryptContents').returns(['foo']);
@@ -478,21 +553,25 @@ describe('plugin-board', () => {
478
553
  webex.internal.board.decryptContents.restore();
479
554
  });
480
555
 
481
- it('requests GET contents with default page size', () => webex.internal.board.getContents(channel)
482
- .then(() => assert.calledWith(webex.request, {
483
- uri: `${boardServiceUrl}/channels/${boardId}/contents`,
484
- qs: {
485
- contentsLimit: boardConfig.board.numberContentsPerPageForGet
486
- }
487
- })));
488
-
489
- it('requests GET contents with client defined page size', () => webex.internal.board.getContents(channel, {contentsLimit: 25})
490
- .then(() => assert.calledWith(webex.request, {
491
- uri: `${boardServiceUrl}/channels/${boardId}/contents`,
492
- qs: {
493
- contentsLimit: 25
494
- }
495
- })));
556
+ it('requests GET contents with default page size', () =>
557
+ webex.internal.board.getContents(channel).then(() =>
558
+ assert.calledWith(webex.request, {
559
+ uri: `${boardServiceUrl}/channels/${boardId}/contents`,
560
+ qs: {
561
+ contentsLimit: boardConfig.board.numberContentsPerPageForGet,
562
+ },
563
+ })
564
+ ));
565
+
566
+ it('requests GET contents with client defined page size', () =>
567
+ webex.internal.board.getContents(channel, {contentsLimit: 25}).then(() =>
568
+ assert.calledWith(webex.request, {
569
+ uri: `${boardServiceUrl}/channels/${boardId}/contents`,
570
+ qs: {
571
+ contentsLimit: 25,
572
+ },
573
+ })
574
+ ));
496
575
  });
497
576
 
498
577
  describe('#register()', () => {
@@ -503,11 +582,14 @@ describe('plugin-board', () => {
503
582
  });
504
583
 
505
584
  it('requests POST data to registration service', () => {
506
- assert.calledWith(webex.request, sinon.match({
507
- method: 'POST',
508
- api: 'board',
509
- resource: '/registrations'
510
- }));
585
+ assert.calledWith(
586
+ webex.request,
587
+ sinon.match({
588
+ method: 'POST',
589
+ api: 'board',
590
+ resource: '/registrations',
591
+ })
592
+ );
511
593
  });
512
594
  });
513
595
 
@@ -516,22 +598,26 @@ describe('plugin-board', () => {
516
598
  webex.request.resetHistory();
517
599
  webex.internal.mercury.localClusterServiceUrls = {
518
600
  mercuryApiServiceClusterUrl: 'https://mercury-api-a5.wbx2.com/v1',
519
- mercuryConnectionServiceClusterUrl: 'https://mercury-connection-a5.wbx2.com/v1'
601
+ mercuryConnectionServiceClusterUrl: 'https://mercury-connection-a5.wbx2.com/v1',
520
602
  };
521
603
  webex.internal.feature.getFeature.returns(Promise.resolve(true));
522
604
  });
523
605
 
524
- it('requests POST data to registration service', () => webex.internal.board.registerToShareMercury(channel)
525
- .then(() => {
526
- assert.calledWith(webex.request, sinon.match({
527
- method: 'POST',
528
- uri: `${channel.channelUrl}/register`,
529
- body: {
530
- mercuryConnectionServiceClusterUrl: webex.internal.mercury.localClusterServiceUrls.mercuryConnectionServiceClusterUrl,
531
- webSocketUrl: webex.internal.device.webSocketUrl,
532
- action: 'ADD'
533
- }
534
- }));
606
+ it('requests POST data to registration service', () =>
607
+ webex.internal.board.registerToShareMercury(channel).then(() => {
608
+ assert.calledWith(
609
+ webex.request,
610
+ sinon.match({
611
+ method: 'POST',
612
+ uri: `${channel.channelUrl}/register`,
613
+ body: {
614
+ mercuryConnectionServiceClusterUrl:
615
+ webex.internal.mercury.localClusterServiceUrls.mercuryConnectionServiceClusterUrl,
616
+ webSocketUrl: webex.internal.device.webSocketUrl,
617
+ action: 'ADD',
618
+ },
619
+ })
620
+ );
535
621
  }));
536
622
 
537
623
  it('rejects when localClusterServiceUrls is null', () => {