I used spy function inside a test in karma and tried testing if it executes and if it changes the value of a variable inside my scope.
This is the controller code: