如何以角度单元测试测试嵌套函数

时间:2021-07-27 09:33:46

标签: angular jasmine karma-jasmine

我有一个功能

getLocations() {
  debugger;
  this.spinnerService.displayLoader(true);
  this.locService.getLocation()
    .subscribe((data) => {
      this.facilityLocationsResMain = data;
      this.locations = this.facilityLocationsResMain.facilityLocationsRes;
      console.log("Locations", this.facilityLocationsResMain);
      this.mapFacility();
      this.spinnerService.displayLoader(false);
    }, (error) => {
      this.spinnerService.displayLoader(false);
      this.router.navigate(['error']);
    });
}

有人可以帮助如何为此编写测试用例并在同一测试用例或不同的测试用例中调用 mapFacility 函数吗?

0 个答案:

没有答案