Personal Blog

Jest spy on any function

Sat 05 Oct 2019

You can use:

component.property = jest.fn();
component.property();

expect(component.property).toHaveBeenCalled();