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) {
|
||||
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();
|
||||
|
|
|
@ -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'
|
||||
],
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue