Enzyme - Mock non-instance variables
Clash Royale CLAN TAG #URR8PPP Enzyme - Mock non-instance variables I have the following React Component: const titleText = translate('header.about'); const About = ({onClose}) => ( <div> <ModalHeader title={titleText} onClose={onClose} /> <Content /> </div> ); I also have a test file that checks the onClose functionality, which works fine: onClose const spy = sinon.spy(); const wrapper = shallow(<About onClose={spy} />); // I also tried "mount()" ... assert.equal(spy.callCount, 1, 'onClose was called exactly once'); However, I get the following warning in the terminal when running the test: Warning: Failed prop type: The prop `title` is marked as required in `ModalHeader`, but its value is `undefined` I don't get the warning in the browser, only when running the test. While it's only a warning, I'd rather fix this if possible. Any way to give a mock value to title ? I am only interested in possible so...