File tree Expand file tree Collapse file tree 4 files changed +9
-18
lines changed Expand file tree Collapse file tree 4 files changed +9
-18
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ jest.mock('@sentry/utils', () => {
24
24
const actual = jest . requireActual ( '@sentry/utils' ) ;
25
25
return {
26
26
...actual ,
27
- addInstrumentationHandler : ( { callback , type } : any ) : void => {
27
+ addInstrumentationHandler : ( type , callback ) : void => {
28
28
if ( type === 'history' ) {
29
29
// rather than actually add the navigation-change handler, grab a reference to it, so we can trigger it manually
30
30
mockChangeHistory = callback ;
Original file line number Diff line number Diff line change @@ -26,26 +26,20 @@ describe('instrumentOutgoingRequests', () => {
26
26
it ( 'instruments fetch and xhr requests' , ( ) => {
27
27
instrumentOutgoingRequests ( ) ;
28
28
29
- expect ( addInstrumentationHandler ) . toHaveBeenCalledWith ( {
30
- callback : expect . any ( Function ) ,
31
- type : 'fetch' ,
32
- } ) ;
33
- expect ( addInstrumentationHandler ) . toHaveBeenCalledWith ( {
34
- callback : expect . any ( Function ) ,
35
- type : 'xhr' ,
36
- } ) ;
29
+ expect ( addInstrumentationHandler ) . toHaveBeenCalledWith ( 'fetch' , expect . any ( Function ) ) ;
30
+ expect ( addInstrumentationHandler ) . toHaveBeenCalledWith ( 'xhr' , expect . any ( Function ) ) ;
37
31
} ) ;
38
32
39
33
it ( 'does not instrument fetch requests if traceFetch is false' , ( ) => {
40
34
instrumentOutgoingRequests ( { traceFetch : false } ) ;
41
35
42
- expect ( addInstrumentationHandler ) . not . toHaveBeenCalledWith ( { callback : expect . any ( Function ) , type : 'fetch' } ) ;
36
+ expect ( addInstrumentationHandler ) . not . toHaveBeenCalledWith ( 'fetch' , expect . any ( Function ) ) ;
43
37
} ) ;
44
38
45
39
it ( 'does not instrument xhr requests if traceXHR is false' , ( ) => {
46
40
instrumentOutgoingRequests ( { traceXHR : false } ) ;
47
41
48
- expect ( addInstrumentationHandler ) . not . toHaveBeenCalledWith ( { callback : expect . any ( Function ) , type : 'xhr' } ) ;
42
+ expect ( addInstrumentationHandler ) . not . toHaveBeenCalledWith ( 'xhr' , expect . any ( Function ) ) ;
49
43
} ) ;
50
44
} ) ;
51
45
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ jest.mock('@sentry/utils', () => {
8
8
const actual = jest . requireActual ( '@sentry/utils' ) ;
9
9
return {
10
10
...actual ,
11
- addInstrumentationHandler : ( { callback , type } : any ) : void => {
11
+ addInstrumentationHandler : ( type , callback ) : void => {
12
12
addInstrumentationHandlerType = type ;
13
13
mockChangeHistory = callback ;
14
14
} ,
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ jest.mock('@sentry/utils', () => {
20
20
mockUnhandledRejectionCallback = callback ;
21
21
}
22
22
if ( typeof mockAddInstrumentationHandler === 'function' ) {
23
- return mockAddInstrumentationHandler ( { callback , type } ) ;
23
+ return mockAddInstrumentationHandler ( type , callback ) ;
24
24
}
25
25
} ,
26
26
} ;
@@ -45,11 +45,8 @@ describe('registerErrorHandlers()', () => {
45
45
it ( 'registers error instrumentation' , ( ) => {
46
46
registerErrorInstrumentation ( ) ;
47
47
expect ( mockAddInstrumentationHandler ) . toHaveBeenCalledTimes ( 2 ) ;
48
- expect ( mockAddInstrumentationHandler ) . toHaveBeenNthCalledWith ( 1 , { callback : expect . any ( Function ) , type : 'error' } ) ;
49
- expect ( mockAddInstrumentationHandler ) . toHaveBeenNthCalledWith ( 2 , {
50
- callback : expect . any ( Function ) ,
51
- type : 'unhandledrejection' ,
52
- } ) ;
48
+ expect ( mockAddInstrumentationHandler ) . toHaveBeenNthCalledWith ( 1 , 'error' , expect . any ( Function ) ) ;
49
+ expect ( mockAddInstrumentationHandler ) . toHaveBeenNthCalledWith ( 2 , 'unhandledrejection' , expect . any ( Function ) ) ;
53
50
} ) ;
54
51
55
52
it ( 'does not set status if transaction is not on scope' , ( ) => {
You can’t perform that action at this time.
0 commit comments