Suppose we have a function test, that has been called multiple times with different values. How can we stub it for a particular parameter value. Like in the following
function test(key, cb) {
// code
cb();
}
test('one', function(arg){console.log(arg);});
test('two', function(arg){console.log(arg);});
test('three', function(arg){console.log(arg);});
I want to stub it for the call with 'two' only to verify if it is called once with 'two' and also execute callback with arg to check the state after function call.