Angular unit test spyOn not detecting my call
问题 I've got a problem with a unit test I can't solve. Here is my test : fit('should call the alert service in case something went wrong getting the list of files', async(() => { spyOn(this.component.alert, 'error'); this.component.onInputChange('error'); this.fixture.whenStable().then((() => { expect(this.component.alert.error).toHaveBeenCalledWith('an error occured'); })); })); And here is the part of the component I'm testing : private onInputChange (search: string) { const that = this; this