Skip to content

Commit b0a82c3

Browse files
committed
fix tests
1 parent 4757ebc commit b0a82c3

File tree

12 files changed

+28
-76
lines changed

12 files changed

+28
-76
lines changed

packages/browser/test/tracing/browserTracingIntegration.test.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -643,19 +643,15 @@ describe('browserTracingIntegration', () => {
643643
const newCurrentScopePropCtx = getCurrentScope().getPropagationContext();
644644

645645
expect(oldCurrentScopePropCtx).toEqual({
646-
spanId: expect.stringMatching(/[a-f0-9]{16}/),
647646
traceId: expect.stringMatching(/[a-f0-9]{32}/),
648647
});
649648
expect(oldIsolationScopePropCtx).toEqual({
650-
spanId: expect.stringMatching(/[a-f0-9]{16}/),
651649
traceId: expect.stringMatching(/[a-f0-9]{32}/),
652650
});
653651
expect(newCurrentScopePropCtx).toEqual({
654-
spanId: expect.stringMatching(/[a-f0-9]{16}/),
655652
traceId: expect.stringMatching(/[a-f0-9]{32}/),
656653
});
657654
expect(newIsolationScopePropCtx).toEqual({
658-
spanId: expect.stringMatching(/[a-f0-9]{16}/),
659655
traceId: expect.stringMatching(/[a-f0-9]{32}/),
660656
});
661657

@@ -680,16 +676,13 @@ describe('browserTracingIntegration', () => {
680676

681677
const propCtxBeforeEnd = getCurrentScope().getPropagationContext();
682678
expect(propCtxBeforeEnd).toStrictEqual({
683-
spanId: expect.stringMatching(/[a-f0-9]{16}/),
684679
traceId: expect.stringMatching(/[a-f0-9]{32}/),
685680
});
686681

687682
navigationSpan!.end();
688683

689684
const propCtxAfterEnd = getCurrentScope().getPropagationContext();
690685
expect(propCtxAfterEnd).toStrictEqual({
691-
// eslint-disable-next-line deprecation/deprecation
692-
spanId: propCtxBeforeEnd.spanId,
693686
traceId: propCtxBeforeEnd.traceId,
694687
sampled: true,
695688
dsc: {
@@ -720,16 +713,13 @@ describe('browserTracingIntegration', () => {
720713

721714
const propCtxBeforeEnd = getCurrentScope().getPropagationContext();
722715
expect(propCtxBeforeEnd).toStrictEqual({
723-
spanId: expect.stringMatching(/[a-f0-9]{16}/),
724716
traceId: expect.stringMatching(/[a-f0-9]{32}/),
725717
});
726718

727719
navigationSpan!.end();
728720

729721
const propCtxAfterEnd = getCurrentScope().getPropagationContext();
730722
expect(propCtxAfterEnd).toStrictEqual({
731-
// eslint-disable-next-line deprecation/deprecation
732-
spanId: propCtxBeforeEnd.spanId,
733723
traceId: propCtxBeforeEnd.traceId,
734724
sampled: false,
735725
dsc: {

packages/core/test/lib/feedback.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ describe('captureFeedback', () => {
260260

261261
getCurrentScope().setPropagationContext({
262262
traceId,
263-
spanId,
263+
parentSpanId: spanId,
264264
dsc,
265265
});
266266

@@ -290,7 +290,8 @@ describe('captureFeedback', () => {
290290
contexts: {
291291
trace: {
292292
trace_id: traceId,
293-
span_id: spanId,
293+
parent_span_id: spanId,
294+
span_id: expect.stringMatching(/[a-f0-9]{16}/),
294295
},
295296
feedback: {
296297
message: 'test',

packages/core/test/lib/prepareEvent.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ describe('parseEventHintOrCaptureContext', () => {
165165
requestSession: { status: 'ok' },
166166
propagationContext: {
167167
traceId: 'xxx',
168-
spanId: 'yyy',
169168
},
170169
};
171170

@@ -256,7 +255,7 @@ describe('prepareEvent', () => {
256255
tags: { tag1: 'aa', tag2: 'aa' },
257256
extra: { extra1: 'aa', extra2: 'aa' },
258257
contexts: { os: { name: 'os1' }, culture: { display_name: 'name1' } },
259-
propagationContext: { spanId: '1', traceId: '1' },
258+
propagationContext: { traceId: '1' },
260259
fingerprint: ['aa'],
261260
});
262261
scope.addBreadcrumb(breadcrumb1);

packages/core/test/lib/scope.test.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ describe('Scope', () => {
3232
eventProcessors: [],
3333
propagationContext: {
3434
traceId: expect.any(String),
35-
spanId: expect.any(String),
3635
},
3736
sdkProcessingMetadata: {},
3837
});
@@ -58,7 +57,6 @@ describe('Scope', () => {
5857
eventProcessors: [],
5958
propagationContext: {
6059
traceId: expect.any(String),
61-
spanId: expect.any(String),
6260
},
6361
sdkProcessingMetadata: {},
6462
});
@@ -92,7 +90,6 @@ describe('Scope', () => {
9290
eventProcessors: [],
9391
propagationContext: {
9492
traceId: expect.any(String),
95-
spanId: expect.any(String),
9693
},
9794
sdkProcessingMetadata: {},
9895
});
@@ -104,7 +101,6 @@ describe('Scope', () => {
104101

105102
expect(scope.getScopeData().propagationContext).toEqual({
106103
traceId: expect.any(String),
107-
spanId: expect.any(String),
108104
sampled: undefined,
109105
dsc: undefined,
110106
parentSpanId: undefined,
@@ -232,13 +228,11 @@ describe('Scope', () => {
232228
const oldPropagationContext = scope.getPropagationContext();
233229
scope.setPropagationContext({
234230
traceId: '86f39e84263a4de99c326acab3bfe3bd',
235-
spanId: '6e0c63257de34c92',
236231
sampled: true,
237232
});
238233
expect(scope.getPropagationContext()).not.toEqual(oldPropagationContext);
239234
expect(scope.getPropagationContext()).toEqual({
240235
traceId: '86f39e84263a4de99c326acab3bfe3bd',
241-
spanId: '6e0c63257de34c92',
242236
sampled: true,
243237
});
244238
});
@@ -330,7 +324,6 @@ describe('Scope', () => {
330324
expect(scope['_requestSession']).toEqual(undefined);
331325
expect(scope['_propagationContext']).toEqual({
332326
traceId: expect.any(String),
333-
spanId: expect.any(String),
334327
sampled: undefined,
335328
});
336329
expect(scope['_propagationContext']).not.toEqual(oldPropagationContext);
@@ -465,7 +458,6 @@ describe('Scope', () => {
465458
requestSession: { status: 'errored' as RequestSessionStatus },
466459
propagationContext: {
467460
traceId: '8949daf83f4a4a70bee4c1eb9ab242ed',
468-
spanId: 'a024ad8fea82680e',
469461
sampled: true,
470462
},
471463
};
@@ -493,7 +485,6 @@ describe('Scope', () => {
493485
expect(updatedScope._requestSession).toEqual({ status: 'errored' });
494486
expect(updatedScope._propagationContext).toEqual({
495487
traceId: '8949daf83f4a4a70bee4c1eb9ab242ed',
496-
spanId: 'a024ad8fea82680e',
497488
sampled: true,
498489
});
499490
});
@@ -542,7 +533,7 @@ describe('Scope', () => {
542533
tags: { tag1: 'aa', tag2: 'aa' },
543534
extra: { extra1: 'aa', extra2: 'aa' },
544535
contexts: { os: { name: 'os1' }, culture: { display_name: 'name1' } },
545-
propagationContext: { spanId: '1', traceId: '1' },
536+
propagationContext: { traceId: '1' },
546537
fingerprint: ['aa'],
547538
});
548539
scope.addBreadcrumb(breadcrumb1);

packages/core/test/lib/tracing/trace.test.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,6 @@ describe('startSpan', () => {
396396
withScope(scope => {
397397
scope.setPropagationContext({
398398
traceId: '99999999999999999999999999999999',
399-
spanId: '1212121212121212',
400399
dsc: {},
401400
parentSpanId: '4242424242424242',
402401
});
@@ -829,7 +828,6 @@ describe('startSpanManual', () => {
829828
withScope(scope => {
830829
scope.setPropagationContext({
831830
traceId: '99999999999999999999999999999991',
832-
spanId: '1212121212121212',
833831
dsc: {},
834832
parentSpanId: '4242424242424242',
835833
});
@@ -1147,7 +1145,6 @@ describe('startInactiveSpan', () => {
11471145
withScope(scope => {
11481146
scope.setPropagationContext({
11491147
traceId: '99999999999999999999999999999991',
1150-
spanId: '1212121212121212',
11511148
dsc: {},
11521149
parentSpanId: '4242424242424242',
11531150
});
@@ -1329,7 +1326,6 @@ describe('continueTrace', () => {
13291326

13301327
expect(scope.getPropagationContext()).toEqual({
13311328
sampled: undefined,
1332-
spanId: expect.any(String),
13331329
traceId: expect.any(String),
13341330
});
13351331

@@ -1351,7 +1347,6 @@ describe('continueTrace', () => {
13511347
dsc: {}, // DSC should be an empty object (frozen), because there was an incoming trace
13521348
sampled: false,
13531349
parentSpanId: '1121201211212012',
1354-
spanId: expect.any(String),
13551350
traceId: '12312012123120121231201212312012',
13561351
});
13571352

@@ -1376,7 +1371,6 @@ describe('continueTrace', () => {
13761371
},
13771372
sampled: true,
13781373
parentSpanId: '1121201211212012',
1379-
spanId: expect.any(String),
13801374
traceId: '12312012123120121231201212312012',
13811375
});
13821376

@@ -1401,7 +1395,6 @@ describe('continueTrace', () => {
14011395
},
14021396
sampled: true,
14031397
parentSpanId: '1121201211212012',
1404-
spanId: expect.any(String),
14051398
traceId: '12312012123120121231201212312012',
14061399
});
14071400

packages/core/test/lib/utils/applyScopeDataToEvent.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ describe('mergeScopeData', () => {
8181
extra: {},
8282
contexts: {},
8383
attachments: [],
84-
propagationContext: { spanId: '1', traceId: '1' },
84+
propagationContext: { traceId: '1' },
8585
sdkProcessingMetadata: {},
8686
fingerprint: [],
8787
};
@@ -93,7 +93,7 @@ describe('mergeScopeData', () => {
9393
extra: {},
9494
contexts: {},
9595
attachments: [],
96-
propagationContext: { spanId: '1', traceId: '1' },
96+
propagationContext: { traceId: '1' },
9797
sdkProcessingMetadata: {},
9898
fingerprint: [],
9999
};
@@ -106,7 +106,7 @@ describe('mergeScopeData', () => {
106106
extra: {},
107107
contexts: {},
108108
attachments: [],
109-
propagationContext: { spanId: '1', traceId: '1' },
109+
propagationContext: { traceId: '1' },
110110
sdkProcessingMetadata: {},
111111
fingerprint: [],
112112
});
@@ -133,7 +133,7 @@ describe('mergeScopeData', () => {
133133
extra: { extra1: 'aa', extra2: 'aa' },
134134
contexts: { os: { name: 'os1' }, culture: { display_name: 'name1' } },
135135
attachments: [attachment1],
136-
propagationContext: { spanId: '1', traceId: '1' },
136+
propagationContext: { traceId: '1' },
137137
sdkProcessingMetadata: {
138138
aa: 'aa',
139139
bb: 'aa',
@@ -153,7 +153,7 @@ describe('mergeScopeData', () => {
153153
extra: { extra2: 'bb', extra3: 'bb' },
154154
contexts: { os: { name: 'os2' } },
155155
attachments: [attachment2, attachment3],
156-
propagationContext: { spanId: '2', traceId: '2' },
156+
propagationContext: { traceId: '2' },
157157
sdkProcessingMetadata: {
158158
bb: 'bb',
159159
cc: 'bb',
@@ -174,7 +174,7 @@ describe('mergeScopeData', () => {
174174
extra: { extra1: 'aa', extra2: 'bb', extra3: 'bb' },
175175
contexts: { os: { name: 'os2' }, culture: { display_name: 'name1' } },
176176
attachments: [attachment1, attachment2, attachment3],
177-
propagationContext: { spanId: '2', traceId: '2' },
177+
propagationContext: { traceId: '2' },
178178
sdkProcessingMetadata: {
179179
aa: 'aa',
180180
bb: 'bb',
@@ -201,7 +201,7 @@ describe('applyScopeDataToEvent', () => {
201201
extra: {},
202202
contexts: {},
203203
attachments: [],
204-
propagationContext: { spanId: '1', traceId: '1' },
204+
propagationContext: { traceId: '1' },
205205
sdkProcessingMetadata: {},
206206
fingerprint: [],
207207
transactionName: 'foo',
@@ -222,7 +222,7 @@ describe('applyScopeDataToEvent', () => {
222222
extra: {},
223223
contexts: {},
224224
attachments: [],
225-
propagationContext: { spanId: '1', traceId: '1' },
225+
propagationContext: { traceId: '1' },
226226
sdkProcessingMetadata: {},
227227
fingerprint: [],
228228
transactionName: 'foo',
@@ -253,7 +253,7 @@ describe('applyScopeDataToEvent', () => {
253253
extra: {},
254254
contexts: {},
255255
attachments: [],
256-
propagationContext: { spanId: '1', traceId: '1' },
256+
propagationContext: { traceId: '1' },
257257
sdkProcessingMetadata: {},
258258
fingerprint: [],
259259
transactionName: '/users/:id',
@@ -277,7 +277,7 @@ describe('applyScopeDataToEvent', () => {
277277
extra: {},
278278
contexts: {},
279279
attachments: [],
280-
propagationContext: { spanId: '1', traceId: '1' },
280+
propagationContext: { traceId: '1' },
281281
sdkProcessingMetadata: {},
282282
fingerprint: [],
283283
transactionName: 'foo',

packages/core/test/lib/utils/traceData.test.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@ import { TestClient, getDefaultTestClientOptions } from '../../mocks/client';
1919
const dsn = 'https://123@sentry.io/42';
2020

2121
const SCOPE_TRACE_ID = '12345678901234567890123456789012';
22-
const SCOPE_SPAN_ID = '1234567890123456';
2322

2423
function setupClient(opts?: Partial<TestClientOptions>): Client {
2524
getCurrentScope().setPropagationContext({
2625
traceId: SCOPE_TRACE_ID,
27-
spanId: SCOPE_SPAN_ID,
2826
});
2927

3028
const options = getDefaultTestClientOptions({
@@ -164,7 +162,7 @@ describe('getTraceData', () => {
164162
getCurrentScope().setPropagationContext({
165163
traceId: '12345678901234567890123456789012',
166164
sampled: true,
167-
spanId: '1234567890123456',
165+
parentSpanId: '1234567890123456',
168166
dsc: {
169167
environment: 'staging',
170168
public_key: 'key',
@@ -174,10 +172,10 @@ describe('getTraceData', () => {
174172

175173
const traceData = getTraceData();
176174

177-
expect(traceData).toEqual({
178-
'sentry-trace': '12345678901234567890123456789012-1234567890123456-1',
179-
baggage: 'sentry-environment=staging,sentry-public_key=key,sentry-trace_id=12345678901234567890123456789012',
180-
});
175+
expect(traceData['sentry-trace']).toMatch(/^12345678901234567890123456789012-[a-f0-9]{16}-1$/);
176+
expect(traceData.baggage).toEqual(
177+
'sentry-environment=staging,sentry-public_key=key,sentry-trace_id=12345678901234567890123456789012',
178+
);
181179
});
182180

183181
it('returns frozen DSC from SentrySpan if available', () => {

packages/core/test/utils-hoist/proagationContext.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ describe('generatePropagationContext', () => {
55
// eslint-disable-next-line deprecation/deprecation
66
expect(generatePropagationContext()).toEqual({
77
traceId: expect.stringMatching(/^[0-9a-f]{32}$/),
8-
spanId: expect.stringMatching(/^[0-9a-f]{16}$/),
98
});
109
});
1110
});

0 commit comments

Comments
 (0)