Script: rename toScriptHash to getHash and add tests

This commit is contained in:
Daniel Cousens 2014-05-09 12:56:51 +10:00
parent cace8316e4
commit f8e662e495
3 changed files with 13 additions and 17 deletions

View file

@ -26,9 +26,19 @@ describe('Script', function() {
})
describe('fromHex/toHex', function() {
fixtures.valid.forEach(function(f) {
it('decodes/encodes ' + f.description, function() {
assert.equal(Script.fromHex(f.hex).toHex(), f.hex)
})
})
})
describe('getHash', function() {
it('matches the test vectors', function() {
fixtures.valid.forEach(function(f) {
assert.equal(Script.fromHex(f.hex).toHex(), f.hex)
var script = Script.fromHex(f.hex)
assert.equal(script.getHash().toString('hex'), f.hash)
})
})
})