Merge pull request #755 from yemel/feature/importing-feedback

Add feedback while importing wallet
This commit is contained in:
Gustavo Maximiliano Cortez 2014-06-26 15:51:28 -03:00
commit dff3c9c479
6 changed files with 41 additions and 4 deletions

View file

@ -331,7 +331,6 @@ describe('Wallet model', function() {
var w = cachedCreateW2();
var spy = sinon.spy(w, 'scheduleConnect');
var callCount = 3;
w.reconnectDelay = 25;
w.netStart();
setTimeout(function() {
sinon.assert.callCount(spy, callCount);
@ -743,7 +742,7 @@ describe('Wallet model', function() {
var spyEmit = sinon.spy(w, 'emit');
w.updateIndexes(function(err) {
sinon.assert.callCount(spyStore, 1);
sinon.assert.callCount(spyEmit, 1);
sinon.assert.callCount(spyEmit, 2);
done();
});
});

View file

@ -94,6 +94,29 @@ describe('WalletFactory model', function() {
JSON.stringify(w.toObj()).should.equal(o);
});
it('should create wallet from encrypted object', function() {
var wf = new WalletFactory(config, '0.0.1');
wf.storage._setPassphrase = sinon.spy();
wf.storage.import = sinon.spy();
var w = wf.fromEncryptedObj("encrypted object", "password");
should.exist(w);
wf.storage._setPassphrase.called.should.be.true;
wf.storage.import.called.should.be.true;
});
it('should import and update indexes', function() {
var wf = new WalletFactory(config, '0.0.1');
var wallet = {id: "fake wallet", updateIndexes: function(cb) { cb(); }};
wf.fromEncryptedObj = sinon.stub().returns(wallet);
var callback = sinon.spy();
var w = wf.import("encrypted", "password", callback);
should.exist(w);
wallet.should.equal(w);
sinon.assert.callCount(callback, 1);
});
it('BIP32 length problem', function() {
var sconfig = {