@@ -5,6 +5,8 @@ import * as RN from 'react-native';
55
66import { ReactNativeClient } from '../src/js/client' ;
77import type { ReactNativeClientOptions } from '../src/js/options' ;
8+ import type { RoutingInstrumentationInstance } from '../src/js/tracing' ;
9+ import { ReactNativeTracing } from '../src/js/tracing' ;
810import { NativeTransport } from '../src/js/transports/native' ;
911import { SDK_NAME , SDK_PACKAGE_NAME , SDK_VERSION } from '../src/js/version' ;
1012import { NATIVE } from '../src/js/wrapper' ;
@@ -29,6 +31,8 @@ interface MockedReactNative {
2931 crash : jest . Mock ;
3032 captureEnvelope : jest . Mock ;
3133 captureScreenshot : jest . Mock ;
34+ fetchNativeAppStart : jest . Mock ;
35+ enableNativeFramesTracking : jest . Mock ;
3236 } ;
3337 } ;
3438 Platform : {
@@ -54,6 +58,8 @@ jest.mock(
5458 crash : jest . fn ( ) ,
5559 captureEnvelope : jest . fn ( ) ,
5660 captureScreenshot : jest . fn ( ) . mockResolvedValue ( null ) ,
61+ fetchNativeAppStart : jest . fn ( ) ,
62+ enableNativeFramesTracking : jest . fn ( ) ,
5763 } ,
5864 } ,
5965 Platform : {
@@ -530,6 +536,27 @@ describe('Tests ReactNativeClient', () => {
530536 client . recordDroppedEvent ( 'before_send' , 'error' ) ;
531537 }
532538 } ) ;
539+
540+ describe ( 'register enabled instrumentation as integrations' , ( ) => {
541+ test ( 'register routing instrumentation' , ( ) => {
542+ const mockRoutingInstrumentation : RoutingInstrumentationInstance = {
543+ registerRoutingInstrumentation : jest . fn ( ) ,
544+ onRouteWillChange : jest . fn ( ) ,
545+ name : 'MockRoutingInstrumentation' ,
546+ }
547+ const client = new ReactNativeClient ( mockedOptions ( {
548+ dsn : EXAMPLE_DSN ,
549+ integrations : [
550+ new ReactNativeTracing ( {
551+ routingInstrumentation : mockRoutingInstrumentation ,
552+ } ) ,
553+ ] ,
554+ } ) ) ;
555+ client . setupIntegrations ( ) ;
556+
557+ expect ( client . getIntegrationById ( 'MockRoutingInstrumentation' ) ) . toBeTruthy ( ) ;
558+ } ) ;
559+ } ) ;
533560} ) ;
534561
535562function mockedOptions ( options : Partial < ReactNativeClientOptions > ) : ReactNativeClientOptions {
0 commit comments