我正在学习在反应式表单实现中具有服务依赖性的单元测试组件。我搜索了测试,但最终却一无所获。我需要帮助来实施单元测试。请找到我组件的代码片段:
getLocationDetails() {
this.searchLocation(new LocationSearch(), true);
}
searchLocation(model: LocationSearch, isValid: boolean) {
model.Floor = model.Floor == this.selectDefault ? null : model.Floor;
model.TenantId = this.sessionService.getSession('TenantId');
this.locService.getRoomDetails(model).then((result: LocationDetail[]) => {
this.locations = new MatTableDataSource<LocationDetail>(result['LocationList']);
this.locations.paginator = this.paginator;
}).catch(err => {
this.message = "Problem while fetching location details";
this.toastr.error(this.message);
});
}