Using Sinon Stubs
See the original posting on DZone Python
A few days ago, I wanted to test a JS function. Part of the test was to verify that another function gets called, and gets called correctly (with the correct parameters). I ended up using Sinon for the task, and now, looking back at it, its pretty easy and straightforward. The thing is, when I was trying to write my tests I didnt find good examples and there was a little struggle until I figured it out, which is the motivation for this post (why not share and make someones else life easier, right?).
So lets go down to business!