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', () => {
2424 const actual = jest . requireActual ( '@sentry/utils' ) ;
2525 return {
2626 ...actual ,
27- addInstrumentationHandler : ( { callback , type } : any ) : void => {
27+ addInstrumentationHandler : ( type , callback ) : void => {
2828 if ( type === 'history' ) {
2929 // rather than actually add the navigation-change handler, grab a reference to it, so we can trigger it manually
3030 mockChangeHistory = callback ;
Original file line number Diff line number Diff line change @@ -26,26 +26,20 @@ describe('instrumentOutgoingRequests', () => {
2626 it ( 'instruments fetch and xhr requests' , ( ) => {
2727 instrumentOutgoingRequests ( ) ;
2828
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 ) ) ;
3731 } ) ;
3832
3933 it ( 'does not instrument fetch requests if traceFetch is false' , ( ) => {
4034 instrumentOutgoingRequests ( { traceFetch : false } ) ;
4135
42- expect ( addInstrumentationHandler ) . not . toHaveBeenCalledWith ( { callback : expect . any ( Function ) , type : 'fetch' } ) ;
36+ expect ( addInstrumentationHandler ) . not . toHaveBeenCalledWith ( 'fetch' , expect . any ( Function ) ) ;
4337 } ) ;
4438
4539 it ( 'does not instrument xhr requests if traceXHR is false' , ( ) => {
4640 instrumentOutgoingRequests ( { traceXHR : false } ) ;
4741
48- expect ( addInstrumentationHandler ) . not . toHaveBeenCalledWith ( { callback : expect . any ( Function ) , type : 'xhr' } ) ;
42+ expect ( addInstrumentationHandler ) . not . toHaveBeenCalledWith ( 'xhr' , expect . any ( Function ) ) ;
4943 } ) ;
5044} ) ;
5145
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ jest.mock('@sentry/utils', () => {
88 const actual = jest . requireActual ( '@sentry/utils' ) ;
99 return {
1010 ...actual ,
11- addInstrumentationHandler : ( { callback , type } : any ) : void => {
11+ addInstrumentationHandler : ( type , callback ) : void => {
1212 addInstrumentationHandlerType = type ;
1313 mockChangeHistory = callback ;
1414 } ,
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ jest.mock('@sentry/utils', () => {
2020 mockUnhandledRejectionCallback = callback ;
2121 }
2222 if ( typeof mockAddInstrumentationHandler === 'function' ) {
23- return mockAddInstrumentationHandler ( { callback , type } ) ;
23+ return mockAddInstrumentationHandler ( type , callback ) ;
2424 }
2525 } ,
2626 } ;
@@ -45,11 +45,8 @@ describe('registerErrorHandlers()', () => {
4545 it ( 'registers error instrumentation' , ( ) => {
4646 registerErrorInstrumentation ( ) ;
4747 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 ) ) ;
5350 } ) ;
5451
5552 it ( 'does not set status if transaction is not on scope' , ( ) => {
You can’t perform that action at this time.
0 commit comments