Unit test with jest, test tap and map

292 views Asked by At

I have problems testing tap and map with jest, I am using spectator. Does anyone know how I can make it go through this part of the code?

private caseEMPLOYEE_ID($ObservableData: Observable<any>, ctrl: any) {
$ObservableData = this.employeeControllerService.getAllEmployeesUsingGet(ctrl.value ? { 'nameOrId.contains': ctrl.value } : {}).pipe(
  tap((response) => this.checkResultSize(response)),
  map((res: any) =>
    this.mapResultsByKey(
      res.content.map((obj) => ({ ...obj, idName: obj.emplid + ' - ' + obj.name })),
      ctrl
    )
  )
);
return $ObservableData;

}

This is the test

Code test

I have not been able to paste the test code as it gives me a format error.

Thank you very much and best regards.

0

There are 0 answers