Created
November 20, 2014 16:56
-
-
Save al-the-x/0b03453ade502db392fa to your computer and use it in GitHub Desktop.
Sample Karma tests for our `github-comments` Angular JS application...
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
'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'], | |
}); | |
}; |
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
'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