title: How to mock e.preventDefault in react component's child
body: <p>Hy, I don't know how to mock an inline function in React component's child</p>
  <p>My stack: <code>sinon</code>, <code>chai</code>, <code>enzyme</code>;</p>
  <p>Component usage:</p>
  <pre><code>&lt;ListItem onClick={() =&gt; someFn()} /&gt;
  </code></pre>
  <p>Component's render:</p>
  <pre><code>render() {
      return (
        &lt;li&gt;
          &lt;a href=&quot;#&quot; onClick={e =&gt; {
              e.preventDefault();
              this.props.onClick();
            }}
          &gt; whatever &lt;/a&gt;
        &lt;/li&gt;
      );
    }
  </code></pre>
  <p>Here we have <code>onClick</code> function that calls <code>e.preventDefault()</code>. How to tell to <code>&lt;a href&gt;</code>(<code>link</code>) to not to call <code>e.preventDefault()</code>? How can I mock an <code>onClick</code>?</p>
  <p>Below is what I have tried in tests:</p>
  <p>Shallow copy setup</p>
  <pre><code>function setup() {
    const someFn = sinon.stub();
  
    const component = shallow(
      &lt;ListItem
        onClick={() =&gt; {
          someFn();
        }}
      /&gt;
    );
  
    return {
      component: component,
      actions: someFn,
      link: component.find('a'),
      listItem: component.find('li'),
    }
  }
  </code></pre>
  <p>And the test</p>
  <pre><code>  it('simulates click events', () =&gt; {
      const { link, actions } = setup();
      link.simulate('click'); //Click on &lt;a href&gt;
      expect(actions).to.have.property('callCount', 1); //will be fine if we remove e.preventDefault()
    });
  </code></pre>
  <p>Test's output error:</p>
  <pre><code>TypeError: Cannot read property 'preventDefault' of undefined
  </code></pre>