fix(tests): Fixed several unit and integration tests

This commit is contained in:
Chris Troutner
2020-03-07 10:43:55 -08:00
parent 940511929f
commit b74a3335b0
5 changed files with 53 additions and 23 deletions
+4
View File
@@ -61,6 +61,10 @@ class RateLimits {
redisClient.disconnect()
}
async wipeRedis () {
await redisClient.flushdb()
}
// CT 2/7/20: Older rate-limiting code that does not scale well.
/*
This function controls the tierd request-per-minute (RPM) rate limits.
@@ -395,6 +395,13 @@ class RawTransactions {
return res.json({ error: 'txid can not be empty' })
}
if (txid.length !== 64) {
res.status(400)
return res.json({
error: `parameter 1 must be of length 64 (not ${txid.length})`
})
}
const data = await _this.getRawTransactionsFromNode(txid, verbose)
return res.json(data)
+4 -3
View File
@@ -27,8 +27,9 @@ util.inspect.defaultOptions = { depth: 5 }
// https://gist.github.com/christroutner/fc717ca704dec3dded8b52fae387eab2
const SLPDB_PASS = process.env.SLPDB_PASS ? process.env.SLPDB_PASS : 'BITBOX'
// const transactions = require("./insight/transaction")
const rawtransactions = require('./full-node/rawtransactions')
// const rawtransactions = require('./full-node/rawtransactions')
const RawTransactions = require('./full-node/rawtransactions')
const rawTransactions = new RawTransactions()
// Setup REST and TREST URLs used by slpjs
// Dev note: this allows for unit tests to mock the URL.
@@ -1381,7 +1382,7 @@ async function txDetails (req, res, next) {
// Get information on the transaction from Insight API.
// const retData = await transactions.transactionsFromInsight(txid)
const retData = await rawtransactions.getRawTransactionsFromNode(txid, true)
const retData = await rawTransactions.getRawTransactionsFromNode(txid, true)
// console.log(`retData: ${JSON.stringify(retData, null, 2)}`)
// Return both the tx data from Insight and the formatted token information.