perf[mock-server]: optimize variable name
This commit is contained in:
parent
035c7d78f1
commit
5dd98ea47f
|
@ -3,16 +3,16 @@ const bodyParser = require('body-parser')
|
|||
const chalk = require('chalk')
|
||||
|
||||
function registerRoutes(app) {
|
||||
let mockStartIndex
|
||||
let mockLastIndex
|
||||
const { default: mocks } = require('./index.js')
|
||||
for (const mock of mocks) {
|
||||
app[mock.type](mock.url, mock.response)
|
||||
mockStartIndex = app._router.stack.length
|
||||
mockLastIndex = app._router.stack.length
|
||||
}
|
||||
const mockRoutesLength = Object.keys(mocks).length
|
||||
return {
|
||||
mockRoutesLength: mockRoutesLength,
|
||||
mockStartIndex: mockStartIndex - mockRoutesLength
|
||||
mockStartIndex: mockLastIndex - mockRoutesLength
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue