expected a spy but got undefined? expected a spy but got undefined? angularjs angularjs

expected a spy but got undefined?


scope.pickCard() is result of method. In your case it is undefined.When you are using spyOn you should write:

expect(scope.pickCard).toHaveBeenCalled();