I am spying a JS method. I want to return different things based on actual argument to the method. I tried callFake and tried to access arguments using arguments[0] but it says arguments[0] is undefined. Here is the code -
spyOn(testService, 'testParam').and.callFake(function() { var rValue = {}; if(arguments[0].indexOf("foo") !== -1){ return rValue; } else{ return {1}; } }) This is suggested here - Any way to modify Jasmine spies based on arguments?
But it does not work for me.