Test whether React component has rendered
问题 I have a React component that I am trying to test using Enzyme/Jest. I am trying to figure out what the most appropriate test would be to ensure the component has rendered. My component has a prop shouldRender that, if false, will cause the component to not render. My component looks like this: import React from 'react'; const propTypes = { shouldRender: React.PropTypes.bool, }; class MyComponent extends React.Component { constructor(props) { super(props); this.state = { foo: 'bar', }; }