title: How to test required props in React
body: <p>I'm trying to write simple test with React and Jest.</p>
  
  <p><strong>Component:</strong> </p>
  
  <pre><code>import React from "react";
  
  class Task extends React.Component {
  
      render() {
          let onDelete = this.props.onDelete;
          return (
                  &lt;li&gt;
                      &lt;div className="collapsible-header"&gt;&lt;i className="material-icons" onClick={() =&gt; onDelete(this.props.taskId)}&gt;delete&lt;/i&gt;{this.props.title}&lt;/div&gt;
                      &lt;div className="collapsible-body"&gt;&lt;p&gt;{this.props.description}&lt;/p&gt;&lt;/div&gt;
                  &lt;/li&gt;
                  );
      }
  };
  
  Task.propTypes = {
      title: React.PropTypes.string.isRequired,
      taskId: React.PropTypes.number.isRequired,
      onDelete: React.PropTypes.func.isRequired,
      description: React.PropTypes.string
  };
  
  Task.defaultProps = {
      description: ''
  };
  
  export default Task;
  </code></pre>
  
  <p><strong>Test</strong></p>
  
  <pre><code>import React from 'react';
  import Task from '../src/components/Task';
  import renderer from 'react-test-renderer';
  
  test('Task should require properties', () =&gt; {
    const component = renderer.create( //this will give me React warnings which I would like to assert
      &lt;Task&gt;&lt;/Task&gt;
    );
  });
  </code></pre>
  
  <p>Now I would like to assert that <code>title</code>, <code>taskId</code> and <code>onDelete</code> is required for <code>Task</code> component. That I will get React warning about not specifying them (or passing different types).</p>