Save last opened wallet
This commit is contained in:
parent
698bd3f616
commit
9b1708b88e
6 changed files with 62 additions and 1 deletions
|
|
@ -317,6 +317,20 @@ describe('WalletFactory model', function() {
|
|||
});
|
||||
});
|
||||
|
||||
it('should clean lastOpened on delete wallet', function(done) {
|
||||
var wf = new WalletFactory(config, '0.0.1');
|
||||
var w = wf.create({
|
||||
name: 'test wallet'
|
||||
});
|
||||
|
||||
wf.storage.setLastOpened(w.id);
|
||||
wf.delete(w.id, function() {
|
||||
var last = wf.storage.getLastOpened();
|
||||
should.equal(last, undefined);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should return false if wallet does not exist', function() {
|
||||
var opts = {
|
||||
'requiredCopayers': 2,
|
||||
|
|
@ -343,6 +357,23 @@ describe('WalletFactory model', function() {
|
|||
wf.read.calledWith(walletId).should.be.true;
|
||||
});
|
||||
|
||||
it('should save lastOpened on create/open a wallet', function() {
|
||||
var opts = {
|
||||
'requiredCopayers': 2,
|
||||
'totalCopayers': 3
|
||||
};
|
||||
var wf = new WalletFactory(config, '0.0.1');
|
||||
var w = wf.create(opts);
|
||||
var last = wf.storage.getLastOpened();
|
||||
should.equal(last, w.id);
|
||||
|
||||
wf.storage.setLastOpened('other_id');
|
||||
|
||||
var wo = wf.open(w.id, opts);
|
||||
last = wf.storage.getLastOpened();
|
||||
should.equal(last, w.id);
|
||||
});
|
||||
|
||||
it('should return error if network are differents', function() {
|
||||
var opts = {
|
||||
'requiredCopayers': 2,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue