From 039f0ed461478245f4584ef83f12bea4dc67d59d Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Mon, 22 Sep 2014 15:02:41 -0300 Subject: [PATCH] Trying to import a wallet with a wrong password --- js/models/WalletFactory.js | 5 +---- test/test.WalletFactory.js | 8 ++++---- test/unit/controllers/controllersSpec.js | 3 +++ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/js/models/WalletFactory.js b/js/models/WalletFactory.js index 7b3d4d103..fbc2877d7 100644 --- a/js/models/WalletFactory.js +++ b/js/models/WalletFactory.js @@ -136,10 +136,7 @@ WalletFactory.prototype.fromEncryptedObj = function(base64, passphrase, skipFiel */ WalletFactory.prototype.import = function(base64, passphrase, skipFields) { var self = this; - var w = self.fromEncryptedObj(base64, passphrase, skipFields); - - if (!w) throw new Error('Wrong passphrase'); - return w; + return self.fromEncryptedObj(base64, passphrase, skipFields); }; /** diff --git a/test/test.WalletFactory.js b/test/test.WalletFactory.js index ff30c525c..bd6e9c22a 100644 --- a/test/test.WalletFactory.js +++ b/test/test.WalletFactory.js @@ -179,11 +179,11 @@ describe('WalletFactory model', function() { should.exist(w); wallet.should.equal(w); - + }); + it('should import with a wrong password', function() { wf.fromEncryptedObj = sinon.stub().returns(null); - (function() { - wf.import("encrypted", "password") - }).should.throw(); + var w = wf.import("encrypted", "passwordasdfasdf"); + should.not.exist(w); }); }); diff --git a/test/unit/controllers/controllersSpec.js b/test/unit/controllers/controllersSpec.js index 86c0ba7af..4c268e7ab 100644 --- a/test/unit/controllers/controllersSpec.js +++ b/test/unit/controllers/controllersSpec.js @@ -457,6 +457,9 @@ describe("Unit: Controllers", function() { it('should exist', function() { should.exist(what); }); + it('import status', function() { + expect(scope.importStatus).equal('Importing wallet - Reading backup...'); + }); }); describe('Open Controller', function() {