mirror of https://github.com/BTCPrivate/copay.git
added tests for angular services
This commit is contained in:
parent
02af76cdb9
commit
09532f0aaa
|
@ -3,7 +3,7 @@
|
||||||
angular.module('copay.controllerUtils').factory('controllerUtils', function ($rootScope, $location, Socket) {
|
angular.module('copay.controllerUtils').factory('controllerUtils', function ($rootScope, $location, Socket) {
|
||||||
var root = {};
|
var root = {};
|
||||||
|
|
||||||
root.logout = function(scope) {
|
root.logout = function() {
|
||||||
delete $rootScope['wallet'];
|
delete $rootScope['wallet'];
|
||||||
$rootScope.totalBalance = 0;
|
$rootScope.totalBalance = 0;
|
||||||
$location.path('signin');
|
$location.path('signin');
|
||||||
|
@ -15,7 +15,6 @@ angular.module('copay.controllerUtils').factory('controllerUtils', function ($ro
|
||||||
root.logout();
|
root.logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
root.onErrorDigest = function(scope) {
|
root.onErrorDigest = function(scope) {
|
||||||
root.onError(scope);
|
root.onError(scope);
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
@ -31,10 +30,12 @@ angular.module('copay.controllerUtils').factory('controllerUtils', function ($ro
|
||||||
$rootScope.wallet = w;
|
$rootScope.wallet = w;
|
||||||
root.updateBalance();
|
root.updateBalance();
|
||||||
});
|
});
|
||||||
|
|
||||||
w.on('refresh', function() {
|
w.on('refresh', function() {
|
||||||
console.log('[controllerUtils.js] Refreshing'); //TODO
|
console.log('[controllerUtils.js] Refreshing'); //TODO
|
||||||
root.updateBalance();
|
root.updateBalance();
|
||||||
});
|
});
|
||||||
|
|
||||||
w.on('openError', root.onErrorDigest);
|
w.on('openError', root.onErrorDigest);
|
||||||
w.on('close', root.onErrorDigest);
|
w.on('close', root.onErrorDigest);
|
||||||
w.netStart();
|
w.netStart();
|
||||||
|
|
|
@ -19,6 +19,8 @@ module.exports = function(config) {
|
||||||
'lib/angular/angular.min.js',
|
'lib/angular/angular.min.js',
|
||||||
'lib/angular-route/angular-route.js',
|
'lib/angular-route/angular-route.js',
|
||||||
'lib/angular-mocks/angular-mocks.js',
|
'lib/angular-mocks/angular-mocks.js',
|
||||||
|
'lib/bitcore.js',
|
||||||
|
'lib/socket.io.js',
|
||||||
|
|
||||||
//App-specific Code
|
//App-specific Code
|
||||||
'js/*.js',
|
'js/*.js',
|
||||||
|
@ -32,6 +34,9 @@ module.exports = function(config) {
|
||||||
//Mocha stuff
|
//Mocha stuff
|
||||||
'test/mocha.conf.js',
|
'test/mocha.conf.js',
|
||||||
|
|
||||||
|
//Configs
|
||||||
|
'config.js',
|
||||||
|
|
||||||
//test files
|
//test files
|
||||||
'test/unit/**/*.js'
|
'test/unit/**/*.js'
|
||||||
],
|
],
|
||||||
|
@ -39,9 +44,7 @@ module.exports = function(config) {
|
||||||
|
|
||||||
// list of files to exclude
|
// list of files to exclude
|
||||||
exclude: [
|
exclude: [
|
||||||
'js/copayBundle.js',
|
|
||||||
'js/models/**/*.js',
|
'js/models/**/*.js',
|
||||||
'js/init.js'
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,4 +3,24 @@
|
||||||
//
|
//
|
||||||
describe("Unit: Testing Services", function() {
|
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);
|
||||||
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue