@@ -2,6 +2,9 @@ import type { Event, EventProcessor } from '@sentry/types';
2
2
3
3
import type { InboundFiltersOptions } from '../../../src/integrations/inboundfilters' ;
4
4
import { InboundFilters } from '../../../src/integrations/inboundfilters' ;
5
+ import { getDefaultTestClientOptions , TestClient } from '../../mocks/client' ;
6
+
7
+ const PUBLIC_DSN = 'https://username@domain/123' ;
5
8
6
9
/**
7
10
* Creates an instance of the InboundFilters integration and returns
@@ -25,30 +28,22 @@ function createInboundFiltersEventProcessor(
25
28
options : Partial < InboundFiltersOptions > = { } ,
26
29
clientOptions : Partial < InboundFiltersOptions > = { } ,
27
30
) : 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 ! ;
52
47
}
53
48
54
49
// Fixtures
0 commit comments