Last active
August 29, 2015 14:02
-
-
Save KylePDavis/e94f9a14a3f1a929a175 to your computer and use it in GitHub Desktop.
Self-hosted Karma Test Case Template
This file contains hidden or 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
// Karma one-liner to make these tests self-hosted (needs karma.conf.js support for TEST_FILE env var) | |
if(typeof require!=='undefined' && require.main===module) global.describe=function(){}, process.env.TEST_FILE=__filename, require("karma").server.start({configFile:__dirname+'/../karma.conf.js'}); | |
describe('app.module.thing', function(){ | |
// module deps | |
beforeEach(module('app.module')); | |
// vars injected | |
var $rootScope; | |
// vars created | |
var $scope; | |
beforeEach(inject(function($injector){ | |
$rootScope = $injector.get('$rootScope'); | |
$scope = $rootScope.$new(); | |
})); | |
it('should ensure that everything is awesome', function(){ | |
expect($scope.everything).toEqual('awesome'); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment