Skip to content

Commit e13e428

Browse files
cjr125Christopher Roberts
authored andcommitted
added unit test
1 parent c6ce470 commit e13e428

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

packages/rum-core/test/performance-monitoring/transaction-service.spec.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,34 @@ describe('TransactionService', function () {
619619

620620
transaction.end(pageLoadTime + 1000)
621621
})
622+
623+
it('should capture tags from dispatch context', done => {
624+
config.setConfig({
625+
transactionContextCallback: () => {
626+
let stack
627+
try {
628+
throw new Error('')
629+
}
630+
catch (error) {
631+
stack = error.stack || ''
632+
}
633+
stack = stack.split('\n').map(function (line) { return line.trim(); })
634+
return { stack };
635+
}
636+
})
637+
const transactionService = new TransactionService(logger, config)
638+
639+
const tr1 = transactionService.startTransaction(
640+
'transaction1',
641+
'transaction'
642+
)
643+
644+
tr1.onEnd = () => {
645+
expect(tr1.options.tags.stack).toBeTruthy()
646+
done()
647+
}
648+
tr1.end()
649+
})
622650
})
623651

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

0 commit comments

Comments
 (0)