diff --git a/Gruntfile.js b/Gruntfile.js index a043256b8..ab545d23b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -118,6 +118,7 @@ module.exports = function(grunt) { 'lib/angular-foundation/mm-foundation-tpls.min.js', 'lib/angular-gettext/dist/angular-gettext.min.js', 'lib/angular-load/angular-load.min.js' + // If you add libs here, remember to add it too to karma.conf ], dest: 'lib/angularjs-all.js' }, diff --git a/js/controllers/open.js b/js/controllers/open.js index e06519e1f..8fb5df483 100644 --- a/js/controllers/open.js +++ b/js/controllers/open.js @@ -15,17 +15,19 @@ angular.module('copayApp.controllers').controller('OpenController', function($sc $rootScope.fromSetup = false; $scope.loading = false; $scope.retreiving = true; + walletFactory.getWallets(function(wallets) { - $scope.wallets = wallets.sort(cmp); - if (!$scope.wallets.length) { + if (!wallets || !wallets.length) { $location.path('/'); - } + } else { + $scope.wallets = wallets.sort(cmp); - walletFactory.storage.getLastOpened(function(ret) { - $scope.selectedWalletId = ret || ($scope.wallets[0] && $scope.wallets[0].id); - $scope.retreiving = false; - }); + walletFactory.storage.getLastOpened(function(ret) { + $scope.selectedWalletId = ret || ($scope.wallets[0] && $scope.wallets[0].id); + $scope.retreiving = false; + }); + } }); $scope.openPassword = ''; diff --git a/karma.conf.js b/karma.conf.js index 052e215fb..06b14adcf 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -28,6 +28,7 @@ module.exports = function(config) { 'lib/angular-route/angular-route.min.js', 'lib/angular-foundation/mm-foundation.min.js', 'lib/angular-foundation/mm-foundation-tpls.min.js', + 'lib/angular-load/angular-load.min.js', 'lib/angular-gettext/dist/angular-gettext.min.js', 'lib/inherits/inherits.js', 'lib/bitcore.js', @@ -61,7 +62,6 @@ module.exports = function(config) { 'test/mocks/FakeBlockchainSocket.js', 'test/mocks/FakePayProServer.js', 'test/mocks/FakeLocalStorage.js', - 'test/mocks/FakeStorage.js', 'test/mocha.conf.js', diff --git a/test/unit/controllers/controllersSpec.js b/test/unit/controllers/controllersSpec.js index 48214a907..9d06092d2 100644 --- a/test/unit/controllers/controllersSpec.js +++ b/test/unit/controllers/controllersSpec.js @@ -25,6 +25,7 @@ describe("Unit: Controllers", function() { beforeEach(module('copayApp.services')); beforeEach(module('copayApp.controllers')); + beforeEach(angular.mock.module('copayApp')); var walletConfig = { requiredCopayers: 3, diff --git a/test/unit/services/servicesSpec.js b/test/unit/services/servicesSpec.js index 9a5b73faf..2d827c6fd 100644 --- a/test/unit/services/servicesSpec.js +++ b/test/unit/services/servicesSpec.js @@ -6,6 +6,8 @@ var sinon = require('sinon'); var preconditions = require('preconditions').singleton(); +beforeEach(angular.mock.module('copayApp')); + describe("Unit: Walletfactory Service", function() { beforeEach(angular.mock.module('copayApp.services')); it('should contain a walletFactory service', inject(function(walletFactory) {