tests: add tests for Transaction.hashForSignature

This commit is contained in:
Daniel Cousens 2016-06-22 14:45:36 +10:00
commit 4898cc7b67
2 changed files with 49 additions and 2 deletions

View file

@ -172,6 +172,14 @@ describe('Transaction', function () {
})
})
// TODO:
// hashForSignature: [Function],
describe('hashForSignature', function () {
fixtures.hashForSignature.forEach(function (f) {
it('should return ' + f.hash + ' for ' + (f.description ? ('case "' + f.description + '"') : f.script), function () {
var tx = Transaction.fromHex(f.txHex)
var script = bscript.fromASM(f.script)
assert.strictEqual(tx.hashForSignature(f.inIndex, script, f.type).toString('hex'), f.hash)
})
})
})
})