|
@@ -15,6 +15,7 @@ import {
|
|
|
import type {ParentAutogroupNode} from './parentAutogroupNode';
|
|
|
import {TraceTree} from './traceTree';
|
|
|
import {
|
|
|
+ assertTransactionNode,
|
|
|
makeEventTransaction,
|
|
|
makeSpan,
|
|
|
makeTrace,
|
|
@@ -993,6 +994,38 @@ describe('TraceTree', () => {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ describe('FindByID', () => {
|
|
|
+ it('finds transaction by event_id', () => {
|
|
|
+ const traceWithError = makeTrace({
|
|
|
+ transactions: [
|
|
|
+ makeTransaction({transaction: 'first', event_id: 'first-event-id'}),
|
|
|
+ ],
|
|
|
+ });
|
|
|
+ const tree = TraceTree.FromTrace(traceWithError, traceMetadata);
|
|
|
+ const node = TraceTree.FindByID(tree.root, 'first-event-id');
|
|
|
+
|
|
|
+ assertTransactionNode(node);
|
|
|
+ expect(node.value.transaction).toBe('first');
|
|
|
+ });
|
|
|
+
|
|
|
+ it('matches by error event_id', () => {
|
|
|
+ const traceWithError = makeTrace({
|
|
|
+ transactions: [
|
|
|
+ makeTransaction({
|
|
|
+ transaction: 'first',
|
|
|
+ event_id: 'txn-event-id',
|
|
|
+ errors: [makeTraceError({event_id: 'error-event-id'})],
|
|
|
+ }),
|
|
|
+ ],
|
|
|
+ });
|
|
|
+ const tree = TraceTree.FromTrace(traceWithError, traceMetadata);
|
|
|
+ const node = TraceTree.FindByID(tree.root, 'error-event-id');
|
|
|
+
|
|
|
+ assertTransactionNode(node);
|
|
|
+ expect(node.value.transaction).toBe('first');
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
describe('FindAll', () => {
|
|
|
it('finds all nodes by predicate', () => {
|
|
|
const tree = TraceTree.FromTrace(trace, traceMetadata);
|