I have a spec code to test like this
it(\'login test\', () => {
const fixture = TestBed.createComponent(component);
fixture.detectChanges();
You need to mock the login function as follows:
let loginService: any = {
login(): Observable {
return Observable.of('you object');
}
};
you might find the observable.if function undefined, so you need to import the observable this way:
import { Observable } from 'rxjs/Rx';
import 'rxjs/add/observable/of';