Mocha tests fixed
This commit is contained in:
parent
15d11f7e5e
commit
cf0b1b4df1
3 changed files with 27 additions and 25 deletions
|
|
@ -155,15 +155,19 @@ Identity.create = function(email, password, opts, cb) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return cb(err);
|
return cb(err);
|
||||||
}
|
}
|
||||||
iden.pluginManager.get('remote-backup').store(
|
if (iden.pluginManager.get && iden.pluginManager.get('remote-backup')) {
|
||||||
iden,
|
iden.pluginManager.get('remote-backup').store(
|
||||||
iden.insightSaveOpts,
|
iden,
|
||||||
function(error) {
|
iden.insightSaveOpts,
|
||||||
// FIXME: Ignoring this error may not be the best thing to do. But remote storage
|
function(error) {
|
||||||
// is not required for the user to use the wallet.
|
// FIXME: Ignoring this error may not be the best thing to do. But remote storage
|
||||||
return cb(null, iden, w);
|
// is not required for the user to use the wallet.
|
||||||
}
|
return cb(null, iden, w);
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return cb(null, iden, w);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -197,7 +201,11 @@ Identity.open = function(email, password, opts, cb) {
|
||||||
Identity._openProfile(email, password, iden.storage, function(err, profile) {
|
Identity._openProfile(email, password, iden.storage, function(err, profile) {
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err.message && err.message.indexOf('PNOTFOUND') !== -1) {
|
if (err.message && err.message.indexOf('PNOTFOUND') !== -1) {
|
||||||
return opts.pluginManager.get('remote-backup').retrieve(email, password, opts, cb);
|
if (opts.pluginManager && opts.pluginManager.get('remote-backup')) {
|
||||||
|
return opts.pluginManager.get('remote-backup').retrieve(email, password, opts, cb);
|
||||||
|
} else {
|
||||||
|
return cb(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return cb(err);
|
return cb(err);
|
||||||
}
|
}
|
||||||
|
|
@ -492,11 +500,11 @@ Identity.prototype.createWallet = function(opts, cb) {
|
||||||
this.addWallet(w, function(err) {
|
this.addWallet(w, function(err) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
self.openWallets.push(w);
|
self.openWallets.push(w);
|
||||||
self.pluginManager.get('remote-backup').store(self, self.insightSaveOpts, function(error) {
|
if (self.pluginManager.get && self.pluginManager.get('remote-backup')) {
|
||||||
// Ignore error
|
self.pluginManager.get('remote-backup').store(self, self.insightSaveOpts, _.noop);
|
||||||
w.netStart();
|
}
|
||||||
return cb(null, w);
|
w.netStart();
|
||||||
});
|
return cb(null, w);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -313,10 +313,4 @@ GoogleDrive.prototype.allKeys = function(cb) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
GoogleDrive.prototype.key = function(k) {
|
|
||||||
var v = localStorage.key(k);
|
|
||||||
return v;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = GoogleDrive;
|
module.exports = GoogleDrive;
|
||||||
|
|
|
||||||
|
|
@ -351,7 +351,7 @@ describe('Identity model', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create an encrypted object', function() {
|
it('should create an encrypted object', function() {
|
||||||
var ret = JSON.parse(iden.export());
|
var ret = JSON.parse(iden.exportAsJson());
|
||||||
ret.iterations.should.equal(13);
|
ret.iterations.should.equal(13);
|
||||||
ret.profile.should.equal('penc');
|
ret.profile.should.equal('penc');
|
||||||
_.each([0, 1, 2, 3, 4], function(i) {
|
_.each([0, 1, 2, 3, 4], function(i) {
|
||||||
|
|
@ -382,7 +382,7 @@ describe('Identity model', function() {
|
||||||
|
|
||||||
|
|
||||||
it('should check the import string', function(done) {
|
it('should check the import string', function(done) {
|
||||||
Identity.import(JSON.stringify({
|
Identity.importFromJson(JSON.stringify({
|
||||||
profile: '1234'
|
profile: '1234'
|
||||||
}), '1234', config, function(err, ret) {
|
}), '1234', config, function(err, ret) {
|
||||||
err.should.contain('BADSTR');
|
err.should.contain('BADSTR');
|
||||||
|
|
@ -392,7 +392,7 @@ describe('Identity model', function() {
|
||||||
|
|
||||||
|
|
||||||
it('should check the import string 2', function(done) {
|
it('should check the import string 2', function(done) {
|
||||||
Identity.import(JSON.stringify({
|
Identity.importFromJson(JSON.stringify({
|
||||||
iterations: 10,
|
iterations: 10,
|
||||||
}), '1234', config, function(err, ret) {
|
}), '1234', config, function(err, ret) {
|
||||||
err.should.contain('BADSTR');
|
err.should.contain('BADSTR');
|
||||||
|
|
@ -401,7 +401,7 @@ describe('Identity model', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should import a simple wallet', function(done) {
|
it('should import a simple wallet', function(done) {
|
||||||
Identity.import(JSON.stringify({
|
Identity.importFromJson(JSON.stringify({
|
||||||
iterations: 10,
|
iterations: 10,
|
||||||
profile: '1234'
|
profile: '1234'
|
||||||
}), '1234', config, function(err, iden) {
|
}), '1234', config, function(err, iden) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue