Pregunta

I need to use the angularjs mock inject method within Jasmine to inject a service with dots in the name. I tried to do add string identifiers but the inject method does not seem to support this. This is not possible:

beforeEach(inject(['$rootScope','MyApp.Factories.TestFactory', 
    function ($rootScope, testFactory) {

    //doSomeThing

}]));

Is there another way to handle this?

¿Fue útil?

Solución

I haven't tested this, but you can probably get it from the $injector yourself. Something like this:

beforeEach(inject(function($rootScope,$injector) {
    var testFactory = $injector.get('MyApp.Factories.TestFactory');
    //doSomeThing

}));
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top