From 1ac79b8327f7c809a904e921c6ffdaf0d5ed9f5d Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Sat, 29 Nov 2014 12:12:24 +1100 Subject: [PATCH] tests: add test for non-matching network --- test/fixtures/hdnode.json | 5 +++++ test/hdnode.js | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/test/fixtures/hdnode.json b/test/fixtures/hdnode.json index d87e1bf..77342d0 100644 --- a/test/fixtures/hdnode.json +++ b/test/fixtures/hdnode.json @@ -201,6 +201,11 @@ { "exception": "Could not find version 0", "string": "1111111111111adADjFaSNPxwXqLjHLj4mBfYxuewDPbw9hEj1uaXCzMxRPXDFF3cUoezTFYom4sEmEVSQmENPPR315cFk9YUFVek73wE9" + }, + { + "exception": "Network doesn\\'t match", + "string": "Ltpv73XYpw28ZyVe2zEVyiFnxUZxoKLGQNdZ8NxUi1WcqjNmMBgtLbh3KimGSnPHCoLv1RmvxHs4dnKmo1oXQ8dXuDu8uroxrbVxZPA1gXboYvx", + "network": "bitcoin" } ], "fromBuffer": [ diff --git a/test/hdnode.js b/test/hdnode.js index 7a75e47..a1cb97a 100644 --- a/test/hdnode.js +++ b/test/hdnode.js @@ -135,7 +135,9 @@ describe('HDNode', function() { fixtures.invalid.fromBase58.forEach(function(f) { it('throws on ' + f.string, function() { assert.throws(function() { - HDNode.fromBase58(f.string) + var network = networks[f.network] + + HDNode.fromBase58(f.string, network) }, new RegExp(f.exception)) }) })