added tests for angular services

This commit is contained in:
Mario Colque 2014-04-23 18:07:20 -03:00
commit 09532f0aaa
3 changed files with 28 additions and 4 deletions

View file

@ -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();