@webex/internal-plugin-ediscovery 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.
@@ -8,22 +8,24 @@ import config from '@webex/internal-plugin-ediscovery/src/config';
8
8
  describe('EDiscovery Content API Tests', () => {
9
9
  let webex;
10
10
  const uuid = 'cc06f622-46ab-45b9-b3a6-5d70bad1d70a';
11
- const url = 'https://ediscovery-intb.wbx2.com/ediscovery/api/v1/reports/cc06f622-46ab-45b9-b3a6-5d70bad1d70a';
11
+ const url =
12
+ 'https://ediscovery-intb.wbx2.com/ediscovery/api/v1/reports/cc06f622-46ab-45b9-b3a6-5d70bad1d70a';
12
13
  const invalidUrl = 'https://ediscovery-intb.wbx2.com/ediscovery/api/v1/reports/';
13
14
  const defaultTimeout = 30000;
14
15
 
15
16
  beforeEach(() => {
16
17
  webex = new MockWebex({
17
18
  children: {
18
- ediscovery: EDiscovery
19
- }
19
+ ediscovery: EDiscovery,
20
+ },
20
21
  });
21
22
  webex.config.ediscovery = config.ediscovery;
22
23
  });
23
24
 
24
25
  describe('GetContent Tests', () => {
25
26
  it('GetContent succeeds', async () => {
26
- const result = webex.internal.ediscovery.getContent(uuid, {offset: 0, size: 1})
27
+ const result = webex.internal.ediscovery
28
+ .getContent(uuid, {offset: 0, size: 1})
27
29
  .then((res) => {
28
30
  expect(res.statusCode).equal(200);
29
31
  });
@@ -32,40 +34,41 @@ describe('EDiscovery Content API Tests', () => {
32
34
  });
33
35
 
34
36
  it('GetContent fails with no params', async () => {
35
- const result = expect(webex.internal.ediscovery.getContent()).to.be.rejectedWith(Error, 'Undefined parameter');
37
+ const result = expect(webex.internal.ediscovery.getContent()).to.be.rejectedWith(
38
+ Error,
39
+ 'Undefined parameter'
40
+ );
36
41
 
37
42
  return result;
38
43
  });
39
44
 
40
45
  it('GetContent timeout defaults to 30s', async () => {
41
- const result = webex.internal.ediscovery.getContent(uuid)
42
- .then(() => {
43
- sinon.assert.calledWith(webex.request, sinon.match.has('timeout', defaultTimeout));
44
- });
46
+ const result = webex.internal.ediscovery.getContent(uuid).then(() => {
47
+ sinon.assert.calledWith(webex.request, sinon.match.has('timeout', defaultTimeout));
48
+ });
45
49
 
46
50
  return result;
47
51
  });
48
52
 
49
53
  it('GetContent timeout defaults to 30s when other options are specified', async () => {
50
- const result = webex.internal.ediscovery.getContent(uuid, {offset: 0, size: 1})
51
- .then(() => {
52
- sinon.assert.calledWith(webex.request, sinon.match.has('timeout', defaultTimeout));
53
- });
54
+ const result = webex.internal.ediscovery.getContent(uuid, {offset: 0, size: 1}).then(() => {
55
+ sinon.assert.calledWith(webex.request, sinon.match.has('timeout', defaultTimeout));
56
+ });
54
57
 
55
58
  return result;
56
59
  });
57
60
 
58
61
  it('GetContent timeout can be overwritten to 5s with timeout as the only option', async () => {
59
- const result = webex.internal.ediscovery.getContent(uuid, {timeoutMs: 5000})
60
- .then(() => {
61
- sinon.assert.calledWith(webex.request, sinon.match.has('timeout', 5000));
62
- });
62
+ const result = webex.internal.ediscovery.getContent(uuid, {timeoutMs: 5000}).then(() => {
63
+ sinon.assert.calledWith(webex.request, sinon.match.has('timeout', 5000));
64
+ });
63
65
 
64
66
  return result;
65
67
  });
66
68
 
67
69
  it('GetContent timeout can be overwritten to 5s when other options are specified', async () => {
68
- const result = webex.internal.ediscovery.getContent(uuid, {offset: 0, size: 1, timeoutMs: 5000})
70
+ const result = webex.internal.ediscovery
71
+ .getContent(uuid, {offset: 0, size: 1, timeoutMs: 5000})
69
72
  .then(() => {
70
73
  sinon.assert.calledWith(webex.request, sinon.match.has('timeout', 5000));
71
74
  sinon.assert.calledWith(webex.request, sinon.match.has('qs', {offset: 0, size: 1}));
@@ -77,7 +80,8 @@ describe('EDiscovery Content API Tests', () => {
77
80
  it('GetContent makes one request when called multiple times with identical params', async () => {
78
81
  webex.internal.ediscovery.getContent(uuid, {offset: 0, size: 1, timeoutMs: 5000});
79
82
  webex.internal.ediscovery.getContent(uuid, {offset: 0, size: 1, timeoutMs: 5000});
80
- const result = webex.internal.ediscovery.getContent(uuid, {offset: 0, size: 1, timeoutMs: 5000})
83
+ const result = webex.internal.ediscovery
84
+ .getContent(uuid, {offset: 0, size: 1, timeoutMs: 5000})
81
85
  .then(() => {
82
86
  sinon.assert.calledOnce(webex.request);
83
87
  });
@@ -88,7 +92,8 @@ describe('EDiscovery Content API Tests', () => {
88
92
  it('GetContent makes multiple requests when called multiple times with different params', async () => {
89
93
  webex.internal.ediscovery.getContent(uuid, {offset: 0, size: 1, timeoutMs: 5000});
90
94
  webex.internal.ediscovery.getContent(uuid, {offset: 1, size: 1, timeoutMs: 5000});
91
- const result = webex.internal.ediscovery.getContent(uuid, {offset: 0, size: 2, timeoutMs: 5000})
95
+ const result = webex.internal.ediscovery
96
+ .getContent(uuid, {offset: 0, size: 2, timeoutMs: 5000})
92
97
  .then(() => {
93
98
  sinon.assert.calledThrice(webex.request);
94
99
  });
@@ -99,55 +104,58 @@ describe('EDiscovery Content API Tests', () => {
99
104
 
100
105
  describe('GetContent by url Tests', () => {
101
106
  it('GetContent by url succeeds', async () => {
102
- const result = webex.internal.ediscovery.getContent(url, {offset: 0, size: 1})
103
- .then((res) => {
104
- expect(res.statusCode).equal(200);
105
- });
107
+ const result = webex.internal.ediscovery.getContent(url, {offset: 0, size: 1}).then((res) => {
108
+ expect(res.statusCode).equal(200);
109
+ });
106
110
 
107
111
  return result;
108
112
  });
109
113
 
110
114
  it('GetContent by url fails with no params', async () => {
111
- const result = expect(webex.internal.ediscovery.getContent()).to.be.rejectedWith(Error, 'Undefined parameter');
115
+ const result = expect(webex.internal.ediscovery.getContent()).to.be.rejectedWith(
116
+ Error,
117
+ 'Undefined parameter'
118
+ );
112
119
 
113
120
  return result;
114
121
  });
115
122
 
116
123
  it('GetContent by url fails with a url that does not contain a report id', async () => {
117
- const result = expect(webex.internal.ediscovery.getContent(invalidUrl)).to.be.rejectedWith(Error, 'Report url does not contain a report id');
124
+ const result = expect(webex.internal.ediscovery.getContent(invalidUrl)).to.be.rejectedWith(
125
+ Error,
126
+ 'Report url does not contain a report id'
127
+ );
118
128
 
119
129
  return result;
120
130
  });
121
131
 
122
132
  it('GetContent by url timeout defaults to 30s', async () => {
123
- const result = webex.internal.ediscovery.getContent(url)
124
- .then(() => {
125
- sinon.assert.calledWith(webex.request, sinon.match.has('timeout', defaultTimeout));
126
- });
133
+ const result = webex.internal.ediscovery.getContent(url).then(() => {
134
+ sinon.assert.calledWith(webex.request, sinon.match.has('timeout', defaultTimeout));
135
+ });
127
136
 
128
137
  return result;
129
138
  });
130
139
 
131
140
  it('GetContent by url timeout defaults to 30s when other options are specified', async () => {
132
- const result = webex.internal.ediscovery.getContent(url, {offset: 0, size: 1})
133
- .then(() => {
134
- sinon.assert.calledWith(webex.request, sinon.match.has('timeout', defaultTimeout));
135
- });
141
+ const result = webex.internal.ediscovery.getContent(url, {offset: 0, size: 1}).then(() => {
142
+ sinon.assert.calledWith(webex.request, sinon.match.has('timeout', defaultTimeout));
143
+ });
136
144
 
137
145
  return result;
138
146
  });
139
147
 
140
148
  it('GetContent by url timeout can be overwritten to 5s with timeout as the only option', async () => {
141
- const result = webex.internal.ediscovery.getContent(url, {timeoutMs: 5000})
142
- .then(() => {
143
- sinon.assert.calledWith(webex.request, sinon.match.has('timeout', 5000));
144
- });
149
+ const result = webex.internal.ediscovery.getContent(url, {timeoutMs: 5000}).then(() => {
150
+ sinon.assert.calledWith(webex.request, sinon.match.has('timeout', 5000));
151
+ });
145
152
 
146
153
  return result;
147
154
  });
148
155
 
149
156
  it('GetContent by url timeout can be overwritten to 5s when other options are specified', async () => {
150
- const result = webex.internal.ediscovery.getContent(url, {offset: 0, size: 1, timeoutMs: 5000})
157
+ const result = webex.internal.ediscovery
158
+ .getContent(url, {offset: 0, size: 1, timeoutMs: 5000})
151
159
  .then(() => {
152
160
  sinon.assert.calledWith(webex.request, sinon.match.has('timeout', 5000));
153
161
  sinon.assert.calledWith(webex.request, sinon.match.has('qs', {offset: 0, size: 1}));
@@ -159,7 +167,8 @@ describe('EDiscovery Content API Tests', () => {
159
167
  it('GetContent by url makes one request when called multiple times with identical params', async () => {
160
168
  webex.internal.ediscovery.getContent(url, {offset: 0, size: 1, timeoutMs: 5000});
161
169
  webex.internal.ediscovery.getContent(url, {offset: 0, size: 1, timeoutMs: 5000});
162
- const result = webex.internal.ediscovery.getContent(url, {offset: 0, size: 1, timeoutMs: 5000})
170
+ const result = webex.internal.ediscovery
171
+ .getContent(url, {offset: 0, size: 1, timeoutMs: 5000})
163
172
  .then(() => {
164
173
  sinon.assert.calledOnce(webex.request);
165
174
  });
@@ -170,7 +179,8 @@ describe('EDiscovery Content API Tests', () => {
170
179
  it('GetContent by url makes multiple requests when called multiple times with different params', async () => {
171
180
  webex.internal.ediscovery.getContent(url, {offset: 0, size: 1, timeoutMs: 5000});
172
181
  webex.internal.ediscovery.getContent(url, {offset: 1, size: 1, timeoutMs: 5000});
173
- const result = webex.internal.ediscovery.getContent(url, {offset: 0, size: 2, timeoutMs: 5000})
182
+ const result = webex.internal.ediscovery
183
+ .getContent(url, {offset: 0, size: 2, timeoutMs: 5000})
174
184
  .then(() => {
175
185
  sinon.assert.calledThrice(webex.request);
176
186
  });
@@ -181,7 +191,8 @@ describe('EDiscovery Content API Tests', () => {
181
191
 
182
192
  describe('GetContentContainer Tests', () => {
183
193
  it('GetContentContainer succeeds', async () => {
184
- const result = webex.internal.ediscovery.getContentContainer(uuid, {offset: 0, size: 1})
194
+ const result = webex.internal.ediscovery
195
+ .getContentContainer(uuid, {offset: 0, size: 1})
185
196
  .then((res) => {
186
197
  expect(res.statusCode).equal(200);
187
198
  });
@@ -190,22 +201,25 @@ describe('EDiscovery Content API Tests', () => {
190
201
  });
191
202
 
192
203
  it('GetContentContainer fails with no params', async () => {
193
- const result = expect(webex.internal.ediscovery.getContentContainer()).to.be.rejectedWith(Error, 'Undefined parameter');
204
+ const result = expect(webex.internal.ediscovery.getContentContainer()).to.be.rejectedWith(
205
+ Error,
206
+ 'Undefined parameter'
207
+ );
194
208
 
195
209
  return result;
196
210
  });
197
211
 
198
212
  it('GetContentContainer timeout defaults to 30s', async () => {
199
- const result = webex.internal.ediscovery.getContentContainer(uuid)
200
- .then(() => {
201
- sinon.assert.calledWith(webex.request, sinon.match.has('timeout', defaultTimeout));
202
- });
213
+ const result = webex.internal.ediscovery.getContentContainer(uuid).then(() => {
214
+ sinon.assert.calledWith(webex.request, sinon.match.has('timeout', defaultTimeout));
215
+ });
203
216
 
204
217
  return result;
205
218
  });
206
219
 
207
220
  it('GetContentContainer timeout defaults to 30s when other options are specified', async () => {
208
- const result = webex.internal.ediscovery.getContentContainer(uuid, {offset: 0, size: 1})
221
+ const result = webex.internal.ediscovery
222
+ .getContentContainer(uuid, {offset: 0, size: 1})
209
223
  .then(() => {
210
224
  sinon.assert.calledWith(webex.request, sinon.match.has('timeout', defaultTimeout));
211
225
  });
@@ -214,7 +228,8 @@ describe('EDiscovery Content API Tests', () => {
214
228
  });
215
229
 
216
230
  it('GetContentContainer timeout can be overwritten to 5s with timeout as the only option', async () => {
217
- const result = webex.internal.ediscovery.getContentContainer(uuid, {timeoutMs: 5000})
231
+ const result = webex.internal.ediscovery
232
+ .getContentContainer(uuid, {timeoutMs: 5000})
218
233
  .then(() => {
219
234
  sinon.assert.calledWith(webex.request, sinon.match.has('timeout', 5000));
220
235
  });
@@ -223,9 +238,13 @@ describe('EDiscovery Content API Tests', () => {
223
238
  });
224
239
 
225
240
  it('GetContentContainer timeout can be overwritten to 5s when other options are specified', async () => {
226
- const result = webex.internal.ediscovery.getContentContainer(uuid, {
227
- offset: 0, size: 1, timeoutMs: 5000, types: []
228
- })
241
+ const result = webex.internal.ediscovery
242
+ .getContentContainer(uuid, {
243
+ offset: 0,
244
+ size: 1,
245
+ timeoutMs: 5000,
246
+ types: [],
247
+ })
229
248
  .then(() => {
230
249
  sinon.assert.calledWith(webex.request, sinon.match.has('timeout', 5000));
231
250
  sinon.assert.calledWith(webex.request, sinon.match.has('types', []));
@@ -237,14 +256,24 @@ describe('EDiscovery Content API Tests', () => {
237
256
 
238
257
  it('GetContentContainer makes one request when called multiple times with identical params', async () => {
239
258
  webex.internal.ediscovery.getContentContainer(uuid, {
240
- offset: 0, size: 1, timeoutMs: 5000, types: []
259
+ offset: 0,
260
+ size: 1,
261
+ timeoutMs: 5000,
262
+ types: [],
241
263
  });
242
264
  webex.internal.ediscovery.getContentContainer(uuid, {
243
- offset: 0, size: 1, timeoutMs: 5000, types: []
265
+ offset: 0,
266
+ size: 1,
267
+ timeoutMs: 5000,
268
+ types: [],
244
269
  });
245
- const result = webex.internal.ediscovery.getContentContainer(uuid, {
246
- offset: 0, size: 1, timeoutMs: 5000, types: []
247
- })
270
+ const result = webex.internal.ediscovery
271
+ .getContentContainer(uuid, {
272
+ offset: 0,
273
+ size: 1,
274
+ timeoutMs: 5000,
275
+ types: [],
276
+ })
248
277
  .then(() => {
249
278
  sinon.assert.calledOnce(webex.request);
250
279
  });
@@ -254,14 +283,24 @@ describe('EDiscovery Content API Tests', () => {
254
283
 
255
284
  it('GetContentContainer makes multiple requests when called multiple times with different params', async () => {
256
285
  webex.internal.ediscovery.getContentContainer(uuid, {
257
- offset: 0, size: 1, timeoutMs: 5000, types: ['MEETING']
286
+ offset: 0,
287
+ size: 1,
288
+ timeoutMs: 5000,
289
+ types: ['MEETING'],
258
290
  });
259
291
  webex.internal.ediscovery.getContentContainer(uuid, {
260
- offset: 0, size: 1, timeoutMs: 5000, types: ['SPACE']
292
+ offset: 0,
293
+ size: 1,
294
+ timeoutMs: 5000,
295
+ types: ['SPACE'],
261
296
  });
262
- const result = webex.internal.ediscovery.getContentContainer(uuid, {
263
- offset: 0, size: 1, timeoutMs: 5000, types: undefined
264
- })
297
+ const result = webex.internal.ediscovery
298
+ .getContentContainer(uuid, {
299
+ offset: 0,
300
+ size: 1,
301
+ timeoutMs: 5000,
302
+ types: undefined,
303
+ })
265
304
  .then(() => {
266
305
  sinon.assert.calledThrice(webex.request);
267
306
  });
@@ -277,9 +316,10 @@ describe('EDiscovery Content API Tests', () => {
277
316
  webex.internal.ediscovery.contentContainerCache = {
278
317
  set: sinon.stub(),
279
318
  has: sinon.stub().returns(false),
280
- clear: sinon.stub()
319
+ clear: sinon.stub(),
281
320
  };
282
- const result = webex.internal.ediscovery.getContentContainer(uuid, {offset: 0, size: 1})
321
+ const result = webex.internal.ediscovery
322
+ .getContentContainer(uuid, {offset: 0, size: 1})
283
323
  .then(() => {
284
324
  assert.calledWith(webex.internal.ediscovery.contentContainerCache.has, uuid);
285
325
  assert.calledWith(webex.internal.ediscovery.contentContainerCache.set, uuid, new Map());
@@ -293,16 +333,17 @@ describe('EDiscovery Content API Tests', () => {
293
333
  const containerIdMap = {
294
334
  get: sinon.stub().withArgs(uuid).returns(mockCachedContainer),
295
335
  set: sinon.stub(),
296
- has: sinon.stub().returns(true)
336
+ has: sinon.stub().returns(true),
297
337
  };
298
338
 
299
339
  webex.internal.ediscovery.contentContainerCache = {
300
340
  get: sinon.stub().withArgs(uuid).returns(containerIdMap),
301
341
  set: sinon.stub(),
302
342
  has: sinon.stub().returns(true),
303
- clear: sinon.stub()
343
+ clear: sinon.stub(),
304
344
  };
305
- const result = webex.internal.ediscovery.getContentContainer(uuid, {offset: 0, size: 1})
345
+ const result = webex.internal.ediscovery
346
+ .getContentContainer(uuid, {offset: 0, size: 1})
306
347
  .then((res) => {
307
348
  expect(res).to.not.equal(mockCachedContainer);
308
349
  assert.callCount(webex.internal.ediscovery.contentContainerCache.has, 0);
@@ -320,19 +361,24 @@ describe('EDiscovery Content API Tests', () => {
320
361
 
321
362
  const containerIdMap = {
322
363
  set: sinon.stub(),
323
- has: sinon.stub().returns(false)
364
+ has: sinon.stub().returns(false),
324
365
  };
325
366
 
326
367
  webex.internal.ediscovery.contentContainerCache = {
327
368
  get: sinon.stub().withArgs(uuid).returns(containerIdMap),
328
369
  has: sinon.stub().returns(true),
329
- clear: sinon.stub()
370
+ clear: sinon.stub(),
330
371
  };
331
- const result = webex.internal.ediscovery.getContentContainer(uuid, {offset: 0, size: 1})
372
+ const result = webex.internal.ediscovery
373
+ .getContentContainer(uuid, {offset: 0, size: 1})
332
374
  .then((res) => {
333
375
  expect(res).to.equal(mockResponse);
334
376
  assert.callCount(webex.internal.ediscovery.contentContainerCache.has, 1);
335
- assert.calledWith(containerIdMap.set, mockResponse.body[0].containerId, mockResponse.body[0]);
377
+ assert.calledWith(
378
+ containerIdMap.set,
379
+ mockResponse.body[0].containerId,
380
+ mockResponse.body[0]
381
+ );
336
382
  });
337
383
 
338
384
  return result;
@@ -341,7 +387,8 @@ describe('EDiscovery Content API Tests', () => {
341
387
 
342
388
  describe('GetContentContainer by url Tests', () => {
343
389
  it('GetContentContainer succeeds', async () => {
344
- const result = webex.internal.ediscovery.getContentContainer(url, {offset: 0, size: 1})
390
+ const result = webex.internal.ediscovery
391
+ .getContentContainer(url, {offset: 0, size: 1})
345
392
  .then((res) => {
346
393
  expect(res.statusCode).equal(200);
347
394
  });
@@ -350,28 +397,33 @@ describe('EDiscovery Content API Tests', () => {
350
397
  });
351
398
 
352
399
  it('GetContentContainer by url fails with no params', async () => {
353
- const result = expect(webex.internal.ediscovery.getContentContainer()).to.be.rejectedWith(Error, 'Undefined parameter');
400
+ const result = expect(webex.internal.ediscovery.getContentContainer()).to.be.rejectedWith(
401
+ Error,
402
+ 'Undefined parameter'
403
+ );
354
404
 
355
405
  return result;
356
406
  });
357
407
 
358
408
  it('GetContentContainer by url fails with a url that does not contain a report id', async () => {
359
- const result = expect(webex.internal.ediscovery.getContentContainer(invalidUrl)).to.be.rejectedWith(Error, 'Report url does not contain a report id');
409
+ const result = expect(
410
+ webex.internal.ediscovery.getContentContainer(invalidUrl)
411
+ ).to.be.rejectedWith(Error, 'Report url does not contain a report id');
360
412
 
361
413
  return result;
362
414
  });
363
415
 
364
416
  it('GetContentContainer by url timeout defaults to 30s', async () => {
365
- const result = webex.internal.ediscovery.getContentContainer(url)
366
- .then(() => {
367
- sinon.assert.calledWith(webex.request, sinon.match.has('timeout', defaultTimeout));
368
- });
417
+ const result = webex.internal.ediscovery.getContentContainer(url).then(() => {
418
+ sinon.assert.calledWith(webex.request, sinon.match.has('timeout', defaultTimeout));
419
+ });
369
420
 
370
421
  return result;
371
422
  });
372
423
 
373
424
  it('GetContentContainer by url timeout defaults to 30s when other options are specified', async () => {
374
- const result = webex.internal.ediscovery.getContentContainer(url, {offset: 0, size: 1})
425
+ const result = webex.internal.ediscovery
426
+ .getContentContainer(url, {offset: 0, size: 1})
375
427
  .then(() => {
376
428
  sinon.assert.calledWith(webex.request, sinon.match.has('timeout', defaultTimeout));
377
429
  });
@@ -380,7 +432,8 @@ describe('EDiscovery Content API Tests', () => {
380
432
  });
381
433
 
382
434
  it('GetContentContainer by url timeout can be overwritten to 5s with timeout as the only option', async () => {
383
- const result = webex.internal.ediscovery.getContentContainer(url, {timeoutMs: 5000})
435
+ const result = webex.internal.ediscovery
436
+ .getContentContainer(url, {timeoutMs: 5000})
384
437
  .then(() => {
385
438
  sinon.assert.calledWith(webex.request, sinon.match.has('timeout', 5000));
386
439
  });
@@ -389,7 +442,8 @@ describe('EDiscovery Content API Tests', () => {
389
442
  });
390
443
 
391
444
  it('GetContentContainer by url timeout can be overwritten to 5s when other options are specified', async () => {
392
- const result = webex.internal.ediscovery.getContentContainer(url, {offset: 0, size: 1, timeoutMs: 5000})
445
+ const result = webex.internal.ediscovery
446
+ .getContentContainer(url, {offset: 0, size: 1, timeoutMs: 5000})
393
447
  .then(() => {
394
448
  sinon.assert.calledWith(webex.request, sinon.match.has('timeout', 5000));
395
449
  sinon.assert.calledWith(webex.request, sinon.match.has('qs', {offset: 0, size: 1}));
@@ -400,14 +454,24 @@ describe('EDiscovery Content API Tests', () => {
400
454
 
401
455
  it('GetContentContainer by url makes one request when called multiple times with identical params', async () => {
402
456
  webex.internal.ediscovery.getContentContainer(url, {
403
- offset: 0, size: 1, timeoutMs: 5000, types: []
457
+ offset: 0,
458
+ size: 1,
459
+ timeoutMs: 5000,
460
+ types: [],
404
461
  });
405
462
  webex.internal.ediscovery.getContentContainer(url, {
406
- offset: 0, size: 1, timeoutMs: 5000, types: []
463
+ offset: 0,
464
+ size: 1,
465
+ timeoutMs: 5000,
466
+ types: [],
407
467
  });
408
- const result = webex.internal.ediscovery.getContentContainer(url, {
409
- offset: 0, size: 1, timeoutMs: 5000, types: []
410
- })
468
+ const result = webex.internal.ediscovery
469
+ .getContentContainer(url, {
470
+ offset: 0,
471
+ size: 1,
472
+ timeoutMs: 5000,
473
+ types: [],
474
+ })
411
475
  .then(() => {
412
476
  sinon.assert.calledOnce(webex.request);
413
477
  });
@@ -417,14 +481,24 @@ describe('EDiscovery Content API Tests', () => {
417
481
 
418
482
  it('GetContentContainer by url makes multiple requests when called multiple times with different types', async () => {
419
483
  webex.internal.ediscovery.getContentContainer(url, {
420
- offset: 0, size: 1, timeoutMs: 5000, types: ['MEETING']
484
+ offset: 0,
485
+ size: 1,
486
+ timeoutMs: 5000,
487
+ types: ['MEETING'],
421
488
  });
422
489
  webex.internal.ediscovery.getContentContainer(url, {
423
- offset: 0, size: 1, timeoutMs: 5000, types: ['SPACE']
490
+ offset: 0,
491
+ size: 1,
492
+ timeoutMs: 5000,
493
+ types: ['SPACE'],
424
494
  });
425
- const result = webex.internal.ediscovery.getContentContainer(url, {
426
- offset: 0, size: 1, timeoutMs: 5000, types: undefined
427
- })
495
+ const result = webex.internal.ediscovery
496
+ .getContentContainer(url, {
497
+ offset: 0,
498
+ size: 1,
499
+ timeoutMs: 5000,
500
+ types: undefined,
501
+ })
428
502
  .then(() => {
429
503
  sinon.assert.calledThrice(webex.request);
430
504
  });
@@ -440,9 +514,10 @@ describe('EDiscovery Content API Tests', () => {
440
514
  webex.internal.ediscovery.contentContainerCache = {
441
515
  set: sinon.stub(),
442
516
  has: sinon.stub().returns(false),
443
- clear: sinon.stub()
517
+ clear: sinon.stub(),
444
518
  };
445
- const result = webex.internal.ediscovery.getContentContainer(url, {offset: 0, size: 1})
519
+ const result = webex.internal.ediscovery
520
+ .getContentContainer(url, {offset: 0, size: 1})
446
521
  .then(() => {
447
522
  assert.calledWith(webex.internal.ediscovery.contentContainerCache.has, uuid);
448
523
  assert.calledWith(webex.internal.ediscovery.contentContainerCache.set, uuid, new Map());
@@ -456,16 +531,17 @@ describe('EDiscovery Content API Tests', () => {
456
531
  const containerIdMap = {
457
532
  get: sinon.stub().withArgs(uuid).returns(mockCachedContainer),
458
533
  set: sinon.stub(),
459
- has: sinon.stub().returns(true)
534
+ has: sinon.stub().returns(true),
460
535
  };
461
536
 
462
537
  webex.internal.ediscovery.contentContainerCache = {
463
538
  get: sinon.stub().withArgs(uuid).returns(containerIdMap),
464
539
  set: sinon.stub(),
465
540
  has: sinon.stub().returns(true),
466
- clear: sinon.stub()
541
+ clear: sinon.stub(),
467
542
  };
468
- const result = webex.internal.ediscovery.getContentContainer(url, {offset: 0, size: 1})
543
+ const result = webex.internal.ediscovery
544
+ .getContentContainer(url, {offset: 0, size: 1})
469
545
  .then((res) => {
470
546
  expect(res).to.not.equal(mockCachedContainer);
471
547
  assert.callCount(webex.internal.ediscovery.contentContainerCache.has, 0);
@@ -483,19 +559,24 @@ describe('EDiscovery Content API Tests', () => {
483
559
 
484
560
  const containerIdMap = {
485
561
  set: sinon.stub(),
486
- has: sinon.stub().returns(false)
562
+ has: sinon.stub().returns(false),
487
563
  };
488
564
 
489
565
  webex.internal.ediscovery.contentContainerCache = {
490
566
  get: sinon.stub().withArgs(uuid).returns(containerIdMap),
491
567
  has: sinon.stub().returns(true),
492
- clear: sinon.stub()
568
+ clear: sinon.stub(),
493
569
  };
494
- const result = webex.internal.ediscovery.getContentContainer(url, {offset: 0, size: 1})
570
+ const result = webex.internal.ediscovery
571
+ .getContentContainer(url, {offset: 0, size: 1})
495
572
  .then((res) => {
496
573
  expect(res).to.equal(mockResponse);
497
574
  assert.callCount(webex.internal.ediscovery.contentContainerCache.has, 1);
498
- assert.calledWith(containerIdMap.set, mockResponse.body[0].containerId, mockResponse.body[0]);
575
+ assert.calledWith(
576
+ containerIdMap.set,
577
+ mockResponse.body[0].containerId,
578
+ mockResponse.body[0]
579
+ );
499
580
  });
500
581
 
501
582
  return result;
@@ -504,7 +585,8 @@ describe('EDiscovery Content API Tests', () => {
504
585
 
505
586
  describe('GetContentContainerByContainerId Tests', () => {
506
587
  it('GetContentContainerByContainerId succeeds', async () => {
507
- const result = webex.internal.ediscovery.getContentContainerByContainerId(uuid, uuid)
588
+ const result = webex.internal.ediscovery
589
+ .getContentContainerByContainerId(uuid, uuid)
508
590
  .then((res) => {
509
591
  expect(res).to.not.equal(undefined);
510
592
  });
@@ -513,13 +595,16 @@ describe('EDiscovery Content API Tests', () => {
513
595
  });
514
596
 
515
597
  it('GetContentContainerByContainerId fails with no params', async () => {
516
- const result = expect(webex.internal.ediscovery.getContentContainerByContainerId()).to.be.rejectedWith(Error, 'Undefined parameter');
598
+ const result = expect(
599
+ webex.internal.ediscovery.getContentContainerByContainerId()
600
+ ).to.be.rejectedWith(Error, 'Undefined parameter');
517
601
 
518
602
  return result;
519
603
  });
520
604
 
521
605
  it('GetContentContainerByContainerId timeout defaults to 30s', async () => {
522
- const result = webex.internal.ediscovery.getContentContainerByContainerId(uuid, uuid)
606
+ const result = webex.internal.ediscovery
607
+ .getContentContainerByContainerId(uuid, uuid)
523
608
  .then(() => {
524
609
  sinon.assert.calledWith(webex.request, sinon.match.has('timeout', defaultTimeout));
525
610
  });
@@ -528,7 +613,8 @@ describe('EDiscovery Content API Tests', () => {
528
613
  });
529
614
 
530
615
  it('GetContentContainerByContainerId timeout can be overwritten to 5s with timeout as the only option', async () => {
531
- const result = webex.internal.ediscovery.getContentContainerByContainerId(uuid, uuid, {timeoutMs: 5000})
616
+ const result = webex.internal.ediscovery
617
+ .getContentContainerByContainerId(uuid, uuid, {timeoutMs: 5000})
532
618
  .then(() => {
533
619
  sinon.assert.calledWith(webex.request, sinon.match.has('timeout', 5000));
534
620
  });
@@ -539,7 +625,8 @@ describe('EDiscovery Content API Tests', () => {
539
625
  it('GetContentContainerByContainerId makes one request when called multiple times with identical params', async () => {
540
626
  webex.internal.ediscovery.getContentContainerByContainerId(uuid, uuid, {timeoutMs: 5000});
541
627
  webex.internal.ediscovery.getContentContainerByContainerId(uuid, uuid, {timeoutMs: 5000});
542
- const result = webex.internal.ediscovery.getContentContainerByContainerId(uuid, uuid, {timeoutMs: 5000})
628
+ const result = webex.internal.ediscovery
629
+ .getContentContainerByContainerId(uuid, uuid, {timeoutMs: 5000})
543
630
  .then(() => {
544
631
  sinon.assert.calledOnce(webex.request);
545
632
  });
@@ -548,9 +635,18 @@ describe('EDiscovery Content API Tests', () => {
548
635
  });
549
636
 
550
637
  it('GetContentContainerByContainerId makes multiple requests when called multiple times with different params', async () => {
551
- webex.internal.ediscovery.getContentContainerByContainerId(uuid, '0d4084ce-8cef-43fd-9313-fb64579996ba', {timeoutMs: 5000});
552
- webex.internal.ediscovery.getContentContainerByContainerId(uuid, '089fcf55-3f38-4763-a441-b1c3540404cf', {timeoutMs: 5000});
553
- const result = webex.internal.ediscovery.getContentContainerByContainerId(uuid, uuid, {timeoutMs: 5000})
638
+ webex.internal.ediscovery.getContentContainerByContainerId(
639
+ uuid,
640
+ '0d4084ce-8cef-43fd-9313-fb64579996ba',
641
+ {timeoutMs: 5000}
642
+ );
643
+ webex.internal.ediscovery.getContentContainerByContainerId(
644
+ uuid,
645
+ '089fcf55-3f38-4763-a441-b1c3540404cf',
646
+ {timeoutMs: 5000}
647
+ );
648
+ const result = webex.internal.ediscovery
649
+ .getContentContainerByContainerId(uuid, uuid, {timeoutMs: 5000})
554
650
  .then(() => {
555
651
  sinon.assert.calledThrice(webex.request);
556
652
  });
@@ -566,9 +662,10 @@ describe('EDiscovery Content API Tests', () => {
566
662
  webex.internal.ediscovery.contentContainerCache = {
567
663
  set: sinon.stub(),
568
664
  has: sinon.stub().returns(false),
569
- clear: sinon.stub()
665
+ clear: sinon.stub(),
570
666
  };
571
- const result = webex.internal.ediscovery.getContentContainerByContainerId(uuid, uuid)
667
+ const result = webex.internal.ediscovery
668
+ .getContentContainerByContainerId(uuid, uuid)
572
669
  .then(() => {
573
670
  assert.calledWith(webex.internal.ediscovery.contentContainerCache.has, uuid);
574
671
  assert.calledWith(webex.internal.ediscovery.contentContainerCache.set, uuid, new Map());
@@ -583,16 +680,17 @@ describe('EDiscovery Content API Tests', () => {
583
680
  const containerIdMap = {
584
681
  get: sinon.stub().withArgs(uuid).returns(mockCachedContainer),
585
682
  set: sinon.stub(),
586
- has: sinon.stub().returns(true)
683
+ has: sinon.stub().returns(true),
587
684
  };
588
685
 
589
686
  webex.internal.ediscovery.contentContainerCache = {
590
687
  get: sinon.stub().withArgs(uuid).returns(containerIdMap),
591
688
  set: sinon.stub(),
592
689
  has: sinon.stub().returns(true),
593
- clear: sinon.stub()
690
+ clear: sinon.stub(),
594
691
  };
595
- const result = webex.internal.ediscovery.getContentContainerByContainerId(uuid, uuid)
692
+ const result = webex.internal.ediscovery
693
+ .getContentContainerByContainerId(uuid, uuid)
596
694
  .then((res) => {
597
695
  expect(res.body).to.equal(mockCachedContainer);
598
696
  assert.callCount(webex.internal.ediscovery.contentContainerCache.has, 1);
@@ -610,16 +708,17 @@ describe('EDiscovery Content API Tests', () => {
610
708
 
611
709
  const containerIdMap = {
612
710
  set: sinon.stub(),
613
- has: sinon.stub().returns(false)
711
+ has: sinon.stub().returns(false),
614
712
  };
615
713
 
616
714
  webex.internal.ediscovery.contentContainerCache = {
617
715
  get: sinon.stub().withArgs(uuid).returns(containerIdMap),
618
716
  set: sinon.stub(),
619
717
  has: sinon.stub().returns(true),
620
- clear: sinon.stub()
718
+ clear: sinon.stub(),
621
719
  };
622
- const result = webex.internal.ediscovery.getContentContainerByContainerId(uuid, uuid)
720
+ const result = webex.internal.ediscovery
721
+ .getContentContainerByContainerId(uuid, uuid)
623
722
  .then((res) => {
624
723
  expect(res).to.equal(mockResponse);
625
724
  assert.callCount(webex.internal.ediscovery.contentContainerCache.has, 2);
@@ -637,16 +736,17 @@ describe('EDiscovery Content API Tests', () => {
637
736
 
638
737
  const containerIdMap = {
639
738
  set: sinon.stub(),
640
- has: sinon.stub().returns(false)
739
+ has: sinon.stub().returns(false),
641
740
  };
642
741
 
643
742
  webex.internal.ediscovery.contentContainerCache = {
644
743
  get: sinon.stub().withArgs(uuid).returns(containerIdMap),
645
744
  set: sinon.stub(),
646
745
  has: sinon.stub().returns(true),
647
- clear: sinon.stub()
746
+ clear: sinon.stub(),
648
747
  };
649
- const result = webex.internal.ediscovery.getContentContainerByContainerId(uuid, uuid)
748
+ const result = webex.internal.ediscovery
749
+ .getContentContainerByContainerId(uuid, uuid)
650
750
  .then((res) => {
651
751
  expect(res).to.equal(mockResponse);
652
752
  assert.callCount(webex.internal.ediscovery.contentContainerCache.has, 2);
@@ -660,7 +760,8 @@ describe('EDiscovery Content API Tests', () => {
660
760
 
661
761
  describe('GetContentContainerByContainerId by url Tests', () => {
662
762
  it('GetContentContainerByContainerId by url succeeds', async () => {
663
- const result = webex.internal.ediscovery.getContentContainerByContainerId(url, uuid)
763
+ const result = webex.internal.ediscovery
764
+ .getContentContainerByContainerId(url, uuid)
664
765
  .then((res) => {
665
766
  expect(res).to.not.equal(undefined);
666
767
  });
@@ -669,19 +770,24 @@ describe('EDiscovery Content API Tests', () => {
669
770
  });
670
771
 
671
772
  it('GetContentContainerByContainerId by url fails with no params', async () => {
672
- const result = expect(webex.internal.ediscovery.getContentContainerByContainerId()).to.be.rejectedWith(Error, 'Undefined parameter');
773
+ const result = expect(
774
+ webex.internal.ediscovery.getContentContainerByContainerId()
775
+ ).to.be.rejectedWith(Error, 'Undefined parameter');
673
776
 
674
777
  return result;
675
778
  });
676
779
 
677
780
  it('GetContentContainerByContainerId by url fails with a url that does not contain a report id', async () => {
678
- const result = expect(webex.internal.ediscovery.getContentContainerByContainerId(invalidUrl, uuid)).to.be.rejectedWith(Error, 'Report url does not contain a report id');
781
+ const result = expect(
782
+ webex.internal.ediscovery.getContentContainerByContainerId(invalidUrl, uuid)
783
+ ).to.be.rejectedWith(Error, 'Report url does not contain a report id');
679
784
 
680
785
  return result;
681
786
  });
682
787
 
683
788
  it('GetContentContainerByContainerId by url timeout defaults to 30s', async () => {
684
- const result = webex.internal.ediscovery.getContentContainerByContainerId(url, uuid)
789
+ const result = webex.internal.ediscovery
790
+ .getContentContainerByContainerId(url, uuid)
685
791
  .then(() => {
686
792
  sinon.assert.calledWith(webex.request, sinon.match.has('timeout', defaultTimeout));
687
793
  });
@@ -690,7 +796,8 @@ describe('EDiscovery Content API Tests', () => {
690
796
  });
691
797
 
692
798
  it('GetContentContainerByContainerId by url timeout can be overwritten to 5s with timeout as the only option', async () => {
693
- const result = webex.internal.ediscovery.getContentContainerByContainerId(url, uuid, {timeoutMs: 5000})
799
+ const result = webex.internal.ediscovery
800
+ .getContentContainerByContainerId(url, uuid, {timeoutMs: 5000})
694
801
  .then(() => {
695
802
  sinon.assert.calledWith(webex.request, sinon.match.has('timeout', 5000));
696
803
  });
@@ -701,7 +808,8 @@ describe('EDiscovery Content API Tests', () => {
701
808
  it('GetContentContainerByContainerId by url makes one request when called multiple times with identical params', async () => {
702
809
  webex.internal.ediscovery.getContentContainerByContainerId(url, uuid, {timeoutMs: 5000});
703
810
  webex.internal.ediscovery.getContentContainerByContainerId(url, uuid, {timeoutMs: 5000});
704
- const result = webex.internal.ediscovery.getContentContainerByContainerId(url, uuid, {timeoutMs: 5000})
811
+ const result = webex.internal.ediscovery
812
+ .getContentContainerByContainerId(url, uuid, {timeoutMs: 5000})
705
813
  .then(() => {
706
814
  sinon.assert.calledOnce(webex.request);
707
815
  });
@@ -710,9 +818,18 @@ describe('EDiscovery Content API Tests', () => {
710
818
  });
711
819
 
712
820
  it('GetContentContainerByContainerId by url makes multiple requests when called multiple times with different params', async () => {
713
- webex.internal.ediscovery.getContentContainerByContainerId(url, '0d4084ce-8cef-43fd-9313-fb64579996ba', {timeoutMs: 5000});
714
- webex.internal.ediscovery.getContentContainerByContainerId(url, '089fcf55-3f38-4763-a441-b1c3540404cf', {timeoutMs: 5000});
715
- const result = webex.internal.ediscovery.getContentContainerByContainerId(url, uuid, {timeoutMs: 5000})
821
+ webex.internal.ediscovery.getContentContainerByContainerId(
822
+ url,
823
+ '0d4084ce-8cef-43fd-9313-fb64579996ba',
824
+ {timeoutMs: 5000}
825
+ );
826
+ webex.internal.ediscovery.getContentContainerByContainerId(
827
+ url,
828
+ '089fcf55-3f38-4763-a441-b1c3540404cf',
829
+ {timeoutMs: 5000}
830
+ );
831
+ const result = webex.internal.ediscovery
832
+ .getContentContainerByContainerId(url, uuid, {timeoutMs: 5000})
716
833
  .then(() => {
717
834
  sinon.assert.calledThrice(webex.request);
718
835
  });
@@ -727,7 +844,7 @@ describe('EDiscovery Content API Tests', () => {
727
844
 
728
845
  webex.internal.ediscovery.contentContainerCache = {
729
846
  set: sinon.stub(),
730
- has: sinon.stub().returns(false)
847
+ has: sinon.stub().returns(false),
731
848
  };
732
849
 
733
850
  const result = await webex.internal.ediscovery.getContentContainerByContainerId(url, uuid);
@@ -744,16 +861,17 @@ describe('EDiscovery Content API Tests', () => {
744
861
  const containerIdMap = {
745
862
  get: sinon.stub().withArgs(uuid).returns(mockCachedContainer),
746
863
  set: sinon.stub(),
747
- has: sinon.stub().returns(true)
864
+ has: sinon.stub().returns(true),
748
865
  };
749
866
 
750
867
  webex.internal.ediscovery.contentContainerCache = {
751
868
  get: sinon.stub().withArgs(uuid).returns(containerIdMap),
752
869
  set: sinon.stub(),
753
870
  has: sinon.stub().returns(true),
754
- clear: sinon.stub()
871
+ clear: sinon.stub(),
755
872
  };
756
- const result = webex.internal.ediscovery.getContentContainerByContainerId(url, uuid)
873
+ const result = webex.internal.ediscovery
874
+ .getContentContainerByContainerId(url, uuid)
757
875
  .then((res) => {
758
876
  expect(res.body).to.equal(mockCachedContainer);
759
877
  assert.callCount(webex.internal.ediscovery.contentContainerCache.has, 1);
@@ -771,16 +889,17 @@ describe('EDiscovery Content API Tests', () => {
771
889
 
772
890
  const containerIdMap = {
773
891
  set: sinon.stub(),
774
- has: sinon.stub().returns(false)
892
+ has: sinon.stub().returns(false),
775
893
  };
776
894
 
777
895
  webex.internal.ediscovery.contentContainerCache = {
778
896
  get: sinon.stub().withArgs(uuid).returns(containerIdMap),
779
897
  set: sinon.stub(),
780
898
  has: sinon.stub().returns(true),
781
- clear: sinon.stub()
899
+ clear: sinon.stub(),
782
900
  };
783
- const result = webex.internal.ediscovery.getContentContainerByContainerId(url, uuid)
901
+ const result = webex.internal.ediscovery
902
+ .getContentContainerByContainerId(url, uuid)
784
903
  .then((res) => {
785
904
  expect(res).to.equal(mockResponse);
786
905
  assert.callCount(webex.internal.ediscovery.contentContainerCache.has, 2);
@@ -798,16 +917,17 @@ describe('EDiscovery Content API Tests', () => {
798
917
 
799
918
  const containerIdMap = {
800
919
  set: sinon.stub(),
801
- has: sinon.stub().returns(false)
920
+ has: sinon.stub().returns(false),
802
921
  };
803
922
 
804
923
  webex.internal.ediscovery.contentContainerCache = {
805
924
  get: sinon.stub().withArgs(uuid).returns(containerIdMap),
806
925
  set: sinon.stub(),
807
926
  has: sinon.stub().returns(true),
808
- clear: sinon.stub()
927
+ clear: sinon.stub(),
809
928
  };
810
- const result = webex.internal.ediscovery.getContentContainerByContainerId(url, uuid)
929
+ const result = webex.internal.ediscovery
930
+ .getContentContainerByContainerId(url, uuid)
811
931
  .then((res) => {
812
932
  expect(res).to.equal(mockResponse);
813
933
  assert.callCount(webex.internal.ediscovery.contentContainerCache.has, 2);
@@ -823,26 +943,26 @@ describe('EDiscovery Content API Tests', () => {
823
943
  it('Clear caches of spaces and content containers', async () => {
824
944
  const spaceIdMap = {
825
945
  set: sinon.stub(),
826
- has: sinon.stub().returns(false)
946
+ has: sinon.stub().returns(false),
827
947
  };
828
948
 
829
949
  webex.internal.ediscovery.contentContainerCache = {
830
950
  get: sinon.stub().withArgs(uuid).returns(spaceIdMap),
831
951
  set: sinon.stub(),
832
952
  has: sinon.stub().returns(true),
833
- clear: sinon.stub()
953
+ clear: sinon.stub(),
834
954
  };
835
955
 
836
956
  const containerIdMap = {
837
957
  set: sinon.stub(),
838
- has: sinon.stub().returns(false)
958
+ has: sinon.stub().returns(false),
839
959
  };
840
960
 
841
961
  webex.internal.ediscovery.contentContainerCache = {
842
962
  get: sinon.stub().withArgs(uuid).returns(containerIdMap),
843
963
  set: sinon.stub(),
844
964
  has: sinon.stub().returns(false),
845
- clear: sinon.stub()
965
+ clear: sinon.stub(),
846
966
  };
847
967
 
848
968
  webex.internal.ediscovery.clearCache();
@@ -853,35 +973,39 @@ describe('EDiscovery Content API Tests', () => {
853
973
 
854
974
  describe('PostAuditLog Tests', () => {
855
975
  it('PostAuditLog with valid reportId succeeds', () => {
856
- webex.internal.ediscovery.postAuditLog(uuid, {timeoutMs: 1000})
857
- .then((res) => {
858
- expect(res.statusCode).equal(200);
859
- sinon.assert.calledWith(webex.request, sinon.match.has('timeout', 1000));
860
- });
976
+ webex.internal.ediscovery.postAuditLog(uuid, {timeoutMs: 1000}).then((res) => {
977
+ expect(res.statusCode).equal(200);
978
+ sinon.assert.calledWith(webex.request, sinon.match.has('timeout', 1000));
979
+ });
861
980
  });
862
981
 
863
982
  it('PostAuditLog with no reportId is rejected', () => {
864
983
  const noUuid = '';
865
984
 
866
- expect(webex.internal.ediscovery.postAuditLog(noUuid, {timeoutMs: 1000})).to.be.rejectedWith(Error, 'No report ID specified');
985
+ expect(webex.internal.ediscovery.postAuditLog(noUuid, {timeoutMs: 1000})).to.be.rejectedWith(
986
+ Error,
987
+ 'No report ID specified'
988
+ );
867
989
  });
868
990
 
869
991
  it('PostAuditLog propagates http error on failure', () => {
870
- webex.request = sinon.stub().returns(Promise.resolve({
871
- body: {},
872
- statusCode: 400
873
- }));
874
-
875
- webex.internal.ediscovery.postAuditLog(uuid, {timeoutMs: 1000})
876
- .then((res) => {
877
- expect(res.statusCode).equal(400);
878
- });
992
+ webex.request = sinon.stub().returns(
993
+ Promise.resolve({
994
+ body: {},
995
+ statusCode: 400,
996
+ })
997
+ );
998
+
999
+ webex.internal.ediscovery.postAuditLog(uuid, {timeoutMs: 1000}).then((res) => {
1000
+ expect(res.statusCode).equal(400);
1001
+ });
879
1002
  });
880
1003
  });
881
1004
 
882
1005
  describe('_getReportIdFromUrl Tests', () => {
883
1006
  it('_getReportIdFromUrl of report url', async () => {
884
- const url = 'https://ediscovery-intb.ciscospark.com/ediscovery/api/v1/reports/16bf0d01-b1f7-483b-89a2-915144158fb9';
1007
+ const url =
1008
+ 'https://ediscovery-intb.ciscospark.com/ediscovery/api/v1/reports/16bf0d01-b1f7-483b-89a2-915144158fb9';
885
1009
 
886
1010
  const uuid = webex.internal.ediscovery._getReportIdFromUrl(url);
887
1011
 
@@ -889,7 +1013,8 @@ describe('EDiscovery Content API Tests', () => {
889
1013
  });
890
1014
 
891
1015
  it('_createRequestOptions of report url with multiple uuids', async () => {
892
- const url = 'https://ediscovery-intb.ciscospark.com/ediscovery/api/v1/reports/16bf0d01-b1f7-483b-89a2-915144158fb9/contents/0498830f-1d63-4faa-b53b-35e1b12ccf9f';
1016
+ const url =
1017
+ 'https://ediscovery-intb.ciscospark.com/ediscovery/api/v1/reports/16bf0d01-b1f7-483b-89a2-915144158fb9/contents/0498830f-1d63-4faa-b53b-35e1b12ccf9f';
893
1018
 
894
1019
  const uuid = webex.internal.ediscovery._getReportIdFromUrl(url);
895
1020
 
@@ -899,7 +1024,8 @@ describe('EDiscovery Content API Tests', () => {
899
1024
 
900
1025
  describe('_isUrl Tests', () => {
901
1026
  it('_isUrl with a url', async () => {
902
- const url = 'https://ediscovery-intb.ciscospark.com/ediscovery/api/v1/reports/16bf0d01-b1f7-483b-89a2-915144158fb9';
1027
+ const url =
1028
+ 'https://ediscovery-intb.ciscospark.com/ediscovery/api/v1/reports/16bf0d01-b1f7-483b-89a2-915144158fb9';
903
1029
 
904
1030
  assert(webex.internal.ediscovery._isUrl(url));
905
1031
  });
@@ -917,7 +1043,10 @@ describe('EDiscovery Content API Tests', () => {
917
1043
  it('_createRequestOptions with uuid', async () => {
918
1044
  const uuid = '16bf0d01-b1f7-483b-89a2-915144158fb9';
919
1045
  const resource = '/my/extra/resource/path';
920
- const [options, returnedUUID] = webex.internal.ediscovery._createRequestOptions(uuid, resource);
1046
+ const [options, returnedUUID] = webex.internal.ediscovery._createRequestOptions(
1047
+ uuid,
1048
+ resource
1049
+ );
921
1050
 
922
1051
  expect(uuid).equal(returnedUUID);
923
1052
  expect(options.service).equal('ediscovery');
@@ -925,19 +1054,28 @@ describe('EDiscovery Content API Tests', () => {
925
1054
  });
926
1055
 
927
1056
  it('_createRequestOptions with url', async () => {
928
- const url = 'https://ediscovery-intb.ciscospark.com/ediscovery/api/v1/reports/16bf0d01-b1f7-483b-89a2-915144158fb9';
1057
+ const url =
1058
+ 'https://ediscovery-intb.ciscospark.com/ediscovery/api/v1/reports/16bf0d01-b1f7-483b-89a2-915144158fb9';
929
1059
  const resource = '/my/extra/resource/path';
930
- const [options, returnedUUID] = webex.internal.ediscovery._createRequestOptions(url, resource);
1060
+ const [options, returnedUUID] = webex.internal.ediscovery._createRequestOptions(
1061
+ url,
1062
+ resource
1063
+ );
931
1064
 
932
1065
  expect(returnedUUID).equal('16bf0d01-b1f7-483b-89a2-915144158fb9');
933
1066
  expect(options.url).equal(url + resource);
934
1067
  });
935
1068
 
936
1069
  it('_createRequestOptions with url with details after the uuid', async () => {
937
- const url = 'https://ediscovery-intb.ciscospark.com/ediscovery/api/v1/reports/16bf0d01-b1f7-483b-89a2-915144158fb9';
938
- const urlPlus = 'https://ediscovery-intb.ciscospark.com/ediscovery/api/v1/reports/16bf0d01-b1f7-483b-89a2-915144158fb9/contents/and/more';
1070
+ const url =
1071
+ 'https://ediscovery-intb.ciscospark.com/ediscovery/api/v1/reports/16bf0d01-b1f7-483b-89a2-915144158fb9';
1072
+ const urlPlus =
1073
+ 'https://ediscovery-intb.ciscospark.com/ediscovery/api/v1/reports/16bf0d01-b1f7-483b-89a2-915144158fb9/contents/and/more';
939
1074
  const resource = '/my/extra/resource/path';
940
- const [options, returnedUUID] = webex.internal.ediscovery._createRequestOptions(urlPlus, resource);
1075
+ const [options, returnedUUID] = webex.internal.ediscovery._createRequestOptions(
1076
+ urlPlus,
1077
+ resource
1078
+ );
941
1079
 
942
1080
  expect(returnedUUID).equal('16bf0d01-b1f7-483b-89a2-915144158fb9');
943
1081
  expect(options.url).equal(url + resource);