What is the behavior or the ngOnInit
method? All it does is assign the value of the org
when the route data is resolved. So that’s all you really need to test.
let routeStub;
beforeEach(() => {
routeStub = {
data: null
}
TestBed.configureTestingModule({
providers: [
{ provide: ActivatedRoute, useValue: routeStub }
]
})
})
it('should assign org when route is resolved', async(() => {
let org = new Org()
routeStub.data = Observable.of(org)
fixture.detectChanges();
fixture.whenStable().then(() => {
expect(component.org).toEqual(org)
})
}))