In a proper unit test we want to isolate external dependencies as much as possible to guarantee a reliable test outcome. Http calls represent such external dependencies. Therefore, when testing our Angular components or services that rely on data ret…
When using Ngrx, we need to know how to test the component which has Router injected. Component: import {Component} from '@angular/core'; import {FormGroup} from '@angular/forms'; import {Store} from '@ngrx/store'; import * as fromAuth from '../../re…
When you testing Component rendering, you often needs to call: fixture.detectChanges(); For example: it('should display original title', () => { fixture.detectChanges(); expect(el.textContent).toContain(comp.title); }); it('should display a different…
If sometime you want to log out the comonent html to see whether the html render correctly, you can do : import {TestBed, async, ComponentFixture} from '@angular/core/testing'; import {AppComponent} from './app.component'; import {AuFaInputComponent}…