title: How do I test HOCs with ReactJS, Enzyme and Jest?
body: <p>I want to test that component receives props, and that clicking on a button increases the value.</p>
  
  <p>I know how to test without using HOC, but I don't know how to test with using it.</p>
  
  <p>Example:</p>
  
  <pre><code>// component
  const Test = ({ value, increment }) =&gt; {
    return (
      &lt;div&gt;
        {value}
        &lt;button onClick={increment}&gt;Click&lt;/button&gt;
      &lt;/div&gt;
    );
  }
  Test.propTypes = {
    name: PropTypes.string.isRequired,
    increment: PropTypes.func.isRequired
  }
  
  // higher order component
  const test = WrappedComponent =&gt; {
    return class extends Component {
      state = { value: 0 }
  
      increment = () =&gt; {
        this.setState({ value: this.state.value + 1 });
      }
  
      render() {
        return (
          &lt;WrappedComponent 
            increment={this.increment} 
            value={this.state.value} /&gt;
        );
      }
    }
  }
  
  // test
  // Error: failed the prop type name
  it("renders without crashing", () =&gt; {
    const Container = test(Test);
    shallow(&lt;Container /&gt;);
  });
  </code></pre>