I want to spy on a function, then execute a callback upon function completion/initial call.
The following is a bit simplistic, but shows what I need to accomplish:
//send a spy to report on the soviet.GoldenEye method function
var james_bond = sinon.spy(soviet, "GoldenEye");
//tell M about the superWeapon getting fired via satellite phone
james_bond.callAfterExecution({
console.log("The function got called! Evacuate London!");
console.log(test.args);
});
Is it possible to do this in Sinon? Alternate libraries welcome as well if they solve my problem :)