Added lastOpened to list of all wallets

This commit is contained in:
Ivan Socolsky 2014-09-24 10:47:19 -03:00
commit cfa00590a6
3 changed files with 45 additions and 13 deletions

View file

@ -189,6 +189,7 @@ describe('WalletFactory model', function() {
describe('#getWallets', function() {
it('should return empty array if no wallets', function(done) {
wf.storage.getWallets = sinon.stub().yields([]);
wf.storage.getLastOpened = sinon.stub().yields(null);
wf.getWallets(function(err, ws) {
should.not.exist(err);
@ -205,6 +206,7 @@ describe('WalletFactory model', function() {
name: 'w',
id: 'id2',
}]);
wf.storage.getLastOpened = sinon.stub().yields(null);
wf.getWallets(function(err, ws) {
should.not.exist(err);
@ -220,6 +222,31 @@ describe('WalletFactory model', function() {
done();
});
});
it('should include last used info', function(done) {
wf.storage.getWallets = sinon.stub().yields([{
name: 'w1',
id: 'id1',
}, {
name: 'w',
id: 'id2',
}]);
wf.storage.getLastOpened = sinon.stub().yields('id2');
wf.getWallets(function(err, ws) {
should.not.exist(err);
ws.should.deep.equal([{
name: 'w1',
id: 'id1',
show: 'w1 <id1>'
}, {
name: 'w',
id: 'id2',
lastOpened: true,
show: 'w <id2>'
}]);
done();
});
});
});
describe('#delete', function() {