Skip to content

Commit

Permalink
added unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
cjr125 authored and Christopher Roberts committed Dec 4, 2024
1 parent c6ce470 commit d0e19bc
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,35 @@ describe('TransactionService', function () {

transaction.end(pageLoadTime + 1000)
})

it('should capture tags from dispatch context', done => {
// todo: can't test hard navigation metrics since karma runs tests inside an iframe
config.setConfig({
transactionContextCallback: () => {
let stack
try {
throw new Error('')
}
catch (error) {
stack = error.stack || ''
}
stack = stack.split('\n').map(function (line) { return line.trim(); })
return { stack };
}
})
const transactionService = new TransactionService(logger, config)

const tr1 = transactionService.startTransaction(
'transaction1',
'transaction'
)

tr1.onEnd = () => {
expect(tr1.options.tags.stack).toBeTruthy()
done()
}
tr1.end()
})
})

it('should truncate active spans after transaction ends', () => {
Expand Down

0 comments on commit d0e19bc

Please sign in to comment.