Spying On Chained Method Calls With Jest Not Working
I've made my own custom TextInput component that takes a nextField prop. When the 'done' button in my TextInput is pressed, the nextField should be focused. Pretty simple. It works
Solution 1:
nextFieldSpy()
returns a new object every time it is called.
Change how you create nextFieldSpy
to always return the same object:
const nextFieldResult = {focus: jest.fn()};
const nextFieldSpy = jest.fn(() => nextFieldResult);
Post a Comment for "Spying On Chained Method Calls With Jest Not Working"