Spy on functions within a module

Spy on functions within a module

I define a module in javascript as below: var test_module = (function () { var foo = function () { some_processing; } var init = function () { foo(); } return { init: init }; })(); As you can see, foo is not exported. Only init is visible from the outside world. How can I spy on foo from a qunit test, and make sure init is calling foo ? Thanks for your help!