Skip to content

Instantly share code, notes, and snippets.

@mcranston18
Created September 28, 2017 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcranston18/0ded29eca9a53efeb945736b0a053061 to your computer and use it in GitHub Desktop.
Save mcranston18/0ded29eca9a53efeb945736b0a053061 to your computer and use it in GitHub Desktop.
Component testing
describe('myComponent', function() {
var $ctrl;
var $rootScope;
var $scope;
beforeEach(module('theNameOfMyAngularApp'));
beforeEach(inject(function(_$rootScope_, _$componentController_) {
$rootScope = _$rootScope_;
$scope = $rootScope.$new();
$ctrl = _$componentController_('myComponent', {
$scope: $scope
}, {
params: {},
response: {},
query: sinon.stub().returns(promise.promise)
});
$ctrl.$onInit();
}));
describe('$ctrl.someMethod', function() {
it('...', function() {
// expect(true).to.be(true);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment