HDWallet: adds Public -> public tests

This commit is contained in:
Daniel Cousens 2014-06-03 16:13:20 +10:00
parent 99bb69bf20
commit 29fbbaa58d

View file

@ -237,5 +237,26 @@ describe('HDWallet', function() {
})
})
})
it('works for public -> public', function() {
var f = fixtures.valid[1]
var c = f.children[0]
var parent = HDWallet.fromBase58(f.master.base58)
var child = parent.derive(c.m)
assert.equal(child.toBase58(), c.base58)
})
it('throws on public -> public (hardened)', function() {
var f = fixtures.valid[1]
var c = f.children[0]
var parent = HDWallet.fromBase58(f.master.base58)
assert.throws(function() {
parent.derivePrivate(c.m)
}, /Could not derive hardened child key/)
})
})
})