Browse Source

tests/payments: add null data tests

addLowRGrinding
Daniel Cousens 6 years ago
parent
commit
d886e76abd
  1. 63
      test/fixtures/p2data.json
  2. 2
      test/payments.js

63
test/fixtures/p2data.json

@ -0,0 +1,63 @@
{
"valid": [
{
"description": "output from output",
"arguments": {
"output": "OP_RETURN a3b147dbe4a85579fc4b5a1811e76620560e07267e62b9a0d6858f9127735cadd82f67e06c24dbc4"
},
"expected": {
"data": [
"a3b147dbe4a85579fc4b5a1811e76620560e07267e62b9a0d6858f9127735cadd82f67e06c24dbc4"
],
"output": "OP_RETURN a3b147dbe4a85579fc4b5a1811e76620560e07267e62b9a0d6858f9127735cadd82f67e06c24dbc4",
"input": null,
"witness": null
}
},
{
"description": "output from data",
"arguments": {
"data": [
"a3b147dbe4a85579fc4b5a1811e76620560e07267e62b9a0d6858f9127735cadd82f67e06c24dbc4"
]
},
"expected": {
"data": [
"a3b147dbe4a85579fc4b5a1811e76620560e07267e62b9a0d6858f9127735cadd82f67e06c24dbc4"
],
"output": "OP_RETURN a3b147dbe4a85579fc4b5a1811e76620560e07267e62b9a0d6858f9127735cadd82f67e06c24dbc4",
"input": null,
"witness": null
}
}
],
"invalid": [
{
"exception": "Not enough data",
"arguments": {}
}
],
"dynamic": {
"depends": {
"data": [ "data", "output" ],
"output": [ "output", "data" ]
},
"details": [
{
"description": "p2data",
"data": [
"a3b147dbe4a85579fc4b5a1811e76620560e07267e62b9a0d6858f9127735cadd82f67e06c24dbc4"
],
"output": "OP_RETURN a3b147dbe4a85579fc4b5a1811e76620560e07267e62b9a0d6858f9127735cadd82f67e06c24dbc4"
},
{
"description": "p2data",
"data": [
"a3b147dbe4a85579fc4b5a1811e76620560e0726",
"7e62b9a0d6858f9127735cadd82f67e06c24dbc4"
],
"output": "OP_RETURN a3b147dbe4a85579fc4b5a1811e76620560e0726 7e62b9a0d6858f9127735cadd82f67e06c24dbc4"
}
]
}
}

2
test/payments.js

@ -3,7 +3,7 @@
const assert = require('assert')
const u = require('./payments.utils')
;['p2ms', 'p2pk', 'p2pkh', 'p2sh', 'p2wpkh', 'p2wsh'].forEach(function (p) {
;['p2data', 'p2ms', 'p2pk', 'p2pkh', 'p2sh', 'p2wpkh', 'p2wsh'].forEach(function (p) {
describe(p, function () {
const fn = require('../src/payments/' + p)
const fixtures = require('./fixtures/' + p)

Loading…
Cancel
Save