title: Testing React Component with Jest/Enzyme
body: <p>I am trying to use Enzyme's shallow wrapper to get the instance of my component and calling my class function over it. It shows me this error: 
  <strong><em>TypeError: tree.instance(...).onCampaignSelected is not a function</em></strong></p>
  
  <pre><code>class ToolbarPage extends Component {
    constructor(){
      super();
      this.onCampaignSelected = this.onCampaignSelected.bind(this);
      this.state = {
        item: null
      }
    }
  
    onCampaignSelected (item) {
       this.setState({item})
    }
  
    render () {
      return (
        &lt;MyComponent onItemSelected={this.onCampaignSelected} /&gt;
      )
    }
  }
  function mapStateToProps(state){
    buttons: state.toolbar.buttons
  }
  export default connect(mapStateToProps)(ToolbarPage);
  </code></pre>
  
  <p>My test case looks like this</p>
  
  <pre><code>import { shallow, mount } from 'enzyme';
  import ToolbarPage from './ToolbarPage';
  import configureStore from 'configureStore';
  
  const store = configureStore();
  
  const props = {
   store,
   isLoggedIn: false,
   messageCounter: 0
  }
  
  describe('&lt;ToolbarPage /&gt;', () =&gt; {
    it('allows to select campaign', () =&gt; {
      const tree = shallow(&lt;ToolbarPage {...props}/&gt;);
      tree.instance().onCampaignSelected();
    })
  })
  </code></pre>
  
  <p>I also figured out that it is a wrapped component, so I won't get this function on the wrapped component. How do I access this function?</p>