@webex/internal-plugin-conversation 2.37.0 → 2.37.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.
Files changed (44) hide show
  1. package/README.md +1 -3
  2. package/dist/activities.js +8 -69
  3. package/dist/activities.js.map +1 -1
  4. package/dist/activity-thread-ordering.js +19 -79
  5. package/dist/activity-thread-ordering.js.map +1 -1
  6. package/dist/config.js +1 -7
  7. package/dist/config.js.map +1 -1
  8. package/dist/constants.js +4 -5
  9. package/dist/constants.js.map +1 -1
  10. package/dist/conversation.js +764 -1196
  11. package/dist/conversation.js.map +1 -1
  12. package/dist/convo-error.js +0 -23
  13. package/dist/convo-error.js.map +1 -1
  14. package/dist/decryption-transforms.js +35 -98
  15. package/dist/decryption-transforms.js.map +1 -1
  16. package/dist/encryption-transforms.js +11 -48
  17. package/dist/encryption-transforms.js.map +1 -1
  18. package/dist/index.js +7 -50
  19. package/dist/index.js.map +1 -1
  20. package/dist/share-activity.js +39 -105
  21. package/dist/share-activity.js.map +1 -1
  22. package/dist/to-array.js +9 -11
  23. package/dist/to-array.js.map +1 -1
  24. package/package.json +15 -15
  25. package/src/activities.js +10 -7
  26. package/src/activity-thread-ordering.js +27 -30
  27. package/src/activity-threading.md +68 -49
  28. package/src/config.js +5 -5
  29. package/src/conversation.js +604 -587
  30. package/src/decryption-transforms.js +103 -62
  31. package/src/encryption-transforms.js +103 -83
  32. package/src/index.js +82 -66
  33. package/src/share-activity.js +63 -54
  34. package/src/to-array.js +2 -2
  35. package/test/integration/spec/create.js +184 -118
  36. package/test/integration/spec/encryption.js +250 -186
  37. package/test/integration/spec/get.js +761 -513
  38. package/test/integration/spec/mercury.js +37 -27
  39. package/test/integration/spec/share.js +292 -229
  40. package/test/integration/spec/verbs.js +628 -441
  41. package/test/unit/spec/conversation.js +224 -163
  42. package/test/unit/spec/decrypt-transforms.js +112 -131
  43. package/test/unit/spec/encryption-transforms.js +24 -18
  44. package/test/unit/spec/share-activity.js +37 -40
@@ -8,7 +8,13 @@ import sinon from 'sinon';
8
8
 
9
9
  import Conversation from '@webex/internal-plugin-conversation';
10
10
 
11
- import {rootActivityManager, getLoopCounterFailsafe, noMoreActivitiesManager, bookendManager, activityManager} from '../../../src/activity-thread-ordering';
11
+ import {
12
+ rootActivityManager,
13
+ getLoopCounterFailsafe,
14
+ noMoreActivitiesManager,
15
+ bookendManager,
16
+ activityManager,
17
+ } from '../../../src/activity-thread-ordering';
12
18
  import {ACTIVITY_TYPES, getActivityType, OLDER, NEWER} from '../../../src/activities';
13
19
 
14
20
  describe('plugin-conversation', () => {
@@ -20,8 +26,8 @@ describe('plugin-conversation', () => {
20
26
  beforeEach(() => {
21
27
  webex = new MockWebex({
22
28
  children: {
23
- conversation: Conversation
24
- }
29
+ conversation: Conversation,
30
+ },
25
31
  });
26
32
 
27
33
  webex.internal.services = {};
@@ -53,8 +59,8 @@ describe('plugin-conversation', () => {
53
59
  describe('#_inferConversationUrl', () => {
54
60
  const testConvo = {test: 'convo'};
55
61
 
56
- it('Returns given convo if no id', () => webex.internal.conversation._inferConversationUrl(testConvo)
57
- .then((convo) => {
62
+ it('Returns given convo if no id', () =>
63
+ webex.internal.conversation._inferConversationUrl(testConvo).then((convo) => {
58
64
  assert.notCalled(webex.internal.feature.getFeature);
59
65
  assert.notCalled(webex.internal.services.get);
60
66
  assert.equal(convo.test, 'convo');
@@ -68,22 +74,20 @@ describe('plugin-conversation', () => {
68
74
  it('returns unmodified convo if URL is defined', () => {
69
75
  testConvo.url = 'http://example.com';
70
76
 
71
- return webex.internal.conversation._inferConversationUrl(testConvo)
72
- .then((convo) => {
73
- assert.called(webex.internal.feature.getFeature);
74
- assert.notCalled(webex.internal.services.get);
75
- assert.equal(convo.url, 'http://example.com');
76
- });
77
+ return webex.internal.conversation._inferConversationUrl(testConvo).then((convo) => {
78
+ assert.called(webex.internal.feature.getFeature);
79
+ assert.notCalled(webex.internal.services.get);
80
+ assert.equal(convo.url, 'http://example.com');
81
+ });
77
82
  });
78
83
  it('builds URL if not defined', () => {
79
84
  delete testConvo.url;
80
85
 
81
- return webex.internal.conversation._inferConversationUrl(testConvo)
82
- .then((convo) => {
83
- assert.called(webex.internal.feature.getFeature);
84
- assert.called(webex.internal.services.get);
85
- assert.equal(convo.url, `${convoUrl}/conversations/id1`);
86
- });
86
+ return webex.internal.conversation._inferConversationUrl(testConvo).then((convo) => {
87
+ assert.called(webex.internal.feature.getFeature);
88
+ assert.called(webex.internal.services.get);
89
+ assert.equal(convo.url, `${convoUrl}/conversations/id1`);
90
+ });
87
91
  });
88
92
  });
89
93
  describe('HA is enabled', () => {
@@ -94,22 +98,20 @@ describe('plugin-conversation', () => {
94
98
  it('builds URL if already defined', () => {
95
99
  testConvo.url = 'https://example.com';
96
100
 
97
- return webex.internal.conversation._inferConversationUrl(testConvo)
98
- .then((convo) => {
99
- assert.called(webex.internal.feature.getFeature);
100
- assert.called(webex.internal.services.get);
101
- assert.equal(convo.url, `${convoUrl}/conversations/id1`);
102
- });
101
+ return webex.internal.conversation._inferConversationUrl(testConvo).then((convo) => {
102
+ assert.called(webex.internal.feature.getFeature);
103
+ assert.called(webex.internal.services.get);
104
+ assert.equal(convo.url, `${convoUrl}/conversations/id1`);
105
+ });
103
106
  });
104
107
  it('builds URL if not defined', () => {
105
108
  delete testConvo.url;
106
109
 
107
- return webex.internal.conversation._inferConversationUrl(testConvo)
108
- .then((convo) => {
109
- assert.called(webex.internal.feature.getFeature);
110
- assert.called(webex.internal.services.get);
111
- assert.equal(convo.url, `${convoUrl}/conversations/id1`);
112
- });
110
+ return webex.internal.conversation._inferConversationUrl(testConvo).then((convo) => {
111
+ assert.called(webex.internal.feature.getFeature);
112
+ assert.called(webex.internal.services.get);
113
+ assert.equal(convo.url, `${convoUrl}/conversations/id1`);
114
+ });
113
115
  });
114
116
  });
115
117
  });
@@ -118,9 +120,11 @@ describe('plugin-conversation', () => {
118
120
  it('should not return a promise', () => {
119
121
  try {
120
122
  webex.internal.conversation.getConvoUrl({url: 'convoUrl'}).then();
121
- }
122
- catch (error) {
123
- assert.equal(error.message, 'webex.internal.conversation.getConvoUrl(...).then is not a function');
123
+ } catch (error) {
124
+ assert.equal(
125
+ error.message,
126
+ 'webex.internal.conversation.getConvoUrl(...).then is not a function'
127
+ );
124
128
  }
125
129
  });
126
130
 
@@ -135,13 +139,17 @@ describe('plugin-conversation', () => {
135
139
  it('should convert a "us" cluster to WEBEX_CONVERSATION_DEFAULT_CLUSTER cluster', async () => {
136
140
  await webex.internal.conversation.getUrlFromClusterId({cluster: 'us'});
137
141
 
138
- sinon.assert.calledWith(webex.internal.services.getServiceFromClusterId, {clusterId: process.env.WEBEX_CONVERSATION_DEFAULT_CLUSTER});
142
+ sinon.assert.calledWith(webex.internal.services.getServiceFromClusterId, {
143
+ clusterId: process.env.WEBEX_CONVERSATION_DEFAULT_CLUSTER,
144
+ });
139
145
  });
140
146
 
141
147
  it('should add the cluster service when missing', async () => {
142
148
  await webex.internal.conversation.getUrlFromClusterId({cluster: 'urn:TEAM:us-west-2_r'});
143
149
 
144
- sinon.assert.calledWith(webex.internal.services.getServiceFromClusterId, {clusterId: 'urn:TEAM:us-west-2_r:identityLookup'});
150
+ sinon.assert.calledWith(webex.internal.services.getServiceFromClusterId, {
151
+ clusterId: 'urn:TEAM:us-west-2_r:identityLookup',
152
+ });
145
153
  });
146
154
  });
147
155
 
@@ -149,8 +157,7 @@ describe('plugin-conversation', () => {
149
157
  it('should throw an error if a page is passed with no links', () => {
150
158
  try {
151
159
  webex.internal.conversation.paginate({page: {}});
152
- }
153
- catch (error) {
160
+ } catch (error) {
154
161
  assert.equal(error.message, 'No link to follow for the provided page');
155
162
  }
156
163
  });
@@ -158,32 +165,40 @@ describe('plugin-conversation', () => {
158
165
 
159
166
  describe('#getReactionSummaryByParentId()', () => {
160
167
  beforeEach(() => {
161
- webex.request = sinon.stub().returns(Promise.resolve({
162
- body: {
163
- children: [
164
- {type: 'reactionSelfSummary'},
165
- {type: 'reactionSelfSummary'},
166
- {type: 'reactionSummary'},
167
- {type: 'notAReaction'}
168
- ]
169
- }
170
- }));
168
+ webex.request = sinon.stub().returns(
169
+ Promise.resolve({
170
+ body: {
171
+ children: [
172
+ {type: 'reactionSelfSummary'},
173
+ {type: 'reactionSelfSummary'},
174
+ {type: 'reactionSummary'},
175
+ {type: 'notAReaction'},
176
+ ],
177
+ },
178
+ })
179
+ );
171
180
  });
172
181
 
173
- it('should call request', () => webex.internal.conversation.getReactionSummaryByParentId(convoUrl, 'test-id')
174
- .then(() => {
182
+ it('should call request', () =>
183
+ webex.internal.conversation.getReactionSummaryByParentId(convoUrl, 'test-id').then(() => {
175
184
  assert.called(webex.request);
176
185
  }));
177
186
 
178
- it('should not retrieve non reaction summary objects', () => webex.internal.conversation.getReactionSummaryByParentId(convoUrl, 'test-id')
179
- .then((result) => {
180
- assert.equal(result.length, 3);
181
- assert.notInclude(result, {type: 'notAReaction'});
182
- }));
187
+ it('should not retrieve non reaction summary objects', () =>
188
+ webex.internal.conversation
189
+ .getReactionSummaryByParentId(convoUrl, 'test-id')
190
+ .then((result) => {
191
+ assert.equal(result.length, 3);
192
+ assert.notInclude(result, {type: 'notAReaction'});
193
+ }));
183
194
  });
184
195
 
185
196
  describe('#listAllChildActivitiesByParentId()', () => {
186
- const options = {conversationUrl: convoUrl, activityParentId: '123-abc', query: {activityType: 'reply'}};
197
+ const options = {
198
+ conversationUrl: convoUrl,
199
+ activityParentId: '123-abc',
200
+ query: {activityType: 'reply'},
201
+ };
187
202
  let dayCount = 0;
188
203
  const createActivityItemBatch = (itemCount) => {
189
204
  const counter = [...Array(itemCount).keys()];
@@ -191,54 +206,58 @@ describe('plugin-conversation', () => {
191
206
  dayCount += 1;
192
207
 
193
208
  return counter.map((n) => ({
194
- published: new Date(2020, 0, 1, dayCount, n)
209
+ published: new Date(2020, 0, 1, dayCount, n),
195
210
  }));
196
211
  };
197
212
 
198
213
  const createMockChildResponse = (itemsToReturn = 10) => {
199
214
  const response = {
200
215
  body: {
201
- items: createActivityItemBatch(itemsToReturn)
216
+ items: createActivityItemBatch(itemsToReturn),
202
217
  },
203
218
  headers: {
204
- link: '<https://www.cisco.com>; rel=next'
205
- }
219
+ link: '<https://www.cisco.com>; rel=next',
220
+ },
206
221
  };
207
222
 
208
223
  return response;
209
224
  };
210
225
 
211
226
  beforeEach(() => {
212
- webex.request = sinon.stub()
227
+ webex.request = sinon
228
+ .stub()
213
229
  .onCall(0)
214
230
  .returns(Promise.resolve(createMockChildResponse()))
215
231
  .onCall(1)
216
232
  .returns(Promise.resolve(createMockChildResponse()))
217
233
  .onCall(2)
218
234
  .returns(Promise.resolve(createMockChildResponse(3)))
219
- .returns(Promise.resolve(Promise.resolve({
220
- body: {
221
- items: []
222
- },
223
- headers: {}
224
- })));
225
- });
226
- it('retrieves correct children count', () => webex.internal.conversation.listAllChildActivitiesByParentId(options)
227
- .then((res) => {
235
+ .returns(
236
+ Promise.resolve(
237
+ Promise.resolve({
238
+ body: {
239
+ items: [],
240
+ },
241
+ headers: {},
242
+ })
243
+ )
244
+ );
245
+ });
246
+ it('retrieves correct children count', () =>
247
+ webex.internal.conversation.listAllChildActivitiesByParentId(options).then((res) => {
228
248
  assert.equal(res.length, 23);
229
249
  }));
230
250
 
231
251
  it('calls #listChildActivitiesByParentId() to initiate the request', () => {
232
252
  const spy = sinon.spy(webex.internal.conversation, 'listChildActivitiesByParentId');
233
253
 
234
- return webex.internal.conversation.listAllChildActivitiesByParentId(options)
235
- .then(() => {
236
- assert(spy.calledOnce);
237
- });
254
+ return webex.internal.conversation.listAllChildActivitiesByParentId(options).then(() => {
255
+ assert(spy.calledOnce);
256
+ });
238
257
  });
239
258
 
240
- it('returns children in ascending published order', () => webex.internal.conversation.listAllChildActivitiesByParentId(options)
241
- .then((res) => {
259
+ it('returns children in ascending published order', () =>
260
+ webex.internal.conversation.listAllChildActivitiesByParentId(options).then((res) => {
242
261
  const firstMessageOlderThanLastMessage = res[0].published < res[res.length - 1].published;
243
262
 
244
263
  assert.isTrue(firstMessageOlderThanLastMessage, 'activities out of order');
@@ -249,8 +268,7 @@ describe('plugin-conversation', () => {
249
268
  it('should throw an error when called without a conversationUrl option', (done) => {
250
269
  try {
251
270
  webex.internal.conversation.listActivitiesThreadOrdered({});
252
- }
253
- catch (e) {
271
+ } catch (e) {
254
272
  assert.equal(e.message, 'must provide a conversation URL or conversation ID');
255
273
  done();
256
274
  }
@@ -259,12 +277,17 @@ describe('plugin-conversation', () => {
259
277
  it('calls #_listActivitiesThreadOrdered()', () => {
260
278
  const spy = sinon.spy(webex.internal.conversation, '_listActivitiesThreadOrdered');
261
279
 
262
- webex.internal.conversation.listActivitiesThreadOrdered({conversationUrl: convoUrl, includeChildren: true});
280
+ webex.internal.conversation.listActivitiesThreadOrdered({
281
+ conversationUrl: convoUrl,
282
+ includeChildren: true,
283
+ });
263
284
  sinon.assert.calledWith(spy, {url: convoUrl, includeChildren: true});
264
285
  });
265
286
 
266
287
  it('returns expected wrapped functions', () => {
267
- const functions = webex.internal.conversation.listActivitiesThreadOrdered({conversationUrl: convoUrl});
288
+ const functions = webex.internal.conversation.listActivitiesThreadOrdered({
289
+ conversationUrl: convoUrl,
290
+ });
268
291
 
269
292
  assert.hasAllKeys(functions, ['jumpToActivity', 'getOlder', 'getNewer']);
270
293
  });
@@ -275,16 +298,20 @@ describe('plugin-conversation', () => {
275
298
  beforeEach(() => {
276
299
  webex.internal.conversation._listActivitiesThreadOrdered = sinon.stub().returns({
277
300
  next() {
278
- return new Promise((resolve) => resolve({
279
- value: returnedVal,
280
- next() {}
281
- }));
282
- }
301
+ return new Promise((resolve) =>
302
+ resolve({
303
+ value: returnedVal,
304
+ next() {},
305
+ })
306
+ );
307
+ },
283
308
  });
284
309
  });
285
310
 
286
311
  it('getOlder() should implement the iterator protocol', () => {
287
- const {getOlder} = webex.internal.conversation.listActivitiesThreadOrdered({conversationUrl: convoUrl});
312
+ const {getOlder} = webex.internal.conversation.listActivitiesThreadOrdered({
313
+ conversationUrl: convoUrl,
314
+ });
288
315
 
289
316
  return getOlder().then((result) => {
290
317
  assert.hasAllKeys(result, ['done', 'value']);
@@ -292,7 +319,9 @@ describe('plugin-conversation', () => {
292
319
  });
293
320
 
294
321
  it('getNewer() should implement the iterator protocol', () => {
295
- const {getNewer} = webex.internal.conversation.listActivitiesThreadOrdered({conversationUrl: convoUrl});
322
+ const {getNewer} = webex.internal.conversation.listActivitiesThreadOrdered({
323
+ conversationUrl: convoUrl,
324
+ });
296
325
 
297
326
  return getNewer().then((result) => {
298
327
  assert.hasAllKeys(result, ['done', 'value']);
@@ -301,29 +330,36 @@ describe('plugin-conversation', () => {
301
330
 
302
331
  describe('jumpToActivity()', () => {
303
332
  it('should throw an error if search object is missing', () => {
304
- const {jumpToActivity} = webex.internal.conversation.listActivitiesThreadOrdered({conversationUrl: convoUrl});
333
+ const {jumpToActivity} = webex.internal.conversation.listActivitiesThreadOrdered({
334
+ conversationUrl: convoUrl,
335
+ });
305
336
 
306
337
  try {
307
338
  jumpToActivity();
308
- }
309
- catch (e) {
310
- assert.equal(e.message, 'Search must be an activity object from conversation service');
339
+ } catch (e) {
340
+ assert.equal(
341
+ e.message,
342
+ 'Search must be an activity object from conversation service'
343
+ );
311
344
  }
312
345
  });
313
346
 
314
347
  it('should throw an error if activity.target.url is missing', () => {
315
- const {jumpToActivity} = webex.internal.conversation.listActivitiesThreadOrdered({conversationUrl: convoUrl});
348
+ const {jumpToActivity} = webex.internal.conversation.listActivitiesThreadOrdered({
349
+ conversationUrl: convoUrl,
350
+ });
316
351
 
317
352
  try {
318
353
  assert.throws(jumpToActivity({target: null}));
319
- }
320
- catch (e) {
354
+ } catch (e) {
321
355
  //
322
356
  }
323
357
  });
324
358
 
325
359
  it('should implement the iterator protocol', () => {
326
- const {jumpToActivity} = webex.internal.conversation.listActivitiesThreadOrdered({conversationUrl: convoUrl});
360
+ const {jumpToActivity} = webex.internal.conversation.listActivitiesThreadOrdered({
361
+ conversationUrl: convoUrl,
362
+ });
327
363
 
328
364
  return jumpToActivity({target: {url: 'newUrl'}}).then((result) => {
329
365
  assert.hasAllKeys(result, ['done', 'value']);
@@ -336,8 +372,8 @@ describe('plugin-conversation', () => {
336
372
  describe('activity-thread-ordering helpers', () => {
337
373
  const createSimpleActivityByType = (type) => ({
338
374
  parent: {
339
- type
340
- }
375
+ type,
376
+ },
341
377
  });
342
378
 
343
379
  describe('getActivityType', () => {
@@ -384,8 +420,7 @@ describe('plugin-conversation', () => {
384
420
  externalCount += 1;
385
421
  incrementLoop();
386
422
  }
387
- }
388
- catch (e) {
423
+ } catch (e) {
389
424
  assert.equal(e.message, 'max fetches reached');
390
425
  }
391
426
  });
@@ -404,11 +439,15 @@ describe('plugin-conversation', () => {
404
439
  checkAndSetNoOlderActs = funcs.checkAndSetNoOlderActs;
405
440
  });
406
441
 
407
-
408
442
  it('should return expected exposed functions', () => {
409
443
  const functions = noMoreActivitiesManager();
410
444
 
411
- assert.hasAllKeys(functions, ['getNoMoreActs', 'checkAndSetNoMoreActs', 'checkAndSetNoNewerActs', 'checkAndSetNoOlderActs']);
445
+ assert.hasAllKeys(functions, [
446
+ 'getNoMoreActs',
447
+ 'checkAndSetNoMoreActs',
448
+ 'checkAndSetNoNewerActs',
449
+ 'checkAndSetNoOlderActs',
450
+ ]);
412
451
  });
413
452
 
414
453
  it('should set no more activities when no newer activities exist', () => {
@@ -465,7 +504,7 @@ describe('plugin-conversation', () => {
465
504
  it('should set the oldest and newest activity in a batch', () => {
466
505
  const acts = [
467
506
  {published: createDateISO(1), order: 0},
468
- {published: createDateISO(2), order: 1}
507
+ {published: createDateISO(2), order: 1},
469
508
  ];
470
509
 
471
510
  setBookends(acts);
@@ -476,14 +515,14 @@ describe('plugin-conversation', () => {
476
515
  it('should bookends when newer and older activities exists', () => {
477
516
  const acts = [
478
517
  {published: createDateISO(5), order: 2},
479
- {published: createDateISO(6), order: 3}
518
+ {published: createDateISO(6), order: 3},
480
519
  ];
481
520
 
482
521
  setBookends(acts);
483
522
 
484
523
  const nextActs = [
485
524
  {published: createDateISO(1), order: 1},
486
- {published: createDateISO(9), order: 4}
525
+ {published: createDateISO(9), order: 4},
487
526
  ];
488
527
 
489
528
  setBookends(nextActs);
@@ -495,14 +534,14 @@ describe('plugin-conversation', () => {
495
534
  it('should not update oldest activity when only newer activities exist', () => {
496
535
  const acts = [
497
536
  {published: createDateISO(1), order: 1},
498
- {published: createDateISO(5), order: 2}
537
+ {published: createDateISO(5), order: 2},
499
538
  ];
500
539
 
501
540
  setBookends(acts);
502
541
 
503
542
  const nextActs = [
504
543
  {published: createDateISO(6), order: 3},
505
- {published: createDateISO(9), order: 4}
544
+ {published: createDateISO(9), order: 4},
506
545
  ];
507
546
 
508
547
  setBookends(nextActs);
@@ -535,8 +574,8 @@ describe('plugin-conversation', () => {
535
574
  id: '1',
536
575
  activityType: 'reply',
537
576
  parent: {
538
- id: parentId
539
- }
577
+ id: parentId,
578
+ },
540
579
  };
541
580
  const replyHandler = getActivityHandlerByKey(ACTIVITY_TYPES.REPLY);
542
581
 
@@ -550,8 +589,8 @@ describe('plugin-conversation', () => {
550
589
  id: '2',
551
590
  activityType: 'reply',
552
591
  parent: {
553
- id: parentId
554
- }
592
+ id: parentId,
593
+ },
555
594
  };
556
595
 
557
596
  replyHandler(secondReplyAct);
@@ -562,8 +601,8 @@ describe('plugin-conversation', () => {
562
601
  id: '3',
563
602
  activityType: 'reply',
564
603
  parent: {
565
- id: parentId2
566
- }
604
+ id: parentId2,
605
+ },
567
606
  };
568
607
 
569
608
  replyHandler(thirdReply);
@@ -580,17 +619,17 @@ describe('plugin-conversation', () => {
580
619
  id: 'editId1',
581
620
  parent: {
582
621
  id: parentId,
583
- type: 'edit'
622
+ type: 'edit',
584
623
  },
585
- published: new Date(1, 1, 1, 1, 1).toISOString()
624
+ published: new Date(1, 1, 1, 1, 1).toISOString(),
586
625
  };
587
626
  const tombstoneEdit = {
588
627
  ...editAct,
589
- verb: ACTIVITY_TYPES.TOMBSTONE
628
+ verb: ACTIVITY_TYPES.TOMBSTONE,
590
629
  };
591
630
  const newerEdit = {
592
631
  ...editAct,
593
- published: new Date(1, 1, 1, 1, 3).toISOString()
632
+ published: new Date(1, 1, 1, 1, 3).toISOString(),
594
633
  };
595
634
 
596
635
  editHandler(editAct);
@@ -613,13 +652,13 @@ describe('plugin-conversation', () => {
613
652
  published: new Date(1, 1, 1, 1, 1).toISOString(),
614
653
  type: 'reactionSummary',
615
654
  parent: {
616
- id: parentId
617
- }
655
+ id: parentId,
656
+ },
618
657
  };
619
658
 
620
659
  const newerReaction = {
621
660
  ...reaction,
622
- published: new Date(1, 1, 1, 1, 3).toISOString()
661
+ published: new Date(1, 1, 1, 1, 3).toISOString(),
623
662
  };
624
663
 
625
664
  reactionHandler(reaction);
@@ -628,7 +667,10 @@ describe('plugin-conversation', () => {
628
667
 
629
668
  reactionHandler(newerReaction);
630
669
 
631
- assert.equal(getActivityByTypeAndParentId(ACTIVITY_TYPES.REACTION, parentId), newerReaction);
670
+ assert.equal(
671
+ getActivityByTypeAndParentId(ACTIVITY_TYPES.REACTION, parentId),
672
+ newerReaction
673
+ );
632
674
  });
633
675
  });
634
676
  });
@@ -636,16 +678,16 @@ describe('plugin-conversation', () => {
636
678
  describe('#_createParsedServerActivity()', () => {
637
679
  const activities = {
638
680
  root1: {
639
- id: 'root1'
681
+ id: 'root1',
640
682
  },
641
683
  reply1: {
642
684
  id: 'reply1',
643
685
  activityType: 'reply',
644
686
  parent: {
645
687
  id: 1,
646
- type: 'reply'
647
- }
648
- }
688
+ type: 'reply',
689
+ },
690
+ },
649
691
  };
650
692
 
651
693
  it('should add editParent field to valid edit activity', () => {
@@ -653,11 +695,14 @@ describe('plugin-conversation', () => {
653
695
  id: 'edit1',
654
696
  parent: {
655
697
  id: 'root1',
656
- type: 'edit'
657
- }
698
+ type: 'edit',
699
+ },
658
700
  };
659
701
 
660
- const parsedActivity = webex.internal.conversation._createParsedServerActivity(activity, activities);
702
+ const parsedActivity = webex.internal.conversation._createParsedServerActivity(
703
+ activity,
704
+ activities
705
+ );
661
706
 
662
707
  assert.containsAllKeys(parsedActivity, ['editParent']);
663
708
  });
@@ -668,11 +713,14 @@ describe('plugin-conversation', () => {
668
713
  activityType: 'reply',
669
714
  parent: {
670
715
  id: 'root1',
671
- type: 'reply'
672
- }
716
+ type: 'reply',
717
+ },
673
718
  };
674
719
 
675
- const parsedActivity = webex.internal.conversation._createParsedServerActivity(activity, activities);
720
+ const parsedActivity = webex.internal.conversation._createParsedServerActivity(
721
+ activity,
722
+ activities
723
+ );
676
724
 
677
725
  assert.containsAllKeys(parsedActivity, ['replyParent']);
678
726
  });
@@ -682,11 +730,14 @@ describe('plugin-conversation', () => {
682
730
  id: 'replyEdit1',
683
731
  parent: {
684
732
  id: 'reply1',
685
- type: 'edit'
686
- }
733
+ type: 'edit',
734
+ },
687
735
  };
688
736
 
689
- const parsedActivity = webex.internal.conversation._createParsedServerActivity(activity, activities);
737
+ const parsedActivity = webex.internal.conversation._createParsedServerActivity(
738
+ activity,
739
+ activities
740
+ );
690
741
 
691
742
  assert.containsAllKeys(parsedActivity, ['replyParent', 'editParent']);
692
743
  });
@@ -695,14 +746,15 @@ describe('plugin-conversation', () => {
695
746
  const activity = {
696
747
  id: 'throwAct1',
697
748
  parent: {
698
- id: 'root2'
699
- }
749
+ id: 'root2',
750
+ },
700
751
  };
701
752
 
702
753
  try {
703
- assert.throws(webex.internal.conversation._createParsedServerActivity(activity, activities));
704
- }
705
- catch (e) {
754
+ assert.throws(
755
+ webex.internal.conversation._createParsedServerActivity(activity, activities)
756
+ );
757
+ } catch (e) {
706
758
  // swallow error
707
759
  }
708
760
  });
@@ -717,50 +769,59 @@ describe('plugin-conversation', () => {
717
769
  it('should reject if provided param is not an object', () => {
718
770
  const request = webex.internal.conversation.delete(testConvo, 'hello');
719
771
 
720
- return request.then(() => {
721
- assert.equal(true, false, 'should have rejected');
722
- })
772
+ return request
773
+ .then(() => {
774
+ assert.equal(true, false, 'should have rejected');
775
+ })
723
776
  .catch(() => {
724
777
  assert.equal(true, true, 'object is not type object, rejects as expected');
725
778
  });
726
779
  });
727
780
  it('deletes a non-meeting container activity', () => {
728
- webex.internal.conversation.prepare = sinon.stub().callsFake((activity, request) => Promise.resolve({activity, request}));
781
+ webex.internal.conversation.prepare = sinon
782
+ .stub()
783
+ .callsFake((activity, request) => Promise.resolve({activity, request}));
729
784
  webex.internal.conversation.submit = sinon.stub().callsFake((p) => Promise.resolve(p));
730
785
 
731
786
  // fix this to look like below
732
- const request = webex.internal.conversation.delete(testConvo, {
733
- id: 'activity-id-1',
734
- url: 'https://example.com/activity1',
735
- object: {objectType: 'activity'}
736
- },
737
- {
738
- object:
739
- {objectType: 'activity'}
740
- });
787
+ const request = webex.internal.conversation.delete(
788
+ testConvo,
789
+ {
790
+ id: 'activity-id-1',
791
+ url: 'https://example.com/activity1',
792
+ object: {objectType: 'activity'},
793
+ },
794
+ {
795
+ object: {objectType: 'activity'},
796
+ }
797
+ );
741
798
 
742
799
  return request.then(({request}) => {
743
800
  assert.isUndefined(request.kmsMessage);
744
801
  });
745
802
  });
746
803
  it('deletes a meeting container activity', () => {
747
- webex.internal.conversation.prepare = sinon.stub().callsFake((activity, request) => Promise.resolve({activity, request}));
804
+ webex.internal.conversation.prepare = sinon
805
+ .stub()
806
+ .callsFake((activity, request) => Promise.resolve({activity, request}));
748
807
  webex.internal.conversation.submit = sinon.stub().callsFake((p) => Promise.resolve(p));
749
808
 
750
- const request = webex.internal.conversation.delete(testConvo, {
751
- id: 'activity-id-2',
752
- url: 'https://example.com/activity2',
753
- object: {
754
- kmsResourceObjectUrl: 'kms://example',
755
- objectType: 'meetingContainer'
756
- }
757
- },
758
- {
759
- object: {
760
- objectType: 'meetingContainer'
809
+ const request = webex.internal.conversation.delete(
810
+ testConvo,
811
+ {
812
+ id: 'activity-id-2',
813
+ url: 'https://example.com/activity2',
814
+ object: {
815
+ kmsResourceObjectUrl: 'kms://example',
816
+ objectType: 'meetingContainer',
817
+ },
818
+ },
819
+ {
820
+ object: {
821
+ objectType: 'meetingContainer',
822
+ },
761
823
  }
762
- });
763
-
824
+ );
764
825
 
765
826
  return request.then(({request}) => {
766
827
  assert.equal(request.kmsMessage.method, 'delete');