i am trying to unit test a controller in AngularJs and i am following the AngularJs docs as a guide. http://ift.tt/R03QJb
in the guide (in the link above) they have this code in the controller
$scope.spice = "habanero";
and this code in the test
it('should set the default value of spice', function() {
expect($scope.spice).toBe('habanero');
});
in the controller i am testing there is some code like this:
$scope.sessionViewModel = session;
and in my test i have written this:
it('should set the default value of sessionViewModel', function(){
expect($scope.sessionViewModel).toBe(session);
});
yet i am getting an error saying TypeError cannot read property 'sessionViewModel' of undefined
not really sure what i have done wrong
Aucun commentaire:
Enregistrer un commentaire