fix(tests): Getting all tests passing

This commit is contained in:
Chris Troutner
2020-12-05 20:42:07 -08:00
parent 3b0ec95fba
commit f5de593f89
6 changed files with 75 additions and 50 deletions
+66 -9
View File
@@ -681,7 +681,7 @@ describe(`#SLP`, () => {
"f7e5199ef6669ad4d078093b3ad56e355b6ab84567e59ad0f08a5ad0244f783a"
const result = await bchjs.SLP.Utils.validateTxid3(txid)
console.log(`result: ${JSON.stringify(result, null, 2)}`)
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
assert.isArray(result)
@@ -689,7 +689,7 @@ describe(`#SLP`, () => {
assert.equal(result[0].txid, txid)
assert.property(result[0], "valid")
assert.equal(result[0].valid, false)
assert.equal(result[0].valid, null)
})
it("should validate a known valid TXID", async () => {
@@ -718,13 +718,43 @@ describe(`#SLP`, () => {
"daf4d8b8045e7a90b7af81bfe2370178f687da0e545511bce1c9ae539eba5ffd",
// Valid SLP token not in whitelist
"3a4b628cbcc183ab376d44ce5252325f042268307ffa4a53443e92b6d24fb488",
// Unprocessed SLP TX
// "a0d6406eecfd8634158efa9314ff15b4cbf451938e9dc7b5678c46b41eabc6ed" // Mint baton
"402c663379d9699b6e2dd38737061e5888c5a49fca77c97ab98e79e08959e019"
// Token send on BCHN network.
"402c663379d9699b6e2dd38737061e5888c5a49fca77c97ab98e79e08959e019",
// Token send on ABC network.
"336bfe2168aac4c3303508a9e8548a0d33797a83b85b76a12d845c8d6674f79d",
// Known invalid SLP token send of PSF tokens.
"2bf691ad3679d928fef880b8a45b93b233f8fa0d0a92cf792313dbe77b1deb74"
]
const result = await bchjs.SLP.Utils.validateTxid3(txids)
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
assert.equal(result[0].txid, txids[0])
assert.equal(result[0].valid, null)
assert.equal(result[1].txid, txids[1])
assert.equal(result[1].valid, null)
assert.equal(result[2].txid, txids[2])
assert.equal(result[2].valid, true)
// True in validateTxid() but null in validateTxid3()
assert.equal(result[3].txid, txids[3])
assert.equal(result[3].valid, null)
// Note: This should change from null to true once SLPDB finishes indexing.
assert.equal(result[4].txid, txids[4])
assert.equal(result[4].valid, null)
assert.equal(result[5].txid, txids[5])
assert.equal(result[5].valid, null)
assert.equal(result[6].txid, txids[6])
assert.equal(result[6].valid, false)
assert.include(
result[6].invalidReason,
"Token outputs are greater than valid token inputs"
)
})
})
@@ -739,16 +769,43 @@ describe(`#SLP`, () => {
"daf4d8b8045e7a90b7af81bfe2370178f687da0e545511bce1c9ae539eba5ffd",
// Valid SLP token not in whitelist
"3a4b628cbcc183ab376d44ce5252325f042268307ffa4a53443e92b6d24fb488",
// Unprocessed SLP TX
// "a0d6406eecfd8634158efa9314ff15b4cbf451938e9dc7b5678c46b41eabc6ed"
// Token send on BCHN network.
"402c663379d9699b6e2dd38737061e5888c5a49fca77c97ab98e79e08959e019",
// Token send on ABC network.
"336bfe2168aac4c3303508a9e8548a0d33797a83b85b76a12d845c8d6674f79d"
"336bfe2168aac4c3303508a9e8548a0d33797a83b85b76a12d845c8d6674f79d",
// Known invalid SLP token send of PSF tokens.
"2bf691ad3679d928fef880b8a45b93b233f8fa0d0a92cf792313dbe77b1deb74"
]
const result = await bchjs.SLP.Utils.validateTxid(txids)
console.log(`result: ${JSON.stringify(result, null, 2)}`)
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
assert.equal(result[0].txid, txids[0])
assert.equal(result[0].valid, null)
assert.equal(result[1].txid, txids[1])
assert.equal(result[1].valid, null)
assert.equal(result[2].txid, txids[2])
assert.equal(result[2].valid, true)
// True in validateTxid() but null in validateTxid3()
assert.equal(result[3].txid, txids[3])
assert.equal(result[3].valid, true)
// Note: This should change from null to true once SLPDB finishes indexing.
assert.equal(result[4].txid, txids[4])
assert.equal(result[4].valid, null)
assert.equal(result[5].txid, txids[5])
assert.equal(result[5].valid, null)
assert.equal(result[6].txid, txids[6])
assert.equal(result[6].valid, false)
assert.include(
result[6].invalidReason,
"Token outputs are greater than valid token inputs"
)
})
})
})
+2 -2
View File
@@ -652,7 +652,7 @@ describe(`#SLP`, () => {
"f7e5199ef6669ad4d078093b3ad56e355b6ab84567e59ad0f08a5ad0244f783a"
const result = await bchjs.SLP.Utils.validateTxid3(txid)
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
console.log(`result: ${JSON.stringify(result, null, 2)}`)
assert.isArray(result)
@@ -660,7 +660,7 @@ describe(`#SLP`, () => {
assert.equal(result[0].txid, txid)
assert.property(result[0], "valid")
assert.equal(result[0].valid, false)
assert.equal(result[0].valid, null)
})
it("should validate a known valid TXID", async () => {
+1 -1
View File
@@ -1140,7 +1140,7 @@ const mockValidateTxid3Valid = [
const mockValidateTxid3Invalid = [
{
txid: "f7e5199ef6669ad4d078093b3ad56e355b6ab84567e59ad0f08a5ad0244f783a",
valid: false
valid: null
}
]
+2 -2
View File
@@ -1964,7 +1964,7 @@ describe("#SLP Utils", () => {
assert2.equal(result[0].txid, txid)
assert2.property(result[0], "valid")
assert2.equal(result[0].valid, false)
assert2.equal(result[0].valid, null)
})
it("should handle a mix of valid, invalid, and non-SLP txs", async () => {
@@ -2031,7 +2031,7 @@ describe("#SLP Utils", () => {
assert2.equal(result[0].txid, txid)
assert2.property(result[0], "valid")
assert2.equal(result[0].valid, false)
assert2.equal(result[0].valid, null)
})
it("should handle an array with a single element", async () => {