@@ -31,22 +31,34 @@ describe('Capture Errors Screen Transaction', () => {
31
31
} ) ;
32
32
33
33
it ( 'envelope contains transaction context' , async ( ) => {
34
- const item = getItemOfTypeFrom < EventItem > (
35
- getErrorsEnvelope ( ) ,
36
- 'transaction' ,
37
- ) ;
34
+ const envelope = getErrorsEnvelope ( ) ;
35
+
36
+ const items = envelope [ 1 ] ;
37
+ const transactions = items . filter ( ( [ header ] ) => header . type === 'transaction' ) ;
38
+ const appStartTransaction = transactions . find ( ( [ _header , payload ] ) => {
39
+ const event = payload as any ;
40
+ return event . transaction === 'ErrorsScreen' &&
41
+ event . contexts ?. trace ?. origin === 'auto.app.start' ;
42
+ } ) ;
43
+
44
+ expect ( appStartTransaction ) . toBeDefined ( ) ;
45
+
46
+ const [ header , payload ] = appStartTransaction ! ;
38
47
39
- expect ( item ) . toEqual ( [
48
+ expect ( header ) . toEqual (
40
49
expect . objectContaining ( {
41
50
length : expect . any ( Number ) ,
42
51
type : 'transaction' ,
43
- } ) ,
52
+ } )
53
+ ) ;
54
+
55
+ expect ( payload ) . toEqual (
44
56
expect . objectContaining ( {
45
57
platform : 'javascript' ,
46
58
transaction : 'ErrorsScreen' ,
47
59
contexts : expect . objectContaining ( {
48
- trace : {
49
- data : {
60
+ trace : expect . objectContaining ( {
61
+ data : expect . objectContaining ( {
50
62
'route.has_been_seen' : false ,
51
63
'route.key' : expect . stringMatching ( / ^ E r r o r s S c r e e n / ) ,
52
64
'route.name' : 'ErrorsScreen' ,
@@ -56,15 +68,15 @@ describe('Capture Errors Screen Transaction', () => {
56
68
'sentry.sample_rate' : 1 ,
57
69
'sentry.source' : 'component' ,
58
70
'thread.name' : 'javascript' ,
59
- } ,
71
+ } ) ,
60
72
op : 'ui.load' ,
61
73
origin : 'auto.app.start' ,
62
74
span_id : expect . any ( String ) ,
63
75
trace_id : expect . any ( String ) ,
64
- } ,
76
+ } ) ,
65
77
} ) ,
66
- } ) ,
67
- ] ) ;
78
+ } )
79
+ ) ;
68
80
} ) ;
69
81
70
82
it ( 'contains app start measurements' , async ( ) => {
0 commit comments