File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed 
packages/core/test/lib/utils Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 11import  {  SentrySpan ,  getTraceData  }  from  '../../../src/' ; 
22import  *  as  SentryCoreCurrentScopes  from  '../../../src/currentScopes' ; 
3+ import  *  as  SentryCoreExports  from  '../../../src/exports' ; 
34import  *  as  SentryCoreTracing  from  '../../../src/tracing' ; 
45import  *  as  SentryCoreSpanUtils  from  '../../../src/utils/spanUtils' ; 
56
@@ -22,6 +23,10 @@ const mockedScope = {
2223}  as  any ; 
2324
2425describe ( 'getTraceData' ,  ( )  =>  { 
26+   beforeEach ( ( )  =>  { 
27+     jest . clearAllMocks ( ) ; 
28+     jest . spyOn ( SentryCoreExports ,  'isEnabled' ) . mockReturnValue ( true ) ; 
29+   } ) ; 
2530  it ( 'returns the tracing data from the span, if a span is available' ,  ( )  =>  { 
2631    { 
2732      jest . spyOn ( SentryCoreTracing ,  'getDynamicSamplingContextFromSpan' ) . mockReturnValueOnce ( { 
@@ -139,6 +144,14 @@ describe('getTraceData', () => {
139144
140145    expect ( traceData ) . toEqual ( { } ) ; 
141146  } ) ; 
147+ 
148+   it ( 'returns an empty object if the SDK is disabled' ,  ( )  =>  { 
149+     jest . spyOn ( SentryCoreExports ,  'isEnabled' ) . mockReturnValueOnce ( false ) ; 
150+ 
151+     const  traceData  =  getTraceData ( ) ; 
152+ 
153+     expect ( traceData ) . toEqual ( { } ) ; 
154+   } ) ; 
142155} ) ; 
143156
144157describe ( 'isValidBaggageString' ,  ( )  =>  { 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments