title: React Jest Testing onSubmit
body: <p>I am new to react and jest. I have been looking everywhere for testing but I cannot find anything that is helpful. This is partially because I am so new to it, I havent a clue where to start. So bear with me, please. </p>
  
  <p>I have an add to cart file which renders a form with a button inside it. The button is another component, so I'm not looking to test it. I have to test the onSubmit function for the form. Any thoughts? References? </p>
  
  <p>Here is my code so far for the test:</p>
  
  <pre><code>describe('AddToCart', () =&gt; {
    const React = require('react');
    const BaseRenderer = require('react/lib/ReactTestUtils');
    const Renderer = BaseRenderer.createRenderer();
    const ReactTestUtils = require('react-addons-test-utils');
    const AddToCart = require('../index.js').BaseAddToCart;
  
    it('Will Submit', () =&gt; {
      formInstance = ReactTestUtils.renderIntoDocument(&lt;AddToCart product="" quantity=""/&gt;);
      expect(ReactTestUtils.Simulate.onSubmit(formInstance)).toBeCalled();
    });
  });
  </code></pre>
  
  <p>I'm getting this error:</p>
  
  <pre><code>Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.
  </code></pre>