This is the code where it is breaking:
**ngOnInit() {
this.service.getTodosPromise().then(t => {
this.todos = t; });
}**
and this is the getTodosPromise() method in the Service:
**getTodosPromise() {
return this.http.get('...').pipe(map(r => r.json())).toPromise();
}**
And in the *.spect.ts file i have one test for which it is breaking:
**it('should load todos from the server', async(() => {
const service = TestBed.get(TodoService);
// This is used if provider is given at component level.
fixture.debugElement.injector.get(TodoService);
spyOn(service, 'getTodosPromise').and.returnValue(from(Promise.resolve([1, 2, 3])));
fixture.detectChanges();
fixture.whenStable().then(() => {
expect(component.todos.length).toBe(3);
console.log('EXPECT WAS CALLED1');
});
}));**
I am using the angular 6 and didn't see any compilation error but my test case is failing because of above error.