fix Wallet default constructor

This commit is contained in:
Wei Lu 2014-03-15 10:18:59 +08:00
parent b2f010428f
commit a7a7999e3f
2 changed files with 8 additions and 1 deletions

View file

@ -34,7 +34,7 @@ var Wallet = function (seed, options) {
this.newMasterKey = function(seed, network) { this.newMasterKey = function(seed, network) {
if (!seed) { if (!seed) {
var seed= new Array(32); var seed= new Array(32);
rng.nextBytes(seedBytes); rng.nextBytes(seed);
} }
masterkey = new HDNode(seed, network); masterkey = new HDNode(seed, network);
} }

View file

@ -39,6 +39,13 @@ describe('Wallet', function() {
assert.equal(account.depth, 2) assert.equal(account.depth, 2)
}) })
describe('when seed is not specified', function(){
it('generates a seed', function(){
var wallet = new Wallet()
assert.ok(wallet.getMasterKey())
})
})
describe('constructor options', function() { describe('constructor options', function() {
var wallet; var wallet;
beforeEach(function() { beforeEach(function() {