How to test if an anonymous function was passed as parameter in a spy function of sinon.js? Imagine a function like that.
function myFunction(){
//do stuff
otherobj.anotherFunc({myobj: 'value'}, function(){ console.log('test'); });
}
I created a spy in my test setup for otherobj.anotherFunc and could easily test if my spy was called with the first argument (an js object).
But i have some problems when i tried to test if the second argument, a callback is equal to another function.
ok(myDependencySpy.called, "dependency was called!"); //this is OK!
deepEqual(myDependencySpy.args[0][0], {myobj: 'value'}); //this is OK!
deepEqual(myDependencySpy.args[0][1], function(){ console.log('test'); }); //this FAIL =[
Is there a way to test that?