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')
|
const chalk = require('chalk')
|
||||||
|
|
||||||
function registerRoutes(app) {
|
function registerRoutes(app) {
|
||||||
let mockStartIndex
|
let mockLastIndex
|
||||||
const { default: mocks } = require('./index.js')
|
const { default: mocks } = require('./index.js')
|
||||||
for (const mock of mocks) {
|
for (const mock of mocks) {
|
||||||
app[mock.type](mock.url, mock.response)
|
app[mock.type](mock.url, mock.response)
|
||||||
mockStartIndex = app._router.stack.length
|
mockLastIndex = app._router.stack.length
|
||||||
}
|
}
|
||||||
const mockRoutesLength = Object.keys(mocks).length
|
const mockRoutesLength = Object.keys(mocks).length
|
||||||
return {
|
return {
|
||||||
mockRoutesLength: mockRoutesLength,
|
mockRoutesLength: mockRoutesLength,
|
||||||
mockStartIndex: mockStartIndex - mockRoutesLength
|
mockStartIndex: mockLastIndex - mockRoutesLength
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue