angularjs - Angular: Unit testing if else statement -


i trying write simple test like:

it('should return smaller', function() {     expect($scope.test).toequal('smaller'); });  it('should return bigger', function() {     $scope.x = 15;     expect($scope.test).toequal('bigger'); }); 

controller:

$scope.x = 4;  if($scope.x > 6) {     $scope.test = 'bigger'; }else{     $scope.test = 'smaller'; } 

first test correct second test fails. setting $scope.x = 15 in test doesn't change situation. how can test that?

live: http://plnkr.co/edit/qzf3vdvj1hbabd4xbk3p?p=preview


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -