Skip to content

Commit 7c151bf

Browse files
committed
apparently not all tests end in .spec.js
1 parent dfe8e04 commit 7c151bf

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

packages/dd-trace/test/appsec/graphq.test-utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function graphqlCommonTests (config) {
102102
})
103103

104104
it('Should set appsec.blocked on blocked attack', (done) => {
105-
agent.use(payload => {
105+
agent.assertSomeTraces(payload => {
106106
expect(payload[0][0].meta['appsec.blocked']).to.be.equal('true')
107107
done()
108108
})
@@ -201,7 +201,7 @@ function graphqlCommonTests (config) {
201201
})
202202

203203
it('Should set appsec.blocked on blocked attack', (done) => {
204-
agent.use(payload => {
204+
agent.assertSomeTraces(payload => {
205205
expect(payload[0][0].meta['appsec.blocked']).to.be.equal('true')
206206
done()
207207
})

packages/dd-trace/test/appsec/iast/taint-tracking/sources/graphql.sources.test-utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function graphqlCommonTests (config) {
8282
})
8383

8484
it('Should detect COMMAND_INJECTION vulnerability with hardcoded query', (done) => {
85-
agent.use(payload => {
85+
agent.assertSomeTraces(payload => {
8686
expect(payload[0][0].meta).to.have.property('_dd.iast.json')
8787

8888
const iastJson = JSON.parse(payload[0][0].meta['_dd.iast.json'])
@@ -94,7 +94,7 @@ function graphqlCommonTests (config) {
9494
})
9595

9696
it('Should detect COMMAND_INJECTION vulnerability with query and variables', (done) => {
97-
agent.use(payload => {
97+
agent.assertSomeTraces(payload => {
9898
expect(payload[0][0].meta).to.have.property('_dd.iast.json')
9999

100100
const iastJson = JSON.parse(payload[0][0].meta['_dd.iast.json'])

packages/dd-trace/test/appsec/rasp/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { assert } = require('chai')
44
const { getWebSpan } = require('../utils')
55

66
function checkRaspExecutedAndNotThreat (agent, checkRuleEval = true) {
7-
return agent.use((traces) => {
7+
return agent.assertSomeTraces((traces) => {
88
const span = getWebSpan(traces)
99
assert.notProperty(span.meta, '_dd.appsec.json')
1010
assert.notProperty(span.meta_struct || {}, '_dd.stack')
@@ -15,7 +15,7 @@ function checkRaspExecutedAndNotThreat (agent, checkRuleEval = true) {
1515
}
1616

1717
function checkRaspExecutedAndHasThreat (agent, ruleId, ruleEvalCount = 1) {
18-
return agent.use((traces) => {
18+
return agent.assertSomeTraces((traces) => {
1919
const span = getWebSpan(traces)
2020
assert.property(span.meta, '_dd.appsec.json')
2121
assert(span.meta['_dd.appsec.json'].includes(ruleId))

packages/dd-trace/test/plugins/agent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ module.exports = {
279279
async load (pluginName, config, tracerConfig = {}) {
280280
tracer = require('../..')
281281
agent = express()
282-
agent.use(bodyParser.raw({ limit: Infinity, type: 'application/msgpack' }))
283-
agent.use((req, res, next) => {
282+
agent.assertSomeTraces(bodyParser.raw({ limit: Infinity, type: 'application/msgpack' }))
283+
agent.assertSomeTraces((req, res, next) => {
284284
if (req.is('application/msgpack')) {
285285
if (!req.body.length) return res.status(200).send()
286286
req.body = msgpack.decode(req.body, { useBigInt64: true })

packages/dd-trace/test/plugins/helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function resolveNaming (namingSchema) {
1515
}
1616

1717
function expectSomeSpan (agent, expected, timeout) {
18-
return agent.use(traces => {
18+
return agent.assertSomeTraces(traces => {
1919
const scoredErrors = []
2020
for (const trace of traces) {
2121
for (const span of trace) {

0 commit comments

Comments
 (0)