I have a service that defined this method:
angular.module("myApp")
.factory("myService.foo", function () {
});
I use Karma and Jasmine for testing. In the test, I do something similar for most of my server tests:
describe('Service: someService', function () {
beforeEach(module('myApp'));
var _someService;
beforeEach(inject([function (someService) {
_someService = someService;
}]));
it('should do something', function () {
expect(!!_someService).toBe(true);
});
});
When I try to do the same with a service named "myService.foo", it throws an error (of course):
describe('Service: myService.foo', function () {
beforeEach(module('myApp'));
var _myService;
beforeEach(inject([function (myService.foo) {
_myService = myService.foo;
}]));
it('should do something', function () {
expect(!!_myService).toBe(true);
});
});
Due to an obvious dot syntax issue that makes angular unable to display the service name. How can I use this service to verify it? Is there any alternative syntax that I am missing?
source
share