Im new to jamsine karma. I want to unit test case for below function, but it never covering whole function at all.after pipe its not covering
I have tried multiple ways . but not got any luck
getDetails() {
this.spinner.show();
const myTimer = timer(1000,120000);
this.sub = myTimer
.pipe(
mergeMap( (): any => this.commonService.details())
).subscribe(
(res: any) => {
if (!res?.items) {
this.noRecord = true;
} else {
this.tableData = res.items;
res.items.forEach((element: any) => {
if (element.startTime && element.endTime) {
element['duration'] = this.calculateDuration(element.startTime, element.endTime);
} else {
element['duration'] = 'NA';
}
if(element.creationTime){
element['elaspedTime'] = this.getElapsedTime(element.creationTime);
}
});
this.noRecord = false;
this.spinner.hide();
}
},
(error: Error) => {
this.spinner.hide();
this.noRecord = true;
}
)
}