angularjs - angular.mock.inject causing $injector:moduleerr -
i setting unit tests using karma, require.js, mocha , chai. after setting up, have simple spec file test controller , scope variable.
i know inject function needs used $controller service instantiate controller. unable this. here have :
define([ 'angular', 'angularmocks' ], function() { describe('myctrl', function() { var $controller; beforeeach(angular.mock.module('myapp')); // ////////// attempt 1 // beforeeach(angular.mock.inject(function(_$controller_){ // $controller = _$controller_; // })); // ////////// attempt 2 // it('should', inject(function(_$rootscope_, _$controller_, _$httpbackend_) { // })); it('should', function() { // ////////// goal expect($scope.message).to.equal('hello world'); }); }); });
Comments
Post a Comment