Browse Source

added testcases for new logic

hk-custom-address
xnova 11 years ago
parent
commit
2ca02c47ce
  1. 17
      test/wallet.js

17
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'])
})
})
})

Loading…
Cancel
Save