My team leader is requesting that I encapsulate my JavaScript code within an Immediately-Invoked Function Expression (IIFE). However, I am struggling to use spyOn in my Jasmine spec file.
How can I properly use spyOn on the following:
(function(){
function_1(){...}
function_2(){...}
});
The method spyOn(window,'function_1')
is not working.
Even passing window into the IIFE is unsuccessful.
Attempting both (x=function()...
and (function x() ...
, followed by spyOn(x,'function_1')
, also fails to work.
I have been unable to locate any relevant information online regarding this issue.