scripts: break tests down from type structure
This commit is contained in:
parent
d93623e2b1
commit
62b6a407a6
2 changed files with 59 additions and 54 deletions
test
|
@ -36,7 +36,9 @@ describe('Scripts', function() {
|
|||
})
|
||||
|
||||
describe('pubKey', function() {
|
||||
fixtures2.valid.pubKey.forEach(function(f) {
|
||||
fixtures2.valid.forEach(function(f) {
|
||||
if (f.type !== 'pubkey') return
|
||||
|
||||
describe('input script', function() {
|
||||
it('is generated correctly for ' + f.pubKey, function() {
|
||||
var signature = new Buffer(f.signature, 'hex')
|
||||
|
@ -58,7 +60,9 @@ describe('Scripts', function() {
|
|||
})
|
||||
|
||||
describe('pubKeyHash', function() {
|
||||
fixtures2.valid.pubKeyHash.forEach(function(f) {
|
||||
fixtures2.valid.forEach(function(f) {
|
||||
if (f.type !== 'pubkeyhash') return
|
||||
|
||||
var pubKey = ECPubKey.fromHex(f.pubKey)
|
||||
var address = pubKey.getAddress()
|
||||
|
||||
|
@ -81,7 +85,9 @@ describe('Scripts', function() {
|
|||
})
|
||||
|
||||
describe('multisig', function() {
|
||||
fixtures2.valid.multisig.forEach(function(f) {
|
||||
fixtures2.valid.forEach(function(f) {
|
||||
if (f.type !== 'multisig') return
|
||||
|
||||
var pubKeys = f.pubKeys.map(ECPubKey.fromHex)
|
||||
var scriptPubKey = scripts.multisigOutput(pubKeys.length, pubKeys)
|
||||
|
||||
|
@ -135,7 +141,9 @@ describe('Scripts', function() {
|
|||
})
|
||||
|
||||
describe('scripthash', function() {
|
||||
fixtures2.valid.scripthash.forEach(function(f) {
|
||||
fixtures2.valid.forEach(function(f) {
|
||||
if (f.type !== 'scripthash') return
|
||||
|
||||
var redeemScript = Script.fromHex(f.redeemScript)
|
||||
var redeemScriptSig = Script.fromHex(f.redeemScriptSig)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue