I'm pretty new to jasmine testing, and have no idea how to work with observables and stuff like '.subscribe' etc. Need some help with workaround for a snippet like:
getOrder(partId: number, projectId: number) {
if (projectId != null || undefined) {
this.getOrdersForPartwithObservable(partId, projectId).subscribe(
(order) => {
if (
(order as ordersView[]).length != 0 &&
order != (undefined || null)
) {
this.ordersHeader = Object.keys(order[0]);
this.parts.find(
(x) => x.partId === partId && x.projectId === projectId
).orders = order as ordersView[];
// console.log(this.parts);
} else {
this.notififyService.show(
'No Orders are associated for this part',
'danger'
);
}
},
(error) => {
console.log('Error while fetching orders');
this.notififyService.show(error.message, 'danger');
}
);
} else {
this.notififyService.show(
'Part is not associated with any project',
'danger'
);
}
} I have no clue on how to proceed with testing the individual subscribe and error components and would really appreciate some help!