jeudi 5 juin 2014

Testing javascript inside IIFE


Vote count:

0




My team leader wants me to wrap my js code inside an IIFE immediatly-invoked function expression. I can't figure out how to spyOn my code now.


How would I spyOn the follow:



(function(){
function_1(){...}
function_2(){...}
});


spyOn(window,'function_1') doesn't work.

Passing window into the IIFE doesn't work.

Trying both (x=function()... and (function x() ... then spyOn(x,'function_1') doesn't work either.

I couldn't find anything online about this.



asked 56 secs ago






Aucun commentaire:

Enregistrer un commentaire