Using $injector in AngularJS when integration testing (without using ngMock) -


i'm needing setup integration tests in angularjs using karma/jasmine having trouble, because when not using ngmock (since want hit actual $http endpoints), there no module or inject methods.

so how inject services tests?

i've tried angular.injector.invoke(...) can't working, comes error unknown provider: authserviceprovider <- authservice.

thoughts?

try this

'use strict';  describe('login user', function () {     var app, loginservice;      beforeeach(module('app')) ;      beforeeach(inject(function(_loginservice_) {         loginservice = _loginservice_;     })) ;     it('should logged in', function () {        var isloggedin = loginservice.isuserloggedin();        expect(isloggedin).tobetruthy();     });  }); 

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -