One of the methods in my codebase returns function references based on different cases.
function methodToBeMocked(param){
case 1: return func1;
case 2: return func2;
.
.
case n: return funcN;
}
Now, I need to spy on this method and provide a fake function reference for a specific input parameter p.
Is there a conditional call-through feature available in Jasmine tests? Here's my scenario:
SpyOn(someObject, 'someMethod').and.{if param = p callFake(fakeMethod) else callThrough()}
I initially tried using callFake. Is there a way to hand over control to the original method from the fake method?