@webex/internal-plugin-mercury 3.0.0-beta.9 → 3.0.0-beta.91

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.
@@ -16,19 +16,15 @@ import promiseTick from '../lib/promise-tick';
16
16
  describe('plugin-mercury', () => {
17
17
  describe('Mercury', () => {
18
18
  describe('Events', () => {
19
- let clock,
20
- mercury,
21
- mockWebSocket,
22
- socketOpenStub,
23
- webex;
19
+ let clock, mercury, mockWebSocket, socketOpenStub, webex;
24
20
 
25
21
  const fakeTestMessage = {
26
22
  id: uuid.v4(),
27
23
  data: {
28
- eventType: 'fake.test'
24
+ eventType: 'fake.test',
29
25
  },
30
26
  timestamp: Date.now(),
31
- trackingId: `suffix_${uuid.v4()}_${Date.now()}`
27
+ trackingId: `suffix_${uuid.v4()}_${Date.now()}`,
32
28
  };
33
29
 
34
30
  const statusStartTypingMessage = {
@@ -36,12 +32,12 @@ describe('plugin-mercury', () => {
36
32
  data: {
37
33
  eventType: 'status.start_typing',
38
34
  actor: {
39
- id: 'actorId'
35
+ id: 'actorId',
40
36
  },
41
- conversationId: uuid.v4()
37
+ conversationId: uuid.v4(),
42
38
  },
43
39
  timestamp: Date.now(),
44
- trackingId: `suffix_${uuid.v4()}_${Date.now()}`
40
+ trackingId: `suffix_${uuid.v4()}_${Date.now()}`,
45
41
  };
46
42
 
47
43
  beforeEach(() => {
@@ -55,8 +51,8 @@ describe('plugin-mercury', () => {
55
51
  beforeEach(() => {
56
52
  webex = new MockWebex({
57
53
  children: {
58
- mercury: Mercury
59
- }
54
+ mercury: Mercury,
55
+ },
60
56
  });
61
57
 
62
58
  webex.internal.metrics.submitClientMetrics = sinon.stub();
@@ -100,8 +96,7 @@ describe('plugin-mercury', () => {
100
96
 
101
97
  mockWebSocket.open();
102
98
 
103
- return promise
104
- .then(() => assert.called(spy));
99
+ return promise.then(() => assert.called(spy));
105
100
  });
106
101
  });
107
102
 
@@ -120,7 +115,7 @@ describe('plugin-mercury', () => {
120
115
 
121
116
  mockWebSocket.emit('close', {
122
117
  code: 1000,
123
- reason: 'Done'
118
+ reason: 'Done',
124
119
  });
125
120
 
126
121
  return promise;
@@ -173,9 +168,9 @@ describe('plugin-mercury', () => {
173
168
  data: JSON.stringify({
174
169
  id: uuid.v4(),
175
170
  data: {
176
- eventType: 'mercury.buffer_state'
177
- }
178
- })
171
+ eventType: 'mercury.buffer_state',
172
+ },
173
+ }),
179
174
  });
180
175
  // using lengthOf because notCalled doesn't allow the helpful
181
176
  // string assertion
@@ -185,8 +180,7 @@ describe('plugin-mercury', () => {
185
180
  .then(() => {
186
181
  assert.calledOnce(bufferStateSpy);
187
182
 
188
- return mercury.connect()
189
- .then(done);
183
+ return mercury.connect().then(done);
190
184
  })
191
185
  .catch(done);
192
186
  });
@@ -211,54 +205,54 @@ describe('plugin-mercury', () => {
211
205
  {
212
206
  code: 1000,
213
207
  reason: 'idle',
214
- action: 'reconnect'
208
+ action: 'reconnect',
215
209
  },
216
210
  {
217
211
  code: 1000,
218
212
  reason: 'done (forced)',
219
- action: 'reconnect'
213
+ action: 'reconnect',
220
214
  },
221
215
  {
222
216
  code: 1000,
223
217
  reason: 'pong not received',
224
- action: 'reconnect'
218
+ action: 'reconnect',
225
219
  },
226
220
  {
227
221
  code: 1000,
228
222
  reason: 'pong mismatch',
229
- action: 'reconnect'
223
+ action: 'reconnect',
230
224
  },
231
225
  {
232
226
  code: 1000,
233
- action: 'close'
227
+ action: 'close',
234
228
  },
235
229
  {
236
230
  code: 1003,
237
- action: 'close'
231
+ action: 'close',
238
232
  },
239
233
  {
240
234
  code: 1001,
241
- action: 'reconnect'
235
+ action: 'reconnect',
242
236
  },
243
237
  {
244
238
  code: 1005,
245
- action: 'reconnect'
239
+ action: 'reconnect',
246
240
  },
247
241
  {
248
242
  code: 1006,
249
- action: 'reconnect'
243
+ action: 'reconnect',
250
244
  },
251
245
  {
252
246
  code: 1011,
253
- action: 'reconnect'
247
+ action: 'reconnect',
254
248
  },
255
249
  {
256
250
  code: 4000,
257
- action: 'replace'
251
+ action: 'replace',
258
252
  },
259
253
  {
260
- action: 'close'
261
- }
254
+ action: 'close',
255
+ },
262
256
  ];
263
257
 
264
258
  events.forEach((def) => {
@@ -267,11 +261,9 @@ describe('plugin-mercury', () => {
267
261
 
268
262
  if (code && reason) {
269
263
  description = `with code \`${code}\` and reason \`${reason}\``;
270
- }
271
- else if (code) {
264
+ } else if (code) {
272
265
  description = `with code \`${code}\``;
273
- }
274
- else if (reason) {
266
+ } else if (reason) {
275
267
  description = `with reason \`${reason}\``;
276
268
  }
277
269
 
@@ -351,7 +343,7 @@ describe('plugin-mercury', () => {
351
343
  describe('when a MessageEvent is received', () => {
352
344
  it('processes the Event via any autowired event handlers', () => {
353
345
  webex.fake = {
354
- processTestEvent: sinon.spy()
346
+ processTestEvent: sinon.spy(),
355
347
  };
356
348
 
357
349
  const promise = mercury.connect();
@@ -393,7 +385,7 @@ describe('plugin-mercury', () => {
393
385
  });
394
386
  });
395
387
 
396
- it('emits the Mercury envelope named by the Mercury event\'s eventType', () => {
388
+ it("emits the Mercury envelope named by the Mercury event's eventType", () => {
397
389
  const startSpy = sinon.spy();
398
390
  const stopSpy = sinon.spy();
399
391
 
@@ -427,28 +419,27 @@ describe('plugin-mercury', () => {
427
419
 
428
420
  mockWebSocket.open();
429
421
 
430
- return promise
431
- .then(() => {
432
- mockWebSocket.emit('message', {
433
- data: JSON.stringify({
434
- sequenceNumber: 2,
435
- id: 'mockid',
436
- data: {
437
- eventType: 'mercury.buffer_state'
438
- }
439
- })
440
- });
441
- mockWebSocket.emit('message', {
442
- data: JSON.stringify({
443
- sequenceNumber: 4,
444
- id: 'mockid',
445
- data: {
446
- eventType: 'mercury.buffer_state'
447
- }
448
- })
449
- });
450
- assert.called(spy);
422
+ return promise.then(() => {
423
+ mockWebSocket.emit('message', {
424
+ data: JSON.stringify({
425
+ sequenceNumber: 2,
426
+ id: 'mockid',
427
+ data: {
428
+ eventType: 'mercury.buffer_state',
429
+ },
430
+ }),
431
+ });
432
+ mockWebSocket.emit('message', {
433
+ data: JSON.stringify({
434
+ sequenceNumber: 4,
435
+ id: 'mockid',
436
+ data: {
437
+ eventType: 'mercury.buffer_state',
438
+ },
439
+ }),
451
440
  });
441
+ assert.called(spy);
442
+ });
452
443
  });
453
444
  });
454
445
  });