bitcoinjs-lib/test/wallet.js
Wei Lu 2e97828379 throws exception if specified network is unknown
also move network type tests to hdwallet
2014-02-28 17:59:01 +08:00

38 lines
962 B
JavaScript

var Wallet = require('../src/wallet.js')
var assert = require('assert')
describe('Wallet', function() {
var seed = 'crazy horse battery staple'
describe('default constructor', function() {
var wallet;
beforeEach(function() {
wallet = new Wallet(seed)
})
it('defaults to Bitcoin mainnet', function() {
assert.equal(wallet.getMasterKey().network, 'mainnet')
})
it('defaults to private derivationMethod', function() {
assert.equal(wallet.derivationMethod, 'private')
})
})
describe('constructor options', function() {
var wallet;
beforeEach(function() {
wallet = new Wallet(seed, {network: 'testnet', derivationMethod: 'public'})
})
it('uses the network if specified', function() {
assert.equal(wallet.getMasterKey().network, 'testnet')
})
it('uses the derivationMethod if specified', function() {
assert.equal(wallet.derivationMethod, 'public')
})
})
})