diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index bce88761d..ef813cb67 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -3,7 +3,7 @@ angular.module('copay.controllerUtils').factory('controllerUtils', function ($rootScope, $location, Socket) { var root = {}; - root.logout = function(scope) { + root.logout = function() { delete $rootScope['wallet']; $rootScope.totalBalance = 0; $location.path('signin'); @@ -15,7 +15,6 @@ angular.module('copay.controllerUtils').factory('controllerUtils', function ($ro root.logout(); } - root.onErrorDigest = function(scope) { root.onError(scope); $rootScope.$digest(); @@ -31,10 +30,12 @@ angular.module('copay.controllerUtils').factory('controllerUtils', function ($ro $rootScope.wallet = w; root.updateBalance(); }); + w.on('refresh', function() { console.log('[controllerUtils.js] Refreshing'); //TODO root.updateBalance(); }); + w.on('openError', root.onErrorDigest); w.on('close', root.onErrorDigest); w.netStart(); diff --git a/karma.conf.js b/karma.conf.js index add856c20..cfd36e3f8 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -19,6 +19,8 @@ module.exports = function(config) { 'lib/angular/angular.min.js', 'lib/angular-route/angular-route.js', 'lib/angular-mocks/angular-mocks.js', + 'lib/bitcore.js', + 'lib/socket.io.js', //App-specific Code 'js/*.js', @@ -32,6 +34,9 @@ module.exports = function(config) { //Mocha stuff 'test/mocha.conf.js', + //Configs + 'config.js', + //test files 'test/unit/**/*.js' ], @@ -39,9 +44,7 @@ module.exports = function(config) { // list of files to exclude exclude: [ - 'js/copayBundle.js', 'js/models/**/*.js', - 'js/init.js' ], diff --git a/test/unit/services/servicesSpec.js b/test/unit/services/servicesSpec.js index 2cfd1fda8..3c2efa884 100644 --- a/test/unit/services/servicesSpec.js +++ b/test/unit/services/servicesSpec.js @@ -3,4 +3,24 @@ // describe("Unit: Testing Services", function() { + beforeEach(angular.mock.module('copay.socket')); + + it('should contain a Socket service', inject(function(Socket) { + expect(Socket).not.to.equal(null); + })); + + + beforeEach(angular.mock.module('copay.walletFactory')); + + it('should contain a walletFactory service', inject(function(walletFactory) { + expect(walletFactory).not.to.equal(null); + })); + + + beforeEach(angular.mock.module('copay.controllerUtils')); + + it('should contain a controllerUtils service', inject(function(controllerUtils) { + expect(controllerUtils).not.to.equal(null); + })); + });