@@ -31,22 +31,34 @@ describe('Capture Errors Screen Transaction', () => {
3131 } ) ;
3232
3333 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 ! ;
3847
39- expect ( item ) . toEqual ( [
48+ expect ( header ) . toEqual (
4049 expect . objectContaining ( {
4150 length : expect . any ( Number ) ,
4251 type : 'transaction' ,
43- } ) ,
52+ } )
53+ ) ;
54+
55+ expect ( payload ) . toEqual (
4456 expect . objectContaining ( {
4557 platform : 'javascript' ,
4658 transaction : 'ErrorsScreen' ,
4759 contexts : expect . objectContaining ( {
48- trace : {
49- data : {
60+ trace : expect . objectContaining ( {
61+ data : expect . objectContaining ( {
5062 'route.has_been_seen' : false ,
5163 'route.key' : expect . stringMatching ( / ^ E r r o r s S c r e e n / ) ,
5264 'route.name' : 'ErrorsScreen' ,
@@ -56,15 +68,15 @@ describe('Capture Errors Screen Transaction', () => {
5668 'sentry.sample_rate' : 1 ,
5769 'sentry.source' : 'component' ,
5870 'thread.name' : 'javascript' ,
59- } ,
71+ } ) ,
6072 op : 'ui.load' ,
6173 origin : 'auto.app.start' ,
6274 span_id : expect . any ( String ) ,
6375 trace_id : expect . any ( String ) ,
64- } ,
76+ } ) ,
6577 } ) ,
66- } ) ,
67- ] ) ;
78+ } )
79+ ) ;
6880 } ) ;
6981
7082 it ( 'contains app start measurements' , async ( ) => {
0 commit comments