@@ -424,6 +424,68 @@ describe(createWrapper, () => {
424424 updatedCDNSettings
425425 )
426426 } )
427+
428+ it ( 'should filter ALL non-consented remote plugins when multiple integrations need to be blocked' , async ( ) => {
429+ const mockCdnSettings = cdnSettingsBuilder
430+ . addActionDestinationSettings (
431+ {
432+ creationName : 'GoogleAnalytics' ,
433+ consentSettings : {
434+ categories : [ 'Analytics' ] ,
435+ } ,
436+ } ,
437+ {
438+ creationName : 'FacebookPixel' ,
439+ consentSettings : {
440+ categories : [ 'Advertising' ] ,
441+ } ,
442+ } ,
443+ {
444+ creationName : 'TikTokPixel' ,
445+ consentSettings : {
446+ categories : [ 'Advertising' ] ,
447+ } ,
448+ } ,
449+ {
450+ creationName : 'PinterestTag' ,
451+ consentSettings : {
452+ categories : [ 'Advertising' ] ,
453+ } ,
454+ }
455+ )
456+ . build ( )
457+
458+ wrapTestAnalytics ( {
459+ getCategories : ( ) => ( { Analytics : true } ) , // Only Analytics consented, NOT Advertising
460+ } )
461+
462+ await analytics . load ( {
463+ ...DEFAULT_LOAD_SETTINGS ,
464+ cdnSettings : mockCdnSettings ,
465+ } )
466+
467+ expect ( analyticsLoadSpy ) . toBeCalled ( )
468+ const { updatedCDNSettings } = getAnalyticsLoadLastCall ( )
469+
470+ expect ( typeof updatedCDNSettings . remotePlugins ) . toBe ( 'object' )
471+
472+ // Only GoogleAnalytics should be present - all Advertising integrations should be filtered
473+ assertIntegrationsContainOnly (
474+ [ 'GoogleAnalytics' ] ,
475+ mockCdnSettings ,
476+ updatedCDNSettings
477+ )
478+
479+ const remotePluginNames = updatedCDNSettings . remotePlugins ?. map (
480+ ( p ) => p . creationName
481+ )
482+
483+ // Explicitly verify that all Advertising integrations are blocked
484+ expect ( remotePluginNames ) . not . toContain ( 'FacebookPixel' )
485+ expect ( remotePluginNames ) . not . toContain ( 'TikTokPixel' )
486+ expect ( remotePluginNames ) . not . toContain ( 'PinterestTag' )
487+ expect ( remotePluginNames ) . toContain ( 'GoogleAnalytics' )
488+ } )
427489 } )
428490
429491 describe ( 'shouldDisableSegment' , ( ) => {
0 commit comments