I am looking for suggestions about the best practice around here in this scenario. I have created an angularjs SPA application and looking for building a unit test framework for it. I observed that I am not able to get the app object of the module because I have included all my JS files in self executing anonymous functions.
Here is my module for the application
(function () {
'use strict';
var app = angular.module('app', []);
})();
Here is my unit test file to load app module
describe("App Model Load -> ", function () {
beforeEach(module("app"));
it("Check App object", function () {
expect(app).toBeDefined();
});
});
I found resolutions like using a namespace on the top and binding the app variable to the namespace, but it is no different from opening up the app variable globally. Any thoughts?