I am running the unit test for an angular app. I expect ngOnInit to be called, but the test fails as TypeError: Cannot read property 'subscribe' of undefined.
This is Component.ts
ngOnInit() {
this.topToolBarService.change.subscribe(customer => {
this.filter.customerid = customer;
this.customerid = customer;
this.getData();
});
}