lundi 23 mai 2016

karma state go could not resolve "..."

I am trying to test a function in my controller and just test to see if $state.go was called. I put a spy on $state.go but when I call the function I get "Could not resolve 'thestate' from state ..."

Here is my controller's function:

function cancel(){
  $state.go('thestate', {}, {reload: true});
}

and my test:

it('should change state to thestate', function() {
  this.scope.cancel();
});

when it runs the cancel function I get an error of "Could not resolve 'thestate' from state ..." but I do have a defined state in my routes.

How can I mock states?

Aucun commentaire:

Enregistrer un commentaire