added testcases for new logic
This commit is contained in:
parent
0310a890ba
commit
2ca02c47ce
1 changed files with 17 additions and 0 deletions
|
@ -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'])
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue