I am trying to test my angular 4.1.0 component -
export class CellComponent implements OnInit {
lines: Observable>;
@Input() dep
For my case there was a mock data problem and in case of Array
, I was returning string
from the mock.
someApi = fixture.debugElement.injector.get(SomeApi);
spyOn(someApi, 'someMethod')
.and.returnValue(Observable.of('this is not a string but array'));
The error message is really distracting and was not telling the actual error. Running
ng test --source=false
pointed the correct error and line, and helped me to fix it quickly.
Many time it happens when you mock data is incomplete or incorrect.