Created
April 17, 2020 20:12
-
-
Save philipjfulcher/099988e82cd3d976d3700756d96b173a to your computer and use it in GitHub Desktop.
Example AngularJS unit test
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
import articleModule from './index'; | |
beforeEach(() => { | |
// Create the module where our functionality can attach to | |
angular.mock.module('ui.router'); | |
angular.mock.module(articleModule.name); | |
}); | |
let component; | |
beforeEach(angular.mock.inject(($rootScope, $componentController) => { | |
let User = { | |
current: false | |
}; | |
component = $componentController('comment', { User }); | |
})); | |
describe('comment component', () => { | |
it('should be defined', () => { | |
expect(component).toBeDefined(); | |
}); | |
it('should default canModify to false', () => { | |
expect(component.canModify).toEqual(false); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment