Skip to content

Commit

Permalink
[pinpoint-apm#98] HTTP methods error case unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
feelform committed Nov 29, 2021
1 parent 0e1bd8e commit 9983eb8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion test/instrumentation/module/express.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,24 @@ test(`${testName1} Should record request in basic route`, function (t) {
}
process.nextTick(() => {
const trace = agent.traceContext.currentTraceObject()
let actualBuilder = new MethodDescriptorBuilder('express', 'app.post')
let actualBuilder = new MethodDescriptorBuilder('express', 'app.get')
.setParameterDescriptor('(path, callback)')
.setLineNumber(481)
.setFileName('application.js')
const actualMethodDescriptor = apiMetaService.cacheApiWithBuilder(actualBuilder)
let spanEvent = trace.storage.storage[2]
t.equal(actualMethodDescriptor.apiId, spanEvent.apiId, 'apiId')
t.equal(spanEvent.annotations[0].key, -1, 'parameter')
t.equal(spanEvent.annotations[0].value.stringValue, '/express3', 'parameter value matching')
t.true(actualMethodDescriptor.apiDescriptor.startsWith('express.Function.app.get(path, callback)'), 'apiDescriptor')
t.equal(actualMethodDescriptor.className, 'Function', 'className')
t.equal(actualMethodDescriptor.fullName, 'express.app.get(path, callback)', 'fullName')
t.equal(actualMethodDescriptor.lineNumber, 481, 'lineNumber')
t.equal(actualMethodDescriptor.methodName, 'get', 'methodName')
t.equal(actualMethodDescriptor.moduleName, 'express', 'moduleName')
t.equal(actualMethodDescriptor.objectPath, 'app.get', 'objectPath')
t.true(actualMethodDescriptor.location.endsWith('application.js'), 'location')

res.status(500).send('Something broke!')
})
})
Expand Down

0 comments on commit 9983eb8

Please sign in to comment.