@@ -378,6 +378,44 @@ describe('setupIntegration', () => {
378378 expect ( integration4 . setupOnce ) . not . toHaveBeenCalled ( ) ;
379379 } ) ;
380380
381+ it ( 'calls setup for each client' , ( ) => {
382+ class CustomIntegration implements Integration {
383+ name = 'test' ;
384+ setupOnce = jest . fn ( ) ;
385+ setup = jest . fn ( ) ;
386+ }
387+
388+ const client1 = getTestClient ( ) ;
389+ const client2 = getTestClient ( ) ;
390+
391+ const integrationIndex = { } ;
392+ const integration1 = new CustomIntegration ( ) ;
393+ const integration2 = new CustomIntegration ( ) ;
394+ const integration3 = new CustomIntegration ( ) ;
395+ const integration4 = new CustomIntegration ( ) ;
396+
397+ setupIntegration ( client1 , integration1 , integrationIndex ) ;
398+ setupIntegration ( client1 , integration2 , integrationIndex ) ;
399+ setupIntegration ( client2 , integration3 , integrationIndex ) ;
400+ setupIntegration ( client2 , integration4 , integrationIndex ) ;
401+
402+ expect ( integrationIndex ) . toEqual ( { test : integration4 } ) ;
403+ expect ( integration1 . setupOnce ) . toHaveBeenCalledTimes ( 1 ) ;
404+ expect ( integration2 . setupOnce ) . not . toHaveBeenCalled ( ) ;
405+ expect ( integration3 . setupOnce ) . not . toHaveBeenCalled ( ) ;
406+ expect ( integration4 . setupOnce ) . not . toHaveBeenCalled ( ) ;
407+
408+ expect ( integration1 . setup ) . toHaveBeenCalledTimes ( 1 ) ;
409+ expect ( integration2 . setup ) . toHaveBeenCalledTimes ( 1 ) ;
410+ expect ( integration3 . setup ) . toHaveBeenCalledTimes ( 1 ) ;
411+ expect ( integration4 . setup ) . toHaveBeenCalledTimes ( 1 ) ;
412+
413+ expect ( integration1 . setup ) . toHaveBeenCalledWith ( client1 ) ;
414+ expect ( integration2 . setup ) . toHaveBeenCalledWith ( client1 ) ;
415+ expect ( integration3 . setup ) . toHaveBeenCalledWith ( client2 ) ;
416+ expect ( integration4 . setup ) . toHaveBeenCalledWith ( client2 ) ;
417+ } ) ;
418+
381419 it ( 'binds preprocessEvent for each client' , ( ) => {
382420 class CustomIntegration implements Integration {
383421 name = 'test' ;
0 commit comments