tests: add test for non-matching network

This commit is contained in:
Daniel Cousens 2014-11-29 12:12:24 +11:00
parent 8bdfa881c9
commit 1ac79b8327
2 changed files with 8 additions and 1 deletions

View file

@ -201,6 +201,11 @@
{ {
"exception": "Could not find version 0", "exception": "Could not find version 0",
"string": "1111111111111adADjFaSNPxwXqLjHLj4mBfYxuewDPbw9hEj1uaXCzMxRPXDFF3cUoezTFYom4sEmEVSQmENPPR315cFk9YUFVek73wE9" "string": "1111111111111adADjFaSNPxwXqLjHLj4mBfYxuewDPbw9hEj1uaXCzMxRPXDFF3cUoezTFYom4sEmEVSQmENPPR315cFk9YUFVek73wE9"
},
{
"exception": "Network doesn\\'t match",
"string": "Ltpv73XYpw28ZyVe2zEVyiFnxUZxoKLGQNdZ8NxUi1WcqjNmMBgtLbh3KimGSnPHCoLv1RmvxHs4dnKmo1oXQ8dXuDu8uroxrbVxZPA1gXboYvx",
"network": "bitcoin"
} }
], ],
"fromBuffer": [ "fromBuffer": [

View file

@ -135,7 +135,9 @@ describe('HDNode', function() {
fixtures.invalid.fromBase58.forEach(function(f) { fixtures.invalid.fromBase58.forEach(function(f) {
it('throws on ' + f.string, function() { it('throws on ' + f.string, function() {
assert.throws(function() { assert.throws(function() {
HDNode.fromBase58(f.string) var network = networks[f.network]
HDNode.fromBase58(f.string, network)
}, new RegExp(f.exception)) }, new RegExp(f.exception))
}) })
}) })