From 29fbbaa58db3d561dda2cb1a0431c3073e3d1f1d Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Tue, 3 Jun 2014 16:13:20 +1000 Subject: [PATCH] HDWallet: adds Public -> public tests --- test/hdwallet.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/hdwallet.js b/test/hdwallet.js index e2332b0..aa78c5d 100644 --- a/test/hdwallet.js +++ b/test/hdwallet.js @@ -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/) + }) }) })