Jest Mock Refobject, g. spyOn(globalObject, "calcTheAnsw
Jest Mock Refobject, g. spyOn(globalObject, "calcTheAnswer"). jsx class MyComp extends React. Using I start learn app testing and me need to test the function. I'm running unit tests using Jest and Enzyme for this very simple component render(): render() { return (<Input id='foo' ref={input => { this. Edit: like in scieslak's answer below, because you can spy on getter and setter @Thomas Calls to jest. Delightful JavaScript Testing. You can create a mock Latest version: 30. Ideas You can pass createNodeMock function to TestRenderer. You don't need any prior knowledge about Tagged with jest, mocking, react.