mirror of
https://github.com/fullstack-cash/bch-api.git
synced 2026-09-21 16:52:04 -07:00
fix(tests): Fixed several unit and integration tests
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user