Code coverage report for ./src/client/app/monk/monk.service.js

Statements: 22.22% (4 / 18)      Branches: 0% (0 / 6)      Functions: 33.33% (1 / 3)      Lines: 22.22% (4 / 18)      Ignored: none     

All files » ./src/client/app/monk/ » monk.service.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 331     1       1     1                                            
(function() {
    'use strict';
 
    angular
        .module('app.monk')
        .service('monkService', monkService);
 
    monkService.$inject = ['messageService', 'progressService'];
 
    /* @ngInject */
    function monkService(messageService, progressService) {
    	var vm = this;
    	vm.progress = progressService.progress;
 
    	vm.train = function(type) {
   			//firt letter capital always just in case
   			type = type[0].toUpperCase() + type.slice(1);
   			var key = 'train' + type;
        if (type === 'Health') {
          type = 'Heal';
        }
        else if (type === 'Defense') {
          type = 'Block';
        }
        else if (type === 'Battle') {
          type = 'Berserk';
        }
   			vm.progress[key] = true;
   			vm.progress.canLearn = vm.progress.canLearn - 1;
   			messageService.updateMainMessage('You have learned ' + type + '!');
    	};
    }
})();