angularjs - Can't Inject Angular Controller in Mock Test -
i can't inject controller in mocha test file, keeps showing error:
i followed the documentation here , tried other approaches, here code in test file:
var assert = chai.assert; var expect = chai.expect; var should = chai.should(); describe('suplements module', function(){ beforeeach(angular.mock.module('atari-app')); beforeeach(inject(function ($rootscope, $controller) { scope = $rootscope.$new(); controller = $controller('testcontroller', { '$scope': scope }); })); describe('list supplements',function(){ it('should list supplements', function(){ }); }); });
here app , controller:
angular .module('atari-app', [ 'ui.router', 'ui.utils', 'oc.lazyload', 'ngresource', 'ngsanitize', 'ui.bootstrap', 'ui.select', 'authentication-app', 'angular-ladda', 'nganimate', 'toastr' ]); angular.module('atari-app') .controller('testcontroller', ['$scope', function ($scope) { $scope.testudo = 1; } ]);
my mocha version 2.5.3 , angular 1.4.6
Comments
Post a Comment