'How do we write unit test cases for self calling functions using mocha in node

(
async ()=>{

// code

})();

This code is present in one js file and which is not exported as well. I want to import and write unit test cases for above self calling function but unable to find any soln.

I tried using rewire module but not able to invoke self calling function.

Please suggest.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source