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?
Comments
Post a Comment