How can I test the "private" IIFE methods?
1 answer
Check this out How to check private functions in javascript . In summary, you can achieve what you want by improving your build process. If you are using grunt to build your code, you can add some code snippets that expose the private elements of your IIFE only during testing.
Also you can try this selectizer build tool . With it, you can define your private1 function as a module and then test it just by loading the function with requireJS.
+4
source to share