I am currently working on testing an asynchronous scenario. Here is a snippet of my component:
ngOnInit(private service: MyService) {
this.isLoading = true;
this.service.getData().subscribe((data) => {
this.data = data;
this.isLoading = false;
});
}
In the code above, I set isLoading to true initially and then update it to false once the data is fetched successfully. This behavior is what I'm trying to test. I have attempted using tick(), whenStable() methods but so far have not been able to capture isLoading being true.
If anyone has any suggestions or solutions, I would greatly appreciate your help. Thank you.