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?