added testcases for new logic

This commit is contained in:
xnova 2014-02-27 12:25:28 -05:00
parent 0310a890ba
commit 2ca02c47ce

View file

@ -1,4 +1,5 @@
var Wallet = require('../src/wallet.js') var Wallet = require('../src/wallet.js')
var Address = require('../src/address.js')
var assert = require('assert') var assert = require('assert')
describe('Wallet', function() { describe('Wallet', function() {
@ -33,4 +34,20 @@ describe('Wallet', function() {
assert.equal(wallet.derivationMethod, 'public') 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'])
})
})
}) })