I would like to verify that bar()
is called inside foo()
from my unit test.
I figured that Sinon spies might be suitable, but I don't know how to use them.
Is there any way to check that the method is called? Perhaps even extracting the arguments used in the bar()
call?
var spy = sinon.spy(foo);
function foo(){
bar(1,2,3);
}
function bar(){ }
foo();
// what to do with the spy?
See Question&Answers more detail:os