fix more tests en wallet f
This commit is contained in:
parent
f48898033f
commit
9f30c9ade5
2 changed files with 14 additions and 10 deletions
|
|
@ -151,7 +151,7 @@ WalletFactory.prototype.import = function(base64, password, skipFields) {
|
||||||
* @return {Wallet}
|
* @return {Wallet}
|
||||||
*/
|
*/
|
||||||
WalletFactory.prototype.read = function(walletId, skipFields, cb) {
|
WalletFactory.prototype.read = function(walletId, skipFields, cb) {
|
||||||
var self = this;
|
var self = this, err;
|
||||||
var obj = {};
|
var obj = {};
|
||||||
obj.id = walletId;
|
obj.id = walletId;
|
||||||
|
|
||||||
|
|
@ -159,7 +159,7 @@ WalletFactory.prototype.read = function(walletId, skipFields, cb) {
|
||||||
for (var ii in ret) {
|
for (var ii in ret) {
|
||||||
obj[ii] = ret[ii];
|
obj[ii] = ret[ii];
|
||||||
}
|
}
|
||||||
return cb(self.fromObj(obj, skipFields));
|
return cb(err, self.fromObj(obj, skipFields));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -271,11 +271,12 @@ WalletFactory.prototype._checkVersion = function(inVersion) {
|
||||||
*/
|
*/
|
||||||
WalletFactory.prototype.open = function(walletId, passphrase, cb) {
|
WalletFactory.prototype.open = function(walletId, passphrase, cb) {
|
||||||
preconditions.checkArgument(cb);
|
preconditions.checkArgument(cb);
|
||||||
var self = this,
|
var self = this;
|
||||||
err;
|
|
||||||
self.storage._setPassphrase(passphrase);
|
self.storage._setPassphrase(passphrase);
|
||||||
self.read(walletId, null, function(w) {
|
self.read(err, walletId, null, function(w) {
|
||||||
w.store(function() {
|
if (err) return cb(err);
|
||||||
|
|
||||||
|
w.store(function(err) {
|
||||||
self.storage.setLastOpened(walletId, function() {
|
self.storage.setLastOpened(walletId, function() {
|
||||||
return cb(err, w);
|
return cb(err, w);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ describe('WalletFactory model', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it.only('should be able to get wallets', function(done) {
|
it('should be able to get wallets', function(done) {
|
||||||
var wf = new WalletFactory(config, '0.0.1');
|
var wf = new WalletFactory(config, '0.0.1');
|
||||||
wf.create(null, function(err,w){
|
wf.create(null, function(err,w){
|
||||||
wf.read(w.id, [], function(err, w2){
|
wf.read(w.id, [], function(err, w2){
|
||||||
|
|
@ -273,7 +273,7 @@ describe('WalletFactory model', function() {
|
||||||
}).should.throw();
|
}).should.throw();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('BIP32 length problem', function() {
|
it('BIP32 length problem', function(done) {
|
||||||
var sconfig = {
|
var sconfig = {
|
||||||
Network: FakeNetwork,
|
Network: FakeNetwork,
|
||||||
Blockchain: FakeBlockchain,
|
Blockchain: FakeBlockchain,
|
||||||
|
|
@ -312,8 +312,11 @@ describe('WalletFactory model', function() {
|
||||||
'requiredCopayers': 2,
|
'requiredCopayers': 2,
|
||||||
'totalCopayers': 3
|
'totalCopayers': 3
|
||||||
};
|
};
|
||||||
var w = wf.create(opts);
|
wf.create(opts, function(err,w){
|
||||||
|
should.not.exist(err);
|
||||||
|
should.exist(w);
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to get current wallets', function() {
|
it('should be able to get current wallets', function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue