Domanda

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?

È stato utile?

Soluzione

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

}));
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top