When working with callbacks you’re usually doing async operations, so to unit test a callback you will need to use QUnit’s async() method.
async(): Instruct QUnit to wait for an asynchronous operation.
So try this:
And that’s it! If myFunction
does its job of invoking the callback then your test will pass.