Adding test for Identity

This commit is contained in:
Matias Pando 2014-12-18 19:34:30 -03:00
parent e7240748a2
commit 4a6e03d51f
1 changed files with 45 additions and 0 deletions

View File

@ -791,5 +791,50 @@ describe('Identity model', function() {
iden._cleanUp();
_.size(iden.wallets).should.be.equal(0);
});
});
describe('#getLastFocusedWalletId', function() {
var iden, w, w2;
beforeEach(function() {
var storage = sinon.stub();
storage.setCredentials = sinon.stub();
storage.removeItem = sinon.stub().yields(null);
storage.clear = sinon.stub().yields();
var opts = {
email: 'test@test.com',
password: '123',
network: {
testnet: {
url: 'https://test-insight.bitpay.com:443'
},
livenet: {
url: 'https://insight.bitpay.com:443'
},
},
storage: storage,
};
iden = new Identity(opts);
w = {
getId: sinon.stub().returns('32'),
getName: sinon.stub().returns('treintaydos'),
close: sinon.stub(),
};
w2 = {
getId: sinon.stub().returns('33'),
getName: sinon.stub().returns('treintaytres'),
close: sinon.stub(),
};
iden.addWallet(w);
iden.addWallet(w2);
});
it.only('should return indefined', function() {
var a = iden.getLastFocusedWalletId();
console.log('a', a);
});
});
});