File tree 1 file changed +13
-0
lines changed
packages/core/test/lib/utils
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 1
1
import { SentrySpan , getTraceData } from '../../../src/' ;
2
2
import * as SentryCoreCurrentScopes from '../../../src/currentScopes' ;
3
+ import * as SentryCoreExports from '../../../src/exports' ;
3
4
import * as SentryCoreTracing from '../../../src/tracing' ;
4
5
import * as SentryCoreSpanUtils from '../../../src/utils/spanUtils' ;
5
6
@@ -22,6 +23,10 @@ const mockedScope = {
22
23
} as any ;
23
24
24
25
describe ( 'getTraceData' , ( ) => {
26
+ beforeEach ( ( ) => {
27
+ jest . clearAllMocks ( ) ;
28
+ jest . spyOn ( SentryCoreExports , 'isEnabled' ) . mockReturnValue ( true ) ;
29
+ } ) ;
25
30
it ( 'returns the tracing data from the span, if a span is available' , ( ) => {
26
31
{
27
32
jest . spyOn ( SentryCoreTracing , 'getDynamicSamplingContextFromSpan' ) . mockReturnValueOnce ( {
@@ -139,6 +144,14 @@ describe('getTraceData', () => {
139
144
140
145
expect ( traceData ) . toEqual ( { } ) ;
141
146
} ) ;
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
+ } ) ;
142
155
} ) ;
143
156
144
157
describe ( 'isValidBaggageString' , ( ) => {
You can’t perform that action at this time.
0 commit comments