title: Jest: How to test prop that is an anonymous function?
body: <p>I have a component that loads another component, sending it an anonymous function as a prop:</p>
  
  <pre><code>export class Header extends Component {
    constructor(props) {
      super(props)
      this.state = { activeTab: TAB_NAMES.NEEDS_REVIEW }
    }
  
    filterByNeedsReview() {
      const { filterByNeedsReviewFn } = this.props
      this.setState({ activeTab: TAB_NAMES.NEEDS_REVIEW })
      filterByNeedsReviewFn()
    }
  
   ...
  
    render() {
      return (
        &lt;Container&gt;
          ...
          ...
            &lt;FilterTab
              active={this.state.activeTab === TAB_NAMES.NEEDS_REVIEW}
              name={TAB_NAMES.NEEDS_REVIEW}
              count={40}
              onClick={() =&gt; this.filterByNeedsReview()}
            /&gt;
            ...
          ...
        &lt;/Container&gt;
      )
    }
  }
  </code></pre>
  
  <p>I have this failing test:</p>
  
  <pre><code>  it('renders a filter tab with the right props for needs review', () =&gt; {
      const filterByNeedsReviewFn = jest.fn()
      expect(
        shallowRender({ filterByNeedsReviewFn })
          .find(FilterTab)
          .findWhere(node =&gt;
            _.isMatch(node.props(), {
              active: true,
              name: 'Needs Review',
              count: 40,
              onClick: filterByNeedsReviewFn, //&lt;-------------- THIS DOESN'T WORK
            })
          )
      ).toHaveLength(1)
    })
  </code></pre>
  
  <p>How would I test that <code>onClick</code> is the right thing?</p>