@@ -377,7 +377,7 @@ describe('setupIntegration', () => {
377
377
setupIntegration ( client2 , integration3 , integrationIndex ) ;
378
378
setupIntegration ( client2 , integration4 , integrationIndex ) ;
379
379
380
- expect ( integrationIndex ) . toEqual ( { test : integration4 } ) ;
380
+ expect ( integrationIndex ) . toEqual ( { test : integration1 } ) ;
381
381
expect ( integration1 . setupOnce ) . toHaveBeenCalledTimes ( 1 ) ;
382
382
expect ( integration2 . setupOnce ) . not . toHaveBeenCalled ( ) ;
383
383
expect ( integration3 . setupOnce ) . not . toHaveBeenCalled ( ) ;
@@ -394,32 +394,32 @@ describe('setupIntegration', () => {
394
394
const client1 = getTestClient ( ) ;
395
395
const client2 = getTestClient ( ) ;
396
396
397
- const integrationIndex = { } ;
397
+ const integrationIndex1 = { } ;
398
+ const integrationIndex2 = { } ;
398
399
const integration1 = new CustomIntegration ( ) ;
399
400
const integration2 = new CustomIntegration ( ) ;
400
401
const integration3 = new CustomIntegration ( ) ;
401
402
const integration4 = new CustomIntegration ( ) ;
402
403
403
- setupIntegration ( client1 , integration1 , integrationIndex ) ;
404
- setupIntegration ( client1 , integration2 , integrationIndex ) ;
405
- setupIntegration ( client2 , integration3 , integrationIndex ) ;
406
- setupIntegration ( client2 , integration4 , integrationIndex ) ;
404
+ setupIntegration ( client1 , integration1 , integrationIndex1 ) ;
405
+ setupIntegration ( client1 , integration2 , integrationIndex1 ) ;
406
+ setupIntegration ( client2 , integration3 , integrationIndex2 ) ;
407
+ setupIntegration ( client2 , integration4 , integrationIndex2 ) ;
407
408
408
- expect ( integrationIndex ) . toEqual ( { test : integration4 } ) ;
409
+ expect ( integrationIndex1 ) . toEqual ( { test : integration1 } ) ;
410
+ expect ( integrationIndex2 ) . toEqual ( { test : integration3 } ) ;
409
411
expect ( integration1 . setupOnce ) . toHaveBeenCalledTimes ( 1 ) ;
410
412
expect ( integration2 . setupOnce ) . not . toHaveBeenCalled ( ) ;
411
413
expect ( integration3 . setupOnce ) . not . toHaveBeenCalled ( ) ;
412
414
expect ( integration4 . setupOnce ) . not . toHaveBeenCalled ( ) ;
413
415
414
416
expect ( integration1 . setup ) . toHaveBeenCalledTimes ( 1 ) ;
415
- expect ( integration2 . setup ) . toHaveBeenCalledTimes ( 1 ) ;
417
+ expect ( integration2 . setup ) . toHaveBeenCalledTimes ( 0 ) ;
416
418
expect ( integration3 . setup ) . toHaveBeenCalledTimes ( 1 ) ;
417
- expect ( integration4 . setup ) . toHaveBeenCalledTimes ( 1 ) ;
419
+ expect ( integration4 . setup ) . toHaveBeenCalledTimes ( 0 ) ;
418
420
419
421
expect ( integration1 . setup ) . toHaveBeenCalledWith ( client1 ) ;
420
- expect ( integration2 . setup ) . toHaveBeenCalledWith ( client1 ) ;
421
422
expect ( integration3 . setup ) . toHaveBeenCalledWith ( client2 ) ;
422
- expect ( integration4 . setup ) . toHaveBeenCalledWith ( client2 ) ;
423
423
} ) ;
424
424
425
425
it ( 'binds preprocessEvent for each client' , ( ) => {
@@ -432,18 +432,20 @@ describe('setupIntegration', () => {
432
432
const client1 = getTestClient ( ) ;
433
433
const client2 = getTestClient ( ) ;
434
434
435
- const integrationIndex = { } ;
435
+ const integrationIndex1 = { } ;
436
+ const integrationIndex2 = { } ;
436
437
const integration1 = new CustomIntegration ( ) ;
437
438
const integration2 = new CustomIntegration ( ) ;
438
439
const integration3 = new CustomIntegration ( ) ;
439
440
const integration4 = new CustomIntegration ( ) ;
440
441
441
- setupIntegration ( client1 , integration1 , integrationIndex ) ;
442
- setupIntegration ( client1 , integration2 , integrationIndex ) ;
443
- setupIntegration ( client2 , integration3 , integrationIndex ) ;
444
- setupIntegration ( client2 , integration4 , integrationIndex ) ;
442
+ setupIntegration ( client1 , integration1 , integrationIndex1 ) ;
443
+ setupIntegration ( client1 , integration2 , integrationIndex1 ) ;
444
+ setupIntegration ( client2 , integration3 , integrationIndex2 ) ;
445
+ setupIntegration ( client2 , integration4 , integrationIndex2 ) ;
445
446
446
- expect ( integrationIndex ) . toEqual ( { test : integration4 } ) ;
447
+ expect ( integrationIndex1 ) . toEqual ( { test : integration1 } ) ;
448
+ expect ( integrationIndex2 ) . toEqual ( { test : integration3 } ) ;
447
449
expect ( integration1 . setupOnce ) . toHaveBeenCalledTimes ( 1 ) ;
448
450
expect ( integration2 . setupOnce ) . not . toHaveBeenCalled ( ) ;
449
451
expect ( integration3 . setupOnce ) . not . toHaveBeenCalled ( ) ;
@@ -456,14 +458,12 @@ describe('setupIntegration', () => {
456
458
client2 . captureEvent ( { event_id : '2c' } ) ;
457
459
458
460
expect ( integration1 . preprocessEvent ) . toHaveBeenCalledTimes ( 2 ) ;
459
- expect ( integration2 . preprocessEvent ) . toHaveBeenCalledTimes ( 2 ) ;
461
+ expect ( integration2 . preprocessEvent ) . toHaveBeenCalledTimes ( 0 ) ;
460
462
expect ( integration3 . preprocessEvent ) . toHaveBeenCalledTimes ( 3 ) ;
461
- expect ( integration4 . preprocessEvent ) . toHaveBeenCalledTimes ( 3 ) ;
463
+ expect ( integration4 . preprocessEvent ) . toHaveBeenCalledTimes ( 0 ) ;
462
464
463
465
expect ( integration1 . preprocessEvent ) . toHaveBeenLastCalledWith ( { event_id : '1b' } , { } , client1 ) ;
464
- expect ( integration2 . preprocessEvent ) . toHaveBeenLastCalledWith ( { event_id : '1b' } , { } , client1 ) ;
465
466
expect ( integration3 . preprocessEvent ) . toHaveBeenLastCalledWith ( { event_id : '2c' } , { } , client2 ) ;
466
- expect ( integration4 . preprocessEvent ) . toHaveBeenLastCalledWith ( { event_id : '2c' } , { } , client2 ) ;
467
467
} ) ;
468
468
469
469
it ( 'allows to mutate events in preprocessEvent' , async ( ) => {
@@ -504,18 +504,20 @@ describe('setupIntegration', () => {
504
504
const client1 = getTestClient ( ) ;
505
505
const client2 = getTestClient ( ) ;
506
506
507
- const integrationIndex = { } ;
507
+ const integrationIndex1 = { } ;
508
+ const integrationIndex2 = { } ;
508
509
const integration1 = new CustomIntegration ( ) ;
509
510
const integration2 = new CustomIntegration ( ) ;
510
511
const integration3 = new CustomIntegration ( ) ;
511
512
const integration4 = new CustomIntegration ( ) ;
512
513
513
- setupIntegration ( client1 , integration1 , integrationIndex ) ;
514
- setupIntegration ( client1 , integration2 , integrationIndex ) ;
515
- setupIntegration ( client2 , integration3 , integrationIndex ) ;
516
- setupIntegration ( client2 , integration4 , integrationIndex ) ;
514
+ setupIntegration ( client1 , integration1 , integrationIndex1 ) ;
515
+ setupIntegration ( client1 , integration2 , integrationIndex1 ) ;
516
+ setupIntegration ( client2 , integration3 , integrationIndex2 ) ;
517
+ setupIntegration ( client2 , integration4 , integrationIndex2 ) ;
517
518
518
- expect ( integrationIndex ) . toEqual ( { test : integration4 } ) ;
519
+ expect ( integrationIndex1 ) . toEqual ( { test : integration1 } ) ;
520
+ expect ( integrationIndex2 ) . toEqual ( { test : integration3 } ) ;
519
521
expect ( integration1 . setupOnce ) . toHaveBeenCalledTimes ( 1 ) ;
520
522
expect ( integration2 . setupOnce ) . not . toHaveBeenCalled ( ) ;
521
523
expect ( integration3 . setupOnce ) . not . toHaveBeenCalled ( ) ;
@@ -528,30 +530,20 @@ describe('setupIntegration', () => {
528
530
client2 . captureEvent ( { event_id : '2c' } ) ;
529
531
530
532
expect ( integration1 . processEvent ) . toHaveBeenCalledTimes ( 2 ) ;
531
- expect ( integration2 . processEvent ) . toHaveBeenCalledTimes ( 2 ) ;
533
+ expect ( integration2 . processEvent ) . toHaveBeenCalledTimes ( 0 ) ;
532
534
expect ( integration3 . processEvent ) . toHaveBeenCalledTimes ( 3 ) ;
533
- expect ( integration4 . processEvent ) . toHaveBeenCalledTimes ( 3 ) ;
535
+ expect ( integration4 . processEvent ) . toHaveBeenCalledTimes ( 0 ) ;
534
536
535
537
expect ( integration1 . processEvent ) . toHaveBeenLastCalledWith (
536
538
expect . objectContaining ( { event_id : '1b' } ) ,
537
539
{ } ,
538
540
client1 ,
539
541
) ;
540
- expect ( integration2 . processEvent ) . toHaveBeenLastCalledWith (
541
- expect . objectContaining ( { event_id : '1b' } ) ,
542
- { } ,
543
- client1 ,
544
- ) ;
545
542
expect ( integration3 . processEvent ) . toHaveBeenLastCalledWith (
546
543
expect . objectContaining ( { event_id : '2c' } ) ,
547
544
{ } ,
548
545
client2 ,
549
546
) ;
550
- expect ( integration4 . processEvent ) . toHaveBeenLastCalledWith (
551
- expect . objectContaining ( { event_id : '2c' } ) ,
552
- { } ,
553
- client2 ,
554
- ) ;
555
547
} ) ;
556
548
557
549
it ( 'allows to mutate events in processEvent' , async ( ) => {
0 commit comments