@@ -53,7 +53,6 @@ describe('onClientEntry', () => {
53
53
environment : process . env . NODE_ENV ,
54
54
integrations : [ ] ,
55
55
release : ( global as any ) . __SENTRY_RELEASE__ ,
56
- tracesSampleRate : 0 ,
57
56
} ) ;
58
57
} ) ;
59
58
@@ -100,6 +99,16 @@ describe('onClientEntry', () => {
100
99
) ;
101
100
} ) ;
102
101
102
+ it ( 'sets a tracesSampler if defined as option' , ( ) => {
103
+ const tracesSampler = jest . fn ( ) ;
104
+ onClientEntry ( undefined , { tracesSampler } ) ;
105
+ expect ( sentryInit ) . toHaveBeenLastCalledWith (
106
+ expect . objectContaining ( {
107
+ tracesSampler,
108
+ } ) ,
109
+ ) ;
110
+ } ) ;
111
+
103
112
it ( 'adds `BrowserTracing` integration if tracesSampleRate is defined' , ( ) => {
104
113
onClientEntry ( undefined , { tracesSampleRate : 0.5 } ) ;
105
114
expect ( sentryInit ) . toHaveBeenLastCalledWith (
@@ -109,6 +118,16 @@ describe('onClientEntry', () => {
109
118
) ;
110
119
} ) ;
111
120
121
+ it ( 'adds `BrowserTracing` integration if tracesSampler is defined' , ( ) => {
122
+ const tracesSampler = jest . fn ( ) ;
123
+ onClientEntry ( undefined , { tracesSampler } ) ;
124
+ expect ( sentryInit ) . toHaveBeenLastCalledWith (
125
+ expect . objectContaining ( {
126
+ integrations : [ expect . objectContaining ( { name : 'BrowserTracing' } ) ] ,
127
+ } ) ,
128
+ ) ;
129
+ } ) ;
130
+
112
131
it ( 'only defines a single `BrowserTracing` integration' , ( ) => {
113
132
const Tracing = jest . requireActual ( '@sentry/tracing' ) ;
114
133
const integrations = [ new Tracing . Integrations . BrowserTracing ( ) ] ;
0 commit comments