Skip to content

Instantly share code, notes, and snippets.

@ldmarz
Created February 5, 2018 19:22
Show Gist options
  • Save ldmarz/fb60fc4fe0cc3b81b79f5624f02ecc05 to your computer and use it in GitHub Desktop.
Save ldmarz/fb60fc4fe0cc3b81b79f5624f02ecc05 to your computer and use it in GitHub Desktop.
Unit testing service in angularjs
const module = angular.mock.module;
const inject = angular.mock.inject;
let searchService;
describe('Testing some awesome service', () => {
beforeAll(module('yourModule'));
beforeEach(inject($injector => {
searchService = $injector.get('SearchClass');
}));
it('Should be defined', () => {
expect(searchService).toBeDefined();
});
)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment