Skip to content

Instantly share code, notes, and snippets.

@al-the-x
Created November 20, 2014 16:56
Show Gist options
  • Save al-the-x/0b03453ade502db392fa to your computer and use it in GitHub Desktop.
Save al-the-x/0b03453ade502db392fa to your computer and use it in GitHub Desktop.
Sample Karma tests for our `github-comments` Angular JS application...
'use strict';
module.exports = function(config) {
config.set({
basePath : '..', //!\\ Ignored through gulp-karma //!\\
files : [ ] //!\\ Ignored through gulp-karma //!\\
autoWatch : false,
frameworks: ['mocha', 'chai'],
browsers : ['PhantomJS'],
});
};
'use strict';
describe('controllers', function(){
beforeEach(module('github-profile'));
describe('MainCtrl', function(){
var MainCtrl;
beforeEach(inject(function($controller){
MainCtrl = $controller('MainCtrl');
}));
it('should define more than 5 awesome things', inject(function() {
expect(MainCtrl.comments.length).to.eq(0);
MainCtrl.addComment('some text');
expect(MainCtrl.comments.length).to.eq(1);
expect(MainCtrl.comments[0]).to.deep.eq({
body: 'some text'
});
}));
}); // END describe(MainCtrl)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment