mirror of
https://github.com/fullstack-cash/bch-api.git
synced 2026-09-22 17:22:04 -07:00
Editing comments and notes
This commit is contained in:
@@ -71,80 +71,6 @@ describe("#route-ratelimits & jwt-auth", () => {
|
||||
assert.equal(req.locals.jwtToken, jwt)
|
||||
})
|
||||
})
|
||||
|
||||
// TODO: This code has been refactored and these unit tests no longer apply.
|
||||
// I think I forgot to create new unit tests to reflect the change in code though.
|
||||
/*
|
||||
describe("#routeAccess", () => {
|
||||
it("should do nothing if req.locals.jwtToken is undefined", () => {
|
||||
// Initialize req.locals
|
||||
req.locals = {
|
||||
proLimit: false,
|
||||
apiLevel: 0
|
||||
}
|
||||
req.url = "/insight/address/details"
|
||||
|
||||
// Reset the history of the stub and assert it has not been called.
|
||||
res.status.resetHistory()
|
||||
assert.equal(res.status.called, false, "stub history reset")
|
||||
|
||||
jwtAuth.routeAccess(req, res, next)
|
||||
|
||||
// console.log(`req.locals: ${JSON.stringify(req.locals, null, 2)}`)
|
||||
assert.equal(
|
||||
res.status.called,
|
||||
false,
|
||||
"stub should NOT have been called."
|
||||
)
|
||||
})
|
||||
|
||||
it("should throw error if full-node tier tries to access indexer", () => {
|
||||
// Initialize req.locals
|
||||
req.locals = {
|
||||
proLimit: true,
|
||||
apiLevel: 10,
|
||||
jwtToken: jwt
|
||||
}
|
||||
req.url = "/insight/address/details"
|
||||
|
||||
try {
|
||||
res.status.resetHistory()
|
||||
assert.equal(res.status.called, false, "stub history reset")
|
||||
|
||||
jwtAuth.routeAccess(req, res, next)
|
||||
|
||||
assert.equal(res.status.called, true, "stub should have been called.")
|
||||
} catch (err) {
|
||||
console.log(`caught error: `, err)
|
||||
}
|
||||
})
|
||||
|
||||
it("should allow indexer tier tries access indexer endpoints", () => {
|
||||
// Initialize req.locals
|
||||
req.locals = {
|
||||
proLimit: true,
|
||||
apiLevel: 20,
|
||||
jwtToken: jwt
|
||||
}
|
||||
req.url = "/insight/address/details"
|
||||
|
||||
try {
|
||||
res.status.resetHistory()
|
||||
assert.equal(res.status.called, false, "stub history reset")
|
||||
|
||||
jwtAuth.routeAccess(req, res, next)
|
||||
|
||||
assert.equal(
|
||||
res.status.called,
|
||||
false,
|
||||
"stub should NOT have been called."
|
||||
)
|
||||
} catch (err) {
|
||||
console.log(`caught error: `, err)
|
||||
}
|
||||
})
|
||||
})
|
||||
*/
|
||||
})
|
||||
|
||||
describe("#routeRateLimit", () => {
|
||||
|
||||
Reference in New Issue
Block a user