@@ -192,6 +192,13 @@ describe('Hub', () => {
192192        expect ( logger . warn ) . toHaveBeenCalledWith ( expect . stringContaining ( 'Sample rate must be a boolean or a number' ) ) ; 
193193      } ) ; 
194194
195+       it ( 'should reject tracesSampleRates which are NaN' ,  ( )  =>  { 
196+         const  hub  =  new  Hub ( new  BrowserClient ( {  tracesSampleRate : 'dogs!'  as  any  } ) ) ; 
197+         hub . startTransaction ( {  name : 'dogpark'  } ) ; 
198+ 
199+         expect ( logger . warn ) . toHaveBeenCalledWith ( expect . stringContaining ( 'Sample rate must be a boolean or a number' ) ) ; 
200+       } ) ; 
201+ 
195202      // the rate might be a boolean, but for our purposes, false is equivalent to 0 and true is equivalent to 1 
196203      it ( 'should reject tracesSampleRates less than 0' ,  ( )  =>  { 
197204        const  hub  =  new  Hub ( new  BrowserClient ( {  tracesSampleRate : - 26  } ) ) ; 
@@ -216,6 +223,14 @@ describe('Hub', () => {
216223        expect ( logger . warn ) . toHaveBeenCalledWith ( expect . stringContaining ( 'Sample rate must be a boolean or a number' ) ) ; 
217224      } ) ; 
218225
226+       it ( 'should reject tracesSampler return values which are NaN' ,  ( )  =>  { 
227+         const  tracesSampler  =  jest . fn ( ) . mockReturnValue ( NaN ) ; 
228+         const  hub  =  new  Hub ( new  BrowserClient ( {  tracesSampler } ) ) ; 
229+         hub . startTransaction ( {  name : 'dogpark'  } ) ; 
230+ 
231+         expect ( logger . warn ) . toHaveBeenCalledWith ( expect . stringContaining ( 'Sample rate must be a boolean or a number' ) ) ; 
232+       } ) ; 
233+ 
219234      // the rate might be a boolean, but for our purposes, false is equivalent to 0 and true is equivalent to 1 
220235      it ( 'should reject tracesSampler return values less than 0' ,  ( )  =>  { 
221236        const  tracesSampler  =  jest . fn ( ) . mockReturnValue ( - 12 ) ; 
@@ -260,11 +275,11 @@ describe('Hub', () => {
260275      } ) ; 
261276
262277      it ( 'should propagate sampling decision to child transactions in XHR header' ,  ( )  =>  { 
263-         // TODO this doesn't currently happen, but it should  
278+         // TODO fix  this and write the test  
264279      } ) ; 
265280
266281      it ( 'should propagate sampling decision to child transactions in fetch header' ,  ( )  =>  { 
267-         // TODO this doesn't currently happen, but it should  
282+         // TODO fix  this and write the test  
268283      } ) ; 
269284
270285      it ( "should inherit parent's sampling decision when creating a new transaction if tracesSampler is undefined" ,  ( )  =>  { 
0 commit comments