I am Jasmine unit testing an angular component, which uses Observables. My component has this lifecycle hook that I am testing:
ngOnInit() {
this.dataService.ge
Did you ever come up with a solution? What about using the jasmine-marbles
package and the complete
event?
it('should update chart on new data', () => {
const obs$ = cold('--a-|');
spyOn(service, 'getCellOEE').and.returnValue(obs$);
component.ngOnInit();
obs$.subscribe({
complete: () => {
expect(component.updateChart).toHaveBeenCalledWith('a');
}
});
});