From 2ca02c47ce95c48aeacecf1532a29c1898b71a7d Mon Sep 17 00:00:00 2001 From: xnova Date: Thu, 27 Feb 2014 12:25:28 -0500 Subject: [PATCH] added testcases for new logic --- test/wallet.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/wallet.js b/test/wallet.js index 0f39d02..44f6164 100644 --- a/test/wallet.js +++ b/test/wallet.js @@ -1,4 +1,5 @@ var Wallet = require('../src/wallet.js') +var Address = require('../src/address.js') var assert = require('assert') describe('Wallet', function() { @@ -33,4 +34,20 @@ describe('Wallet', function() { assert.equal(wallet.derivationMethod, 'public') }) }) + + describe('networkType', function() { + it('ensures that a mainnet Wallet has mainnet child keys (pub and priv)', function() { + var w = Wallet("foobar", {network: "Bitcoin"}) + assert(w.getMasterKey().priv.version == Address.address_types['prod']) + w.generateAddress() + assert(w.getPrivateKey(0).priv.version == Address.address_types['prod']) + }) + + it('ensures that a testnet Wallet has testnet child keys (pub and priv)', function() { + var w = Wallet("foobar", {network: "BitcoinTest"}) + assert(w.getMasterKey().priv.version == Address.address_types['testnet']) + w.generateAddress() + assert(w.getPrivateKey(0).priv.version == Address.address_types['testnet']) + }) + }) })