@@ -4,16 +4,23 @@ import { vi } from 'vitest';
44import { getTracingMetaTags , isValidBaggageString } from '../../src/server/meta' ;
55
66const mockedSpan = {
7- sampled : true ,
8- traceId : '12345678901234567890123456789012' ,
9- spanId : '1234567890123456' ,
7+ spanContext : ( ) => {
8+ return {
9+ traceId : '12345678901234567890123456789012' ,
10+ spanId : '1234567890123456' ,
11+ traceFlags : TraceFlagSampled ,
12+ } ;
13+ } ,
1014 transaction : {
1115 getDynamicSamplingContext : ( ) => ( {
1216 environment : 'production' ,
1317 } ) ,
1418 } ,
1519} as any ;
1620
21+ // eslint-disable-next-line no-bitwise
22+ const TraceFlagSampled = 0x1 << 0 ;
23+
1724const mockedClient = { } as any ;
1825
1926const mockedScope = {
@@ -70,9 +77,13 @@ describe('getTracingMetaTags', () => {
7077 const tags = getTracingMetaTags (
7178 // @ts -expect-error - only passing a partial span object
7279 {
73- sampled : true ,
74- traceId : '12345678901234567890123456789012' ,
75- spanId : '1234567890123456' ,
80+ spanContext : ( ) => {
81+ return {
82+ traceId : '12345678901234567890123456789012' ,
83+ spanId : '1234567890123456' ,
84+ traceFlags : TraceFlagSampled ,
85+ } ;
86+ } ,
7687 transaction : undefined ,
7788 } ,
7889 mockedScope ,
@@ -84,7 +95,7 @@ describe('getTracingMetaTags', () => {
8495 } ) ;
8596 } ) ;
8697
87- it ( 'returns only the `sentry-trace` tag if no DSC is available' , ( ) => {
98+ it ( 'returns only the `sentry-trace` tag if no DSC is available without a client ' , ( ) => {
8899 vi . spyOn ( SentryCore , 'getDynamicSamplingContextFromClient' ) . mockReturnValueOnce ( {
89100 trace_id : '' ,
90101 public_key : undefined ,
@@ -93,9 +104,13 @@ describe('getTracingMetaTags', () => {
93104 const tags = getTracingMetaTags (
94105 // @ts -expect-error - only passing a partial span object
95106 {
96- sampled : true ,
97- traceId : '12345678901234567890123456789012' ,
98- spanId : '1234567890123456' ,
107+ spanContext : ( ) => {
108+ return {
109+ traceId : '12345678901234567890123456789012' ,
110+ spanId : '1234567890123456' ,
111+ traceFlags : TraceFlagSampled ,
112+ } ;
113+ } ,
99114 transaction : undefined ,
100115 } ,
101116 mockedScope ,
0 commit comments