I have got the below function where the response is coming from an API call.
private getDetails(searchedID) {
this.entityService.getDetailsById(searchedID).subscribe(
response => {
this.searchedDetail = response;
this.setEntityDetails(this.searchedDetails);
},
(error) => {
if (error.error instanceof Error) {
const errMessage = error.error.message;
this.logger.logError('Message -' + errMessage);
}
this.messages.displayResponseMessage("Error getting entity details", 3000, "snackbar-error");
});
}
Can someone give me suggestions on how to achieve unit test coverage for the 'response' block?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…