AngularJs unit test - Check if “Init” function was called
问题 I'm using jasmine as testframework and I've the following Controller I want to test. And I allways have a Init() function where I place my initialization calls for this Controller. Now I want to test if the Init function was called when the controller was initialized. function UnitTestsCtrl() { var that = this; this.Init(); } UnitTestsCtrl.prototype.Init = function() { var that = this; //Some more Stuff } angular.module("unitTestsCtrl", []) .controller("unitTestsCtrl", UnitTestsCtrl); But I