File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
packages/dd-trace/test/appsec/iast/analyzers Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -203,24 +203,24 @@ describe('sql-injection-analyzer', () => {
203
203
204
204
it ( 'should call analyze on apm:mysql:query:start' , ( ) => {
205
205
const onMysqlQueryStart = sqlInjectionAnalyzer . _subscriptions [ 0 ] . _handler
206
-
207
- onMysqlQueryStart ( { sql : 'SELECT 1' , name : 'apm:mysql:query:start' } )
206
+ const payload = { sql : 'SELECT 1' }
207
+ onMysqlQueryStart ( { payload , name : 'apm:mysql:query:start' } )
208
208
209
209
expect ( analyze ) . to . be . calledOnceWith ( 'SELECT 1' )
210
210
} )
211
211
212
212
it ( 'should call analyze on apm:mysql2:query:start' , ( ) => {
213
- const onMysql2QueryStart = sqlInjectionAnalyzer . _subscriptions [ 0 ] . _handler
213
+ const onMysql2QueryStart = sqlInjectionAnalyzer . _subscriptions [ 1 ] . _handler
214
214
215
215
onMysql2QueryStart ( { sql : 'SELECT 1' , name : 'apm:mysql2:query:start' } )
216
216
217
217
expect ( analyze ) . to . be . calledOnceWith ( 'SELECT 1' )
218
218
} )
219
219
220
220
it ( 'should call analyze on apm:pg:query:start' , ( ) => {
221
- const onPgQueryStart = sqlInjectionAnalyzer . _subscriptions [ 0 ] . _handler
221
+ const onPgQueryStart = sqlInjectionAnalyzer . _subscriptions [ 2 ] . _handler
222
222
223
- onPgQueryStart ( { sql : 'SELECT 1' , name : 'apm:pg:query:start' } )
223
+ onPgQueryStart ( { query : { text : 'SELECT 1' } , name : 'apm:pg:query:start' } )
224
224
225
225
expect ( analyze ) . to . be . calledOnceWith ( 'SELECT 1' )
226
226
} )
You can’t perform that action at this time.
0 commit comments