POST, isArray check, 100% test

This commit is contained in:
TRBC
2020-11-11 23:04:28 -04:00
parent a71192257e
commit bc62510b28
4 changed files with 14 additions and 6 deletions
+4 -2
View File
@@ -143,11 +143,13 @@ describe(`#Ninsight`, () => {
}
})
it(`should GET details for a single address`, async () => {
it(`should POST address details for a single address`, async () => {
const addr = "bitcoincash:qp3sn6vlwz28ntmf3wmyra7jqttfx7z6zgtkygjhc7"
const result = await bchjs.Ninsight.details(addr)
//console.log(`result: ${JSON.stringify(result, null, 2)}`)
assert.isArray(result)
assert.property(result[0], "balance")
assert.property(result[0], "balanceSat")
assert.property(result[0], "totalReceived")
@@ -166,7 +168,7 @@ describe(`#Ninsight`, () => {
assert.property(result[0], "pagesTotal")
})
it(`should GET details for an array of addresses`, async () => {
it(`should POST address details for an array of addresses`, async () => {
const addr = [
"bitcoincash:qp3sn6vlwz28ntmf3wmyra7jqttfx7z6zgtkygjhc7",
"bitcoincash:qz0us0z6ucpqt07jgpad0shgh7xmwxyr3ynlcsq0wr"
+3 -2
View File
@@ -149,11 +149,12 @@ describe(`#Ninsight`, () => {
}
})
it(`should GET details for a single address`, async () => {
it(`should POST address details for a single address`, async () => {
const addr = "bitcoincash:qp3sn6vlwz28ntmf3wmyra7jqttfx7z6zgtkygjhc7"
const result = await bchjs.Ninsight.details(addr)
//console.log(`result: ${JSON.stringify(result, null, 2)}`)
assert.isArray(result)
assert.property(result[0], "balance")
assert.property(result[0], "balanceSat")
assert.property(result[0], "totalReceived")
@@ -172,7 +173,7 @@ describe(`#Ninsight`, () => {
assert.property(result[0], "pagesTotal")
})
it(`should GET details for an array of addresses`, async () => {
it(`should POST address details for an array of addresses`, async () => {
const addr = [
"bitcoincash:qp3sn6vlwz28ntmf3wmyra7jqttfx7z6zgtkygjhc7",
"bitcoincash:qz0us0z6ucpqt07jgpad0shgh7xmwxyr3ynlcsq0wr"
+3 -2
View File
@@ -158,11 +158,12 @@ describe(`#Ninsight`, () => {
}
})
it(`should GET details for a single address`, async () => {
it(`should POST address details for a single address`, async () => {
const addr = "bchtest:qzjtnzcvzxx7s0na88yrg3zl28wwvfp97538sgrrmr"
const result = await bchjs.Ninsight.details(addr)
//console.log(`result: ${JSON.stringify(result, null, 2)}`)
assert.isArray(result)
assert.property(result[0], "balance")
assert.property(result[0], "balanceSat")
assert.property(result[0], "totalReceived")
@@ -181,7 +182,7 @@ describe(`#Ninsight`, () => {
assert.property(result[0], "pagesTotal")
})
it(`should GET details for an array of addresses`, async () => {
it(`should POST address details for an array of addresses`, async () => {
const addr = [
"bchtest:qzjtnzcvzxx7s0na88yrg3zl28wwvfp97538sgrrmr",
"bchtest:qp6hgvevf4gzz6l7pgcte3gaaud9km0l459fa23dul"
+4
View File
@@ -312,6 +312,10 @@ describe(`#Ninsight`, () => {
assert.property(result, "pagesTotal")
})
it(`should call constructor with null args`, async () => {
new bchjs.Ninsight.constructor({})
})
it(`should GET details for an array of addresses`, async () => {
// Mock the network call.
sandbox.stub(axios, "post").resolves({