@@ -24,17 +24,11 @@ const assertSentryTransaction = (actual: Record<string, unknown>, expected: Reco
24
24
} ) ;
25
25
} ;
26
26
27
- const parseEnvelope = ( body : string ) : Record < string , Record < string , unknown > > => {
28
- const [ envelopeHeaderString , itemHeaderString , itemString ] = body . split ( '\n' ) ;
29
-
30
- return {
31
- envelopeHeader : JSON . parse ( envelopeHeaderString ) ,
32
- itemHeader : JSON . parse ( itemHeaderString ) ,
33
- item : JSON . parse ( itemString ) ,
34
- } ;
27
+ const parseEnvelope = ( body : string ) : Array < Record < string , unknown > > => {
28
+ return body . split ( '\n' ) . map ( e => JSON . parse ( e ) ) ;
35
29
} ;
36
30
37
- const getEventRequest = async ( url : string ) : Promise < Record < string , any > > => {
31
+ const getEventRequest = async ( url : string ) : Promise < Record < string , unknown > > => {
38
32
return new Promise ( resolve => {
39
33
nock ( 'https://dsn.ingest.sentry.io' )
40
34
. post ( '/api/1337/store/' , body => {
@@ -47,12 +41,12 @@ const getEventRequest = async (url: string): Promise<Record<string, any>> => {
47
41
} ) ;
48
42
} ;
49
43
50
- const getEnvelopeRequest = async ( url : string ) : Promise < Record < string , unknown > > => {
44
+ const getEnvelopeRequest = async ( url : string ) : Promise < Array < Record < string , unknown > > > => {
51
45
return new Promise ( resolve => {
52
46
nock ( 'https://dsn.ingest.sentry.io' )
53
47
. post ( '/api/1337/envelope/' , body => {
54
- const { item } = parseEnvelope ( body ) ;
55
- resolve ( item ) ;
48
+ const envelope = parseEnvelope ( body ) ;
49
+ resolve ( envelope ) ;
56
50
return true ;
57
51
} )
58
52
. reply ( 200 ) ;
0 commit comments