@@ -2,6 +2,9 @@ import type { Event, EventProcessor } from '@sentry/types';
22
33import type { InboundFiltersOptions } from '../../../src/integrations/inboundfilters' ;
44import { InboundFilters } from '../../../src/integrations/inboundfilters' ;
5+ import { getDefaultTestClientOptions , TestClient } from '../../mocks/client' ;
6+
7+ const PUBLIC_DSN = 'https://username@domain/123' ;
58
69/**
710 * Creates an instance of the InboundFilters integration and returns
@@ -25,30 +28,22 @@ function createInboundFiltersEventProcessor(
2528 options : Partial < InboundFiltersOptions > = { } ,
2629 clientOptions : Partial < InboundFiltersOptions > = { } ,
2730) : EventProcessor {
28- const eventProcessors : EventProcessor [ ] = [ ] ;
29- const inboundFiltersInstance = new InboundFilters ( options ) ;
30-
31- function addGlobalEventProcessor ( processor : EventProcessor ) : void {
32- eventProcessors . push ( processor ) ;
33- expect ( eventProcessors ) . toHaveLength ( 1 ) ;
34- }
35-
36- function getCurrentHub ( ) : any {
37- return {
38- getIntegration ( _integration : any ) : any {
39- // pretend integration is enabled
40- return inboundFiltersInstance ;
41- } ,
42- getClient ( ) : any {
43- return {
44- getOptions : ( ) => clientOptions ,
45- } ;
46- } ,
47- } ;
48- }
49-
50- inboundFiltersInstance . setupOnce ( addGlobalEventProcessor , getCurrentHub ) ;
51- return eventProcessors [ 0 ] ;
31+ const client = new TestClient (
32+ getDefaultTestClientOptions ( {
33+ dsn : PUBLIC_DSN ,
34+ ...clientOptions ,
35+ defaultIntegrations : false ,
36+ integrations : [ new InboundFilters ( options ) ] ,
37+ } ) ,
38+ ) ;
39+
40+ client . setupIntegrations ( ) ;
41+
42+ const eventProcessors = client [ '_eventProcessors' ] ;
43+ const eventProcessor = eventProcessors . find ( processor => processor . id === 'InboundFilters' ) ;
44+
45+ expect ( eventProcessor ) . toBeDefined ( ) ;
46+ return eventProcessor ! ;
5247}
5348
5449// Fixtures
0 commit comments