You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been using React.createRef on one of my components, and using ref.current.validate() & current.state which works fine on implementation but not while testing it using Jest. jest.spyOn works on validate() function but loses all other props of ref such as 'state' here. Also using Enzyme Mount for the component render.
I also am having issues with this.
Not only is the spyOn method not seeming to be applied, but it is never called either.
Similar behavior using Object.defineProperty as well.
This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
I've been using React.createRef on one of my components, and using ref.current.validate() & current.state which works fine on implementation but not while testing it using Jest. jest.spyOn works on validate() function but loses all other props of ref such as 'state' here. Also using Enzyme Mount for the component render.
jest.spyOn(React,'createRef').mockReturnValue({ current: { validate: jest.fn(), state: 'abc' } })
The text was updated successfully, but these errors were encountered: