@webex/internal-plugin-metrics 3.8.1-web-workers-keepalive.1 → 3.9.0-next.1

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.
@@ -130,6 +130,82 @@ describe('internal-plugin-metrics', () => {
130
130
  assert.deepEqual(res2, undefined);
131
131
  });
132
132
 
133
+ describe('getDiffBetweenTimestamps with clamping', () => {
134
+ it('should return diff without clamping when no clampValues provided', () => {
135
+ cdl.saveTimestamp({key: 'client.alert.displayed', value: 10});
136
+ cdl.saveTimestamp({key: 'client.alert.removed', value: 50});
137
+ const res = cdl.getDiffBetweenTimestamps('client.alert.displayed', 'client.alert.removed');
138
+ assert.deepEqual(res, 40);
139
+ });
140
+
141
+ it('should return diff without clamping when value is within range', () => {
142
+ cdl.saveTimestamp({key: 'client.alert.displayed', value: 10});
143
+ cdl.saveTimestamp({key: 'client.alert.removed', value: 50});
144
+ const res = cdl.getDiffBetweenTimestamps('client.alert.displayed', 'client.alert.removed', {
145
+ minimum: 0,
146
+ maximum: 100
147
+ });
148
+ assert.deepEqual(res, 40);
149
+ });
150
+
151
+ it('should clamp to minimum when diff is below minimum', () => {
152
+ cdl.saveTimestamp({key: 'client.alert.displayed', value: 50});
153
+ cdl.saveTimestamp({key: 'client.alert.removed', value: 45});
154
+ const res = cdl.getDiffBetweenTimestamps('client.alert.displayed', 'client.alert.removed', {
155
+ minimum: 10,
156
+ maximum: 100
157
+ });
158
+ assert.deepEqual(res, 10);
159
+ });
160
+
161
+ it('should clamp to maximum when diff is above maximum', () => {
162
+ cdl.saveTimestamp({key: 'client.alert.displayed', value: 10});
163
+ cdl.saveTimestamp({key: 'client.alert.removed', value: 210});
164
+ const res = cdl.getDiffBetweenTimestamps('client.alert.displayed', 'client.alert.removed', {
165
+ minimum: 0,
166
+ maximum: 100
167
+ });
168
+ assert.deepEqual(res, 100);
169
+ });
170
+
171
+ it('should use default minimum of 0 when only maximum is specified', () => {
172
+ cdl.saveTimestamp({key: 'client.alert.displayed', value: 50});
173
+ cdl.saveTimestamp({key: 'client.alert.removed', value: 45});
174
+ const res = cdl.getDiffBetweenTimestamps('client.alert.displayed', 'client.alert.removed', {
175
+ maximum: 100
176
+ });
177
+ assert.deepEqual(res, 0);
178
+ });
179
+
180
+ it('should not clamp maximum when maximum is undefined', () => {
181
+ cdl.saveTimestamp({key: 'client.alert.displayed', value: 10});
182
+ cdl.saveTimestamp({key: 'client.alert.removed', value: 2000});
183
+ const res = cdl.getDiffBetweenTimestamps('client.alert.displayed', 'client.alert.removed', {
184
+ minimum: 5
185
+ });
186
+ assert.deepEqual(res, 1990);
187
+ });
188
+
189
+ it('should handle negative differences correctly with clamping', () => {
190
+ cdl.saveTimestamp({key: 'client.alert.displayed', value: 100});
191
+ cdl.saveTimestamp({key: 'client.alert.removed', value: 50});
192
+ const res = cdl.getDiffBetweenTimestamps('client.alert.displayed', 'client.alert.removed', {
193
+ minimum: 10,
194
+ maximum: 1000
195
+ });
196
+ assert.deepEqual(res, 10);
197
+ });
198
+
199
+ it('should return undefined when timestamps are missing even with clamping', () => {
200
+ cdl.saveTimestamp({key: 'client.alert.displayed', value: 10});
201
+ const res = cdl.getDiffBetweenTimestamps('client.alert.displayed', 'client.alert.removed', {
202
+ minimum: 0,
203
+ maximum: 100
204
+ });
205
+ assert.deepEqual(res, undefined);
206
+ });
207
+ });
208
+
133
209
  it('calculates getMeetingInfoReqResp correctly', () => {
134
210
  cdl.saveTimestamp({key: 'internal.client.meetinginfo.request', value: 10});
135
211
  cdl.saveTimestamp({key: 'internal.client.meetinginfo.response', value: 20});
@@ -918,6 +994,18 @@ describe('internal-plugin-metrics', () => {
918
994
  assert.deepEqual(cdl.getInterstitialToMediaOKJMT(), 10);
919
995
  });
920
996
 
997
+ it('calculates getShareDuration correctly', () => {
998
+ cdl.saveTimestamp({
999
+ key: 'internal.client.share.initiated',
1000
+ value: 5,
1001
+ });
1002
+ cdl.saveTimestamp({
1003
+ key: 'internal.client.share.stopped',
1004
+ value: 7,
1005
+ });
1006
+ assert.deepEqual(cdl.getShareDuration(), 2);
1007
+ });
1008
+
921
1009
  describe('calculates getU2CTime correctly', () => {
922
1010
  it('returns undefined when no precomputed value available', () => {
923
1011
  assert.deepEqual(cdl.getU2CTime(), undefined);
@@ -2431,7 +2431,7 @@ describe('internal-plugin-metrics', () => {
2431
2431
  );
2432
2432
  });
2433
2433
 
2434
- it('should send behavioral event if meetingId provided but meeting is undefined', () => {
2434
+ it('should record failure metric when meetingId is provided but meeting is undefined', () => {
2435
2435
  webex.meetings.getBasicMeetingInformation = sinon.stub().returns(undefined);
2436
2436
 
2437
2437
  cd.submitClientEvent({name: 'client.alert.displayed', options: {meetingId: 'meetingId'}});
@@ -2465,6 +2465,228 @@ describe('internal-plugin-metrics', () => {
2465
2465
  assert.calledWith(cd.submitToCallDiagnosticsPreLogin, testEvent);
2466
2466
  assert.notCalled(cd.submitToCallDiagnostics);
2467
2467
  });
2468
+
2469
+ describe('Limiting repeated events', () => {
2470
+ beforeEach(() => {
2471
+ cd.clearEventLimits();
2472
+ });
2473
+
2474
+ const createEventLimitRegex = (eventName: string, eventType: string) => {
2475
+ const escapedEventName = eventName.replace(/\./g, '\\.');
2476
+ return new RegExp(`Event limit reached for ${escapedEventName} for ${eventType}`);
2477
+ };
2478
+
2479
+ it('should always send events that are not in the limiting switch cases', () => {
2480
+ const options = {
2481
+ meetingId: fakeMeeting.id,
2482
+ };
2483
+ const submitToCallDiagnosticsStub = sinon.stub(cd, 'submitToCallDiagnostics');
2484
+
2485
+ const baselineCallCount = webex.logger.log.callCount;
2486
+ cd.submitClientEvent({
2487
+ name: 'client.alert.displayed',
2488
+ options,
2489
+ });
2490
+
2491
+ cd.submitClientEvent({
2492
+ name: 'client.alert.displayed',
2493
+ options,
2494
+ });
2495
+
2496
+ cd.submitClientEvent({
2497
+ name: 'client.alert.displayed',
2498
+ options,
2499
+ });
2500
+
2501
+ assert.calledThrice(submitToCallDiagnosticsStub);
2502
+ });
2503
+
2504
+ ([
2505
+ ['client.media.render.start'],
2506
+ ['client.media.render.stop'],
2507
+ ['client.media.rx.start'],
2508
+ ['client.media.rx.stop'],
2509
+ ['client.media.tx.start'],
2510
+ ['client.media.tx.stop']
2511
+ ] as const).forEach(([name]) => {
2512
+ it(`should only send ${name} once per mediaType`, () => {
2513
+ const options = {
2514
+ meetingId: fakeMeeting.id,
2515
+ };
2516
+ const payload = {
2517
+ mediaType: 'video' as const,
2518
+ };
2519
+ const submitToCallDiagnosticsStub = sinon.stub(cd, 'submitToCallDiagnostics');
2520
+
2521
+ const baselineCallCount = webex.logger.log.callCount;
2522
+ // Send first event
2523
+ cd.submitClientEvent({
2524
+ name,
2525
+ payload,
2526
+ options,
2527
+ });
2528
+
2529
+ assert.calledOnce(submitToCallDiagnosticsStub);
2530
+ submitToCallDiagnosticsStub.resetHistory();
2531
+
2532
+ // Send second event of same type
2533
+ cd.submitClientEvent({
2534
+ name,
2535
+ payload,
2536
+ options,
2537
+ });
2538
+
2539
+ assert.notCalled(submitToCallDiagnosticsStub);
2540
+ assert.calledWith(
2541
+ webex.logger.log,
2542
+ 'call-diagnostic-events -> ',
2543
+ sinon.match(createEventLimitRegex(name, 'mediaType video'))
2544
+ );
2545
+ webex.logger.log.resetHistory();
2546
+
2547
+ // Send third event of same type
2548
+ cd.submitClientEvent({
2549
+ name,
2550
+ payload,
2551
+ options,
2552
+ });
2553
+
2554
+ assert.notCalled(submitToCallDiagnosticsStub);
2555
+ assert.neverCalledWithMatch(webex.logger.log,
2556
+ 'call-diagnostic-events -> ',
2557
+ sinon.match(createEventLimitRegex(name, 'mediaType video'))
2558
+ );
2559
+
2560
+ // Send fourth event with a different mediaType
2561
+ cd.submitClientEvent({
2562
+ name,
2563
+ payload: {mediaType: 'audio'},
2564
+ options,
2565
+ });
2566
+
2567
+ assert.calledOnce(submitToCallDiagnosticsStub);
2568
+ });
2569
+
2570
+ it(`should handle share media type with shareInstanceId correctly for ${name}`, () => {
2571
+ const options = {
2572
+ meetingId: fakeMeeting.id,
2573
+ };
2574
+ const payload = {
2575
+ mediaType: 'share' as const,
2576
+ shareInstanceId: 'instance-1',
2577
+ };
2578
+ const submitToCallDiagnosticsStub = sinon.stub(cd, 'submitToCallDiagnostics');
2579
+
2580
+ const baselineCallCount = webex.logger.log.callCount;
2581
+ // Send first event
2582
+ cd.submitClientEvent({
2583
+ name,
2584
+ payload,
2585
+ options,
2586
+ });
2587
+
2588
+ // Send second event with same shareInstanceId
2589
+ cd.submitClientEvent({
2590
+ name,
2591
+ payload,
2592
+ options,
2593
+ });
2594
+
2595
+ // Send event with different shareInstanceId
2596
+ cd.submitClientEvent({
2597
+ name,
2598
+ payload: { ...payload, shareInstanceId: 'instance-2' },
2599
+ options,
2600
+ });
2601
+
2602
+ assert.calledTwice(submitToCallDiagnosticsStub);
2603
+ });
2604
+ });
2605
+
2606
+ ([
2607
+ ['client.roap-message.received'],
2608
+ ['client.roap-message.sent']
2609
+ ] as const).forEach(([name]) => {
2610
+ it(`should not send third event of same type and not log warning again for ${name}`, () => {
2611
+ const options = {
2612
+ meetingId: fakeMeeting.id,
2613
+ };
2614
+ const payload = {
2615
+ roap: {
2616
+ messageType: 'OFFER' as const,
2617
+ },
2618
+ };
2619
+ const submitToCallDiagnosticsStub = sinon.stub(cd, 'submitToCallDiagnostics');
2620
+
2621
+ // Clear any existing call history to get accurate counts
2622
+ webex.logger.log.resetHistory();
2623
+
2624
+ // Send first event
2625
+ cd.submitClientEvent({
2626
+ name,
2627
+ payload,
2628
+ options,
2629
+ });
2630
+
2631
+ assert.calledOnce(submitToCallDiagnosticsStub);
2632
+ submitToCallDiagnosticsStub.resetHistory();
2633
+
2634
+ // Send second event (should trigger warning)
2635
+ cd.submitClientEvent({
2636
+ name,
2637
+ payload,
2638
+ options,
2639
+ });
2640
+
2641
+ assert.notCalled(submitToCallDiagnosticsStub);
2642
+ assert.calledWith(
2643
+ webex.logger.log,
2644
+ 'call-diagnostic-events -> ',
2645
+ sinon.match(createEventLimitRegex(name, 'ROAP type OFFER'))
2646
+ );
2647
+ webex.logger.log.resetHistory();
2648
+
2649
+ cd.submitClientEvent({
2650
+ name,
2651
+ payload,
2652
+ options,
2653
+ });
2654
+
2655
+ assert.notCalled(submitToCallDiagnosticsStub);
2656
+ assert.neverCalledWithMatch(
2657
+ webex.logger.log,
2658
+ 'call-diagnostic-events -> ',
2659
+ sinon.match(createEventLimitRegex(name, 'ROAP type OFFER'))
2660
+ );
2661
+ });
2662
+
2663
+ it(`should handle roap.type instead of roap.messageType for ${name}`, () => {
2664
+ const options = {
2665
+ meetingId: fakeMeeting.id,
2666
+ };
2667
+ const payload = {
2668
+ roap: {
2669
+ type: 'ANSWER' as const,
2670
+ },
2671
+ };
2672
+ const submitToCallDiagnosticsStub = sinon.stub(cd, 'submitToCallDiagnostics');
2673
+
2674
+ cd.submitClientEvent({
2675
+ name,
2676
+ payload,
2677
+ options,
2678
+ });
2679
+
2680
+ cd.submitClientEvent({
2681
+ name,
2682
+ payload,
2683
+ options,
2684
+ });
2685
+
2686
+ assert.calledOnce(submitToCallDiagnosticsStub);
2687
+ });
2688
+ });
2689
+ });
2468
2690
  });
2469
2691
 
2470
2692
  describe('#submitToCallDiagnostics', () => {
@@ -4022,5 +4244,186 @@ describe('internal-plugin-metrics', () => {
4022
4244
  assert.notCalled(submitFeatureEventSpy);
4023
4245
  });
4024
4246
  });
4247
+
4248
+ describe('#clearEventLimitsForCorrelationId', () => {
4249
+ beforeEach(() => {
4250
+ cd.clearEventLimits();
4251
+ });
4252
+
4253
+ it('should clear event limits for specific correlationId only', () => {
4254
+ // Use the actual correlationIds from our fakeMeeting fixtures
4255
+ const correlationId1 = fakeMeeting.correlationId; // e.g. 'correlationId1'
4256
+ const correlationId2 = fakeMeeting2.correlationId; // e.g. 'correlationId2'
4257
+ const options1 = { meetingId: fakeMeeting.id };
4258
+ const options2 = { meetingId: fakeMeeting2.id };
4259
+ const payload = { mediaType: 'video' as const };
4260
+
4261
+ // Set up events for both correlations to trigger limits
4262
+ cd.submitClientEvent({ name: 'client.media.render.start', payload, options: options1 });
4263
+ cd.submitClientEvent({ name: 'client.media.render.start', payload, options: options2 });
4264
+ cd.submitClientEvent({ name: 'client.media.render.start', payload, options: options1 });
4265
+ cd.submitClientEvent({ name: 'client.media.render.start', payload, options: options2 });
4266
+ assert.isTrue(cd.eventLimitTracker.size > 0);
4267
+ assert.isTrue(cd.eventLimitWarningsLogged.size > 0);
4268
+
4269
+ // Clear limits for only correlationId1 (present)
4270
+ cd.clearEventLimitsForCorrelationId(correlationId1);
4271
+
4272
+ const remainingTrackerKeys = Array.from(cd.eventLimitTracker.keys());
4273
+ const remainingWarningKeys = Array.from(cd.eventLimitWarningsLogged.keys());
4274
+
4275
+ // Should have no keys with correlationId1
4276
+ assert.isFalse(remainingTrackerKeys.some(key => key.split(':')[1] === correlationId1));
4277
+ assert.isFalse(remainingWarningKeys.some(key => key.split(':')[1] === correlationId1));
4278
+
4279
+ // Should still have keys with correlationId2
4280
+ assert.isTrue(remainingTrackerKeys.some(key => key.split(':')[1] === correlationId2));
4281
+ assert.isTrue(remainingWarningKeys.some(key => key.split(':')[1] === correlationId2));
4282
+ });
4283
+
4284
+ it('should handle empty correlationId gracefully', () => {
4285
+ const options = { meetingId: fakeMeeting.id };
4286
+ const payload = { mediaType: 'video' as const };
4287
+
4288
+ // Set up some tracking data
4289
+ cd.submitClientEvent({
4290
+ name: 'client.media.render.start',
4291
+ payload,
4292
+ options,
4293
+ });
4294
+
4295
+ cd.submitClientEvent({
4296
+ name: 'client.media.render.start',
4297
+ payload,
4298
+ options,
4299
+ });
4300
+
4301
+ const initialTrackerSize = cd.eventLimitTracker.size;
4302
+ const initialWarningsSize = cd.eventLimitWarningsLogged.size;
4303
+
4304
+ // Should not clear anything for empty correlationId
4305
+ cd.clearEventLimitsForCorrelationId('');
4306
+ cd.clearEventLimitsForCorrelationId(null as any);
4307
+ cd.clearEventLimitsForCorrelationId(undefined as any);
4308
+
4309
+ assert.equal(cd.eventLimitTracker.size, initialTrackerSize);
4310
+ assert.equal(cd.eventLimitWarningsLogged.size, initialWarningsSize);
4311
+ });
4312
+
4313
+ it('should handle non-existent correlationId gracefully', () => {
4314
+ const options = { meetingId: fakeMeeting.id };
4315
+ const payload = { mediaType: 'video' as const };
4316
+
4317
+ // Set up some tracking data
4318
+ cd.submitClientEvent({
4319
+ name: 'client.media.render.start',
4320
+ payload,
4321
+ options,
4322
+ });
4323
+
4324
+ const initialTrackerSize = cd.eventLimitTracker.size;
4325
+ const initialWarningsSize = cd.eventLimitWarningsLogged.size;
4326
+
4327
+ // Should not clear anything for non-existent correlationId
4328
+ cd.clearEventLimitsForCorrelationId('nonExistentCorrelationId');
4329
+
4330
+ assert.equal(cd.eventLimitTracker.size, initialTrackerSize);
4331
+ assert.equal(cd.eventLimitWarningsLogged.size, initialWarningsSize);
4332
+ });
4333
+
4334
+ it('should clear multiple event types for the same correlationId', () => {
4335
+ const correlationId = fakeMeeting.correlationId;
4336
+ const options = { meetingId: fakeMeeting.id };
4337
+ const videoPayload = { mediaType: 'video' as const };
4338
+ const audioPayload = { mediaType: 'audio' as const };
4339
+ const roapPayload = { roap: { messageType: 'OFFER' as const } };
4340
+
4341
+ // Set up multiple event types for the same correlation
4342
+ cd.submitClientEvent({
4343
+ name: 'client.media.render.start',
4344
+ payload: videoPayload,
4345
+ options,
4346
+ });
4347
+
4348
+ cd.submitClientEvent({
4349
+ name: 'client.media.render.start',
4350
+ payload: audioPayload,
4351
+ options,
4352
+ });
4353
+
4354
+ cd.submitClientEvent({
4355
+ name: 'client.roap-message.sent',
4356
+ payload: roapPayload,
4357
+ options,
4358
+ });
4359
+
4360
+ // Trigger limits
4361
+ cd.submitClientEvent({
4362
+ name: 'client.media.render.start',
4363
+ payload: videoPayload,
4364
+ options,
4365
+ });
4366
+
4367
+ cd.submitClientEvent({
4368
+ name: 'client.media.render.start',
4369
+ payload: audioPayload,
4370
+ options,
4371
+ });
4372
+
4373
+ cd.submitClientEvent({
4374
+ name: 'client.roap-message.sent',
4375
+ payload: roapPayload,
4376
+ options,
4377
+ });
4378
+
4379
+ assert.isTrue(cd.eventLimitTracker.size > 0);
4380
+ assert.isTrue(cd.eventLimitWarningsLogged.size > 0);
4381
+
4382
+ // Clear all limits for this correlationId
4383
+ cd.clearEventLimitsForCorrelationId(correlationId);
4384
+
4385
+ // Should clear all tracking data for this correlationId
4386
+ assert.equal(cd.eventLimitTracker.size, 0);
4387
+ assert.equal(cd.eventLimitWarningsLogged.size, 0);
4388
+ });
4389
+
4390
+ it('should allow events to be sent again after clearing limits for correlationId', () => {
4391
+ const correlationId = fakeMeeting.correlationId;
4392
+ const options = { meetingId: fakeMeeting.id };
4393
+ const payload = { mediaType: 'video' as const };
4394
+ const submitToCallDiagnosticsStub = sinon.stub(cd, 'submitToCallDiagnostics');
4395
+
4396
+ // Send first event (should succeed)
4397
+ cd.submitClientEvent({
4398
+ name: 'client.media.render.start',
4399
+ payload,
4400
+ options,
4401
+ });
4402
+
4403
+ assert.calledOnce(submitToCallDiagnosticsStub);
4404
+ submitToCallDiagnosticsStub.resetHistory();
4405
+
4406
+ // Send second event (should be blocked)
4407
+ cd.submitClientEvent({
4408
+ name: 'client.media.render.start',
4409
+ payload,
4410
+ options,
4411
+ });
4412
+
4413
+ assert.notCalled(submitToCallDiagnosticsStub);
4414
+
4415
+ // Clear limits for this correlationId
4416
+ cd.clearEventLimitsForCorrelationId(correlationId);
4417
+
4418
+ // Send event again (should succeed after clearing)
4419
+ cd.submitClientEvent({
4420
+ name: 'client.media.render.start',
4421
+ payload,
4422
+ options,
4423
+ });
4424
+
4425
+ assert.calledOnce(submitToCallDiagnosticsStub);
4426
+ });
4427
+ });
4025
4428
  });
4026
4429
  });
@@ -17,7 +17,7 @@ describe('internal-plugin-metrics', () => {
17
17
  let webex;
18
18
  let clock;
19
19
  let now;
20
-
20
+ const deviceManagerStub = {getPairedDevice: sinon.stub()};
21
21
  const preLoginId = 'my_prelogin_id';
22
22
 
23
23
  beforeEach(() => {
@@ -30,6 +30,7 @@ describe('internal-plugin-metrics', () => {
30
30
  newMetrics: NewMetrics,
31
31
  },
32
32
  });
33
+ webex.devicemanager = deviceManagerStub;
33
34
 
34
35
  webex.request = (options) =>
35
36
  Promise.resolve({body: {items: []}, waitForServiceTimeout: 15, options});
@@ -217,9 +218,7 @@ describe('internal-plugin-metrics', () => {
217
218
  });
218
219
 
219
220
  assert.deepEqual(calls.args[0].type, ['diagnostic-event']);
220
-
221
221
  const prepareDiagnosticMetricItemCalls = prepareDiagnosticMetricItemSpy.getCalls();
222
-
223
222
  // second argument (item) also gets assigned a delay property but the key is a Symbol and haven't been able to test that..
224
223
  assert.deepEqual(prepareDiagnosticMetricItemCalls[0].args[0], webex);
225
224
  assert.deepEqual(prepareDiagnosticMetricItemCalls[0].args[1].eventPayload, {
@@ -232,6 +231,75 @@ describe('internal-plugin-metrics', () => {
232
231
  });
233
232
  assert.deepEqual(prepareDiagnosticMetricItemCalls[0].args[1].type, ['diagnostic-event']);
234
233
  });
234
+ it('adds the paired device to the metric payload if paired', async () => {
235
+ webex.internal.newMetrics.callDiagnosticMetrics.preLoginMetricsBatcher.prepareRequest = (
236
+ q
237
+ ) => Promise.resolve(q);
238
+ webex.devicemanager.getPairedDevice = sinon.stub().returns({
239
+ deviceInfo: {
240
+ id: 'my_device_id',
241
+ },
242
+ url: 'my_url',
243
+ mode: 'personal',
244
+ devices: [{productName: 'my_product_name'}],
245
+ });
246
+ webex.devicemanager.getPairedMethod = sinon.stub().returns("Manual");
247
+
248
+ const prepareItemSpy = sinon.spy(
249
+ webex.internal.newMetrics.callDiagnosticMetrics.preLoginMetricsBatcher,
250
+ 'prepareItem'
251
+ );
252
+ const prepareDiagnosticMetricItemSpy = sinon.spy(
253
+ CallDiagnosticUtils,
254
+ 'prepareDiagnosticMetricItem'
255
+ );
256
+
257
+ const promise =
258
+ webex.internal.newMetrics.callDiagnosticMetrics.submitToCallDiagnosticsPreLogin(
259
+ {
260
+ event: {name: 'client.interstitial-window.launched'},
261
+ },
262
+ preLoginId
263
+ );
264
+
265
+ await flushPromises();
266
+
267
+ clock.tick(config.metrics.batcherWait);
268
+
269
+ await promise;
270
+
271
+ const calls = prepareItemSpy.getCalls()[0];
272
+
273
+ assert.deepEqual(calls.args[0].eventPayload, {
274
+ event: {
275
+ joinTimes: {
276
+ meetingInfoReqResp: undefined,
277
+ clickToInterstitial: undefined,
278
+ clickToInterstitialWithUserDelay: undefined,
279
+ refreshCaptchaServiceReqResp: undefined,
280
+ downloadIntelligenceModelsReqResp: undefined,
281
+ },
282
+ name: 'client.interstitial-window.launched',
283
+ pairedDevice: {
284
+ deviceId: 'my_device_id',
285
+ deviceURL: 'my_url',
286
+ devicePairingType: 'Manual',
287
+ productName: 'my_product_name',
288
+ isPersonalDevice: true,
289
+ },
290
+ pairingState: 'paired',
291
+ },
292
+ origin: {
293
+ buildType: 'test',
294
+ networkType: 'unknown',
295
+ upgradeChannel: 'test',
296
+ },
297
+ });
298
+
299
+ assert.deepEqual(calls.args[0].type, ['diagnostic-event']);
300
+ assert.calledOnce(webex.devicemanager.getPairedDevice);
301
+
302
+ });
235
303
  });
236
304
 
237
305
  describe('savePreLoginId', () => {