Browse Source

Merge pull request #178 from bitcoinjs/integration-tests

Integration tests
hk-custom-address
Daniel Cousens 11 years ago
parent
commit
1e0521f7e5
  1. 4
      .travis.yml
  2. 3
      package.json
  3. 5
      test/integration/p2sh.js

4
.travis.yml

@ -4,3 +4,7 @@ before_install:
node_js:
- "0.11"
- "0.10"
env:
- TEST_SUITE=unit
- TEST_SUITE=integration
script: "npm run-script $TEST_SUITE"

3
package.json

@ -39,7 +39,8 @@
"files": "test/*.js"
},
"scripts": {
"test": "./node_modules/.bin/istanbul test ./node_modules/.bin/_mocha -- --reporter list `find test -maxdepth 1 -not -type d`",
"unit": "./node_modules/.bin/istanbul test ./node_modules/.bin/_mocha -- --reporter list `find test -maxdepth 1 -not -type d`",
"test": "npm run-script unit",
"integration": "./node_modules/.bin/_mocha --reporter list test/integration/*.js",
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --reporter list test/*.js",
"compile": "./node_modules/.bin/browserify ./src/index.js -s Bitcoin | ./node_modules/.bin/uglifyjs > bitcoinjs-min.js"

5
test/integration/p2sh.js

@ -30,7 +30,7 @@ describe('p2sh', function() {
var pubKeyBuffers = pubKeys.map(function(q) {
return q.toBuffer()
})
var redeemScript = Script.createMultisigOutputScript(2, pubKeyBuffers)
var redeemScript = Script.createMultisigScriptPubKey(2, pubKeyBuffers)
var hash160 = crypto.hash160(redeemScript.buffer)
var multisigAddress = new Address(hash160, networks.testnet.scriptHash)
@ -57,7 +57,8 @@ describe('p2sh', function() {
return tx.signScriptSig(0, redeemScript, privKey)
})
var scriptSig = Script.createP2SHMultisigScriptSig(signatures, redeemScript)
var redeemScriptSig = Script.createMultisigScriptSig(signatures)
var scriptSig = Script.createP2SHScriptSig(redeemScriptSig, redeemScript)
tx.setScriptSig(0, scriptSig)
// Send from mutlsigAddress to targetAddress

Loading…
Cancel
Save