Editing comments and notes

This commit is contained in:
Chris Troutner
2020-02-04 16:12:38 -08:00
parent 03b9d01f5d
commit 13b41a50c6
7 changed files with 78 additions and 78 deletions
-74
View File
@@ -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", () => {