jest spy on mock code example
Example 1: jest spyon
// jest.spyOn(object, methodName)
const spy = jest.spyOn(video, 'play');
// jest.spyOn(object, methodName, accessType?)
const spy = jest.spyOn(video, 'play', 'get'); // we pass 'get'
Example 2: jest mock call
test("mock.calls", () => {
const mockFn = jest.fn();
mockFn(1, 2);
expect(mockFn.mock.calls).toEqual([[1, 2]]);
});