Skip to content

Commit aa7b3c9

Browse files
committed
test: Add tests for removing unsampled transaction from scope
1 parent f4ff847 commit aa7b3c9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

packages/tracing/test/idletransaction.test.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('IdleTransaction', () => {
3030
});
3131
});
3232

33-
it('removes transaction from scope on finish if onScope is true', () => {
33+
it('removes sampled transaction from scope on finish if onScope is true', () => {
3434
const transaction = new IdleTransaction({ name: 'foo' }, hub, 1000, true);
3535
transaction.initSpanRecorder(10);
3636

@@ -41,6 +41,17 @@ describe('IdleTransaction', () => {
4141
expect(s.getTransaction()).toBe(undefined);
4242
});
4343
});
44+
45+
it('removes unsampled transaction from scope on finish if onScope is true', () => {
46+
const transaction = new IdleTransaction({ name: 'foo', sampled: false }, hub, 1000, true);
47+
48+
transaction.finish();
49+
jest.runAllTimers();
50+
51+
hub.configureScope(s => {
52+
expect(s.getTransaction()).toBe(undefined);
53+
});
54+
});
4455
});
4556

4657
beforeEach(() => {

0 commit comments

Comments
 (0)