Skip to content

Commit

Permalink
test: Add tests for removing unsampled transaction from scope
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilogorek committed Feb 1, 2021
1 parent f4ff847 commit aa7b3c9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/tracing/test/idletransaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('IdleTransaction', () => {
});
});

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

Expand All @@ -41,6 +41,17 @@ describe('IdleTransaction', () => {
expect(s.getTransaction()).toBe(undefined);
});
});

it('removes unsampled transaction from scope on finish if onScope is true', () => {
const transaction = new IdleTransaction({ name: 'foo', sampled: false }, hub, 1000, true);

transaction.finish();
jest.runAllTimers();

hub.configureScope(s => {
expect(s.getTransaction()).toBe(undefined);
});
});
});

beforeEach(() => {
Expand Down

0 comments on commit aa7b3c9

Please sign in to comment.