Added first unit tests for blockbook

This commit is contained in:
Chris Troutner
2019-06-09 14:31:36 -07:00
parent a2447bd07c
commit fca3e25b73
4 changed files with 63 additions and 10 deletions
+1 -3
View File
@@ -193,9 +193,7 @@ io.on("connection", socket => {
if (process.env.ZEROMQ_URL && process.env.ZEROMQ_PORT) {
console.log(
`Connecting to BCH ZMQ at ${process.env.ZEROMQ_URL}:${
process.env.ZEROMQ_PORT
}`
`Connecting to BCH ZMQ at ${process.env.ZEROMQ_URL}:${process.env.ZEROMQ_PORT}`
)
const bitcoincashZmqDecoder = new BitcoinCashZMQDecoder(process.env.NETWORK)
+3 -1
View File
@@ -37,7 +37,7 @@ async function balanceFromBlockbook(thisAddress) {
//console.log(`BITCORE_URL: ${BITCORE_URL}`)
// Convert the address to a cashaddr without a prefix.
const addr = BITBOX.Address.toCashAddress(thisAddress, false)
const addr = BITBOX.Address.toCashAddress(thisAddress)
// Determine if we are working with the testnet or mainnet networks.
let network = "mainnet"
@@ -107,6 +107,8 @@ async function balanceSingle(req, res, next) {
res.status(200)
return res.json(retData)
} catch (err) {
console.log(`err: ${JSON.stringify(err, null, 2)}`)
// Attempt to decode the error message.
const { msg, status } = routeUtils.decodeError(err)
if (msg) {