@@ -46,9 +46,7 @@ describe('IAST - overhead-controller - integration', () => {
4646 } )
4747
4848 async function checkVulnerabilitiesInEndpoint ( path , vulnerabilitiesAndCount , method = 'GET' ) {
49- await axios . request ( path , { method } )
50-
51- await agent . assertMessageReceived ( ( { payload } ) => {
49+ const assertPromise = agent . assertMessageReceived ( ( { payload } ) => {
5250 assert . strictEqual ( payload [ 0 ] [ 0 ] . type , 'web' )
5351 assert . strictEqual ( payload [ 0 ] [ 0 ] . metrics [ '_dd.iast.enabled' ] , 1 )
5452 assert . ok ( Object . hasOwn ( payload [ 0 ] [ 0 ] . meta , '_dd.iast.json' ) )
@@ -67,16 +65,24 @@ describe('IAST - overhead-controller - integration', () => {
6765 assert . strictEqual ( vulnerabilities [ vType ] , vulnerabilitiesAndCount [ vType ] , `route: ${ path } - type: ${ vType } ` )
6866 } )
6967 } , 1000 , 1 , true )
68+
69+ await Promise . all ( [
70+ axios . request ( path , { method } ) ,
71+ assertPromise ,
72+ ] )
7073 }
7174
7275 async function checkNoVulnerabilitiesInEndpoint ( path , method = 'GET' ) {
73- await axios . request ( path , { method } )
74-
75- await agent . assertMessageReceived ( ( { payload } ) => {
76+ const assertPromise = agent . assertMessageReceived ( ( { payload } ) => {
7677 assert . strictEqual ( payload [ 0 ] [ 0 ] . type , 'web' )
7778 assert . strictEqual ( payload [ 0 ] [ 0 ] . metrics [ '_dd.iast.enabled' ] , 1 )
7879 assert . ok ( ! ( '_dd.iast.json' in payload [ 0 ] [ 0 ] . meta ) )
7980 } , 1000 , 1 , true )
81+
82+ await Promise . all ( [
83+ axios . request ( path , { method } ) ,
84+ assertPromise ,
85+ ] )
8086 }
8187
8288 it ( 'should report vulnerability only in the first request' , async ( ) => {
0 commit comments