Last active
February 20, 2018 06:54
-
-
Save gregberge/42c56d0cd33baabf59ff to your computer and use it in GitHub Desktop.
Angular controller test using mocha.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('My controller', function () { | |
var scope, createController; | |
beforeEach(module('app.controllers')); | |
beforeEach(inject(function ($injector) { | |
var $rootScope = $injector.get('$rootScope'); | |
var $controller = $injector.get('$controller'); | |
scope = $rootScope.$new(); | |
createController = function () { | |
return $controller('CustomCtrl', {$scope: scope}); | |
}; | |
})); | |
afterEach(function () { | |
scope.$destroy(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where did you define "inject" and "module"?