Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Swoogan
Last active September 30, 2015 01:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Swoogan/98017f256edd37d49f42 to your computer and use it in GitHub Desktop.
Save Swoogan/98017f256edd37d49f42 to your computer and use it in GitHub Desktop.
Angular test example
angular.module('testModule', []).controller('TestCont', function ($scope) {
$scope.message = 'hello';
}
describe('testModule module', function(){
beforeEach(module('testModule'));
describe('test controller', function(){
var scope, testCont;
beforeEach(inject(function($rootScope, $controller) {
scope = $rootScope.$new();
testCont = $controller('TestCont', {$scope: scope});
});
it('message should be hello', function(){
expect(scope.message).toEqual('hello');
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment