Fix tests and increase coverage of them
This commit is contained in:
parent
f6709c4000
commit
392fb8586b
2 changed files with 7 additions and 6 deletions
|
|
@ -735,15 +735,13 @@ describe('Wallet model', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#updateIndexes should store and emit event', function(done) {
|
it('#updateIndexes should store wallet', function(done) {
|
||||||
mockFakeActivity(function(index) {
|
mockFakeActivity(function(index) {
|
||||||
return index <= 14 && index % 2 == 0;
|
return index <= 14 && index % 2 == 0;
|
||||||
});
|
});
|
||||||
var spyStore = sinon.spy(w, 'store');
|
var spyStore = sinon.spy(w, 'store');
|
||||||
var spyEmit = sinon.spy(w, 'emit');
|
|
||||||
w.updateIndexes(function(err) {
|
w.updateIndexes(function(err) {
|
||||||
sinon.assert.callCount(spyStore, 1);
|
sinon.assert.callCount(spyStore, 1);
|
||||||
sinon.assert.callCount(spyEmit, 2);
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -109,13 +109,16 @@ describe('WalletFactory model', function() {
|
||||||
var wf = new WalletFactory(config, '0.0.1');
|
var wf = new WalletFactory(config, '0.0.1');
|
||||||
var wallet = {id: "fake wallet", updateIndexes: function(cb) { cb(); }};
|
var wallet = {id: "fake wallet", updateIndexes: function(cb) { cb(); }};
|
||||||
wf.fromEncryptedObj = sinon.stub().returns(wallet);
|
wf.fromEncryptedObj = sinon.stub().returns(wallet);
|
||||||
var callback = sinon.spy();
|
|
||||||
|
|
||||||
var w = wf.import("encrypted", "password", callback);
|
var w = wf.import("encrypted", "password");
|
||||||
|
|
||||||
should.exist(w);
|
should.exist(w);
|
||||||
wallet.should.equal(w);
|
wallet.should.equal(w);
|
||||||
sinon.assert.callCount(callback, 1);
|
|
||||||
|
wf.fromEncryptedObj = sinon.stub().returns(null);
|
||||||
|
(function() {
|
||||||
|
wf.import("encrypted", "password")
|
||||||
|
}).should.throw();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('BIP32 length problem', function() {
|
it('BIP32 length problem', function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue