I am writing some unit tests for my component and i am getting this cryptic error message. I found a similar question at Angular 2 unit testing - getting error Failed to load
I just ran into this error and the problem was my mocks. In the component.ngOnInit i used this.route.paramMap.subscribe(...) where route is an ActivatedRoute instance
In my test i provided a mock service like this :
providers: [
{ provide: ActivatedRoute, useValue: { snapshot: { params: { id: 1 } } } }
]
And in fact i missed to mock the paramMap method
Then i fix it adding a paramMap properties like this
providers: [
{ provide: ActivatedRoute, useValue: { snapshot: { params: { id: 1 } }, paramMap: Observable.of({get: () => 1}) } }
]
Then i don't have anymore this stupid error.
So for you, i expect the class SessionServiceStub to be incomplete or erroneous. Does it get a login method that return an Observable ?
If it's not the problem you can check the NotificationServiceStub
You should use a debugger (with Webstorm it's easy to debug step-by-step) to help you.