Skip to content

Commit e738c71

Browse files
committed
fix test
1 parent cff75ed commit e738c71

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

packages/hub/test/scope.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ describe('Scope', () => {
361361
const scope = new Scope();
362362
const span = {
363363
fake: 'span',
364+
spanContext: () => ({}),
364365
toJSON: () => ({ origin: 'manual' }),
365366
} as any;
366367
scope.setSpan(span);
@@ -374,6 +375,7 @@ describe('Scope', () => {
374375
const scope = new Scope();
375376
const span = {
376377
fake: 'span',
378+
spanContext: () => ({}),
377379
toJSON: () => ({ a: 'b' }),
378380
} as any;
379381
scope.setSpan(span);
@@ -392,6 +394,7 @@ describe('Scope', () => {
392394
const scope = new Scope();
393395
const transaction = {
394396
fake: 'span',
397+
spanContext: () => ({}),
395398
toJSON: () => ({ a: 'b' }),
396399
name: 'fake transaction',
397400
getDynamicSamplingContext: () => ({}),
@@ -407,9 +410,15 @@ describe('Scope', () => {
407410
test('adds `transaction` tag when span on scope', async () => {
408411
expect.assertions(1);
409412
const scope = new Scope();
410-
const transaction = { name: 'fake transaction', getDynamicSamplingContext: () => ({}) };
413+
const transaction = {
414+
name: 'fake transaction',
415+
spanContext: () => ({}),
416+
toJSON: () => ({ description: 'fake transaction' }),
417+
getDynamicSamplingContext: () => ({}),
418+
};
411419
const span = {
412420
fake: 'span',
421+
spanContext: () => ({}),
413422
toJSON: () => ({ a: 'b' }),
414423
transaction,
415424
} as any;

packages/tracing/test/idletransaction.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ describe('IdleTransaction', () => {
145145

146146
startSpanManual({ name: 'inner1' }, span => {
147147
const childSpan = startInactiveSpan({ name: 'inner2' })!;
148-
expect(transaction.activities).toMatchObject({ [span!.spanId]: true, [childSpan.spanId]: true });
148+
expect(transaction.activities).toMatchObject({
149+
[span!.spanContext().spanId]: true,
150+
[childSpan.spanContext().spanId]: true,
151+
});
149152
span?.end();
150153
jest.advanceTimersByTime(TRACING_DEFAULTS.idleTimeout + 1);
151154

0 commit comments

Comments
 (0)