Skip to content

Instantly share code, notes, and snippets.

@KylePDavis
Last active August 29, 2015 14:02
Show Gist options
  • Save KylePDavis/e94f9a14a3f1a929a175 to your computer and use it in GitHub Desktop.
Save KylePDavis/e94f9a14a3f1a929a175 to your computer and use it in GitHub Desktop.
Self-hosted Karma Test Case Template
// 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