let compoent = MockComponent;
it('should be called the your Component', () =>{
component.yourComponent() // first called your component
spyOn(component, 'method').and.returnValue('expeted data')
})
spyon is observe the component
New contributor
First create the spy, then execute the method, then finally evaluate it!
let component = MockComponent;
it('should be called the your Component', () =>{
spyOn(component, 'method').and.returnValue('expeted data')
component.yourComponent() // first called your component
expect(component.method).toHaveBeenCalled();
})