Angular testing how to prevent ngOnInit call to test a method directly
问题 Context I have a component. Inside of it, the ngOnInit function calls another function of component to retrieve user List. I want to make two series of tets: First test the ngOnInit is triggered properly and populate the user list In a second time I want to test my refresh function which also call getUserList() The first test, with ngOnInit trigger, when I call fixture.detectChanges() works properly. Problem My problem is when testing the refresh function: as soon as I call fixture