title: Enzyme Mount Error - TypeError: Cannot read property 'find' of undefined
body: <p>There is an error </p>
  
  <blockquote>
    <p>TypeError: Cannot read property 'find' of undefined</p>
  </blockquote>
  
  <p>when I tested my react component. I used jest and enzyme for react app testing.
  I tried different methods but still got an undefined error.</p>
  
  <p>test.js</p>
  
  <pre><code>import React from 'react';
  import { mount } from 'enzyme';
  import { StaticRouter } from 'react-router-dom';
  
  import Button from '../index';
  
  describe('&lt;Button /&gt;', () =&gt; {
    let renderComponent;
  
    beforeEach(() =&gt; {
      renderComponent = (props = {}) =&gt; {
        mount(
          // &lt;MemoryRouter&gt;
          &lt;Button href={href} {...props}&gt;
            {children}
          &lt;/Button&gt;,
          // &lt;/MemoryRouter&gt;,
        );
      };
    });
  
    it('should render an &lt;a&gt; tag if no handleRoute is provided', () =&gt; {
      const renderedComponent = renderComponent();
      expect(renderedComponent.find('a')).toHaveLength(1);
    });
  });
  </code></pre>
  
  <p>index.js (button component)</p>
  
  <pre><code>import React, { Children } from 'react';
  import PropTypes from 'prop-types';
  
  import A from './A';
  // import StyledButton from './StyledButton';
  import Wrapper from './Wrapper';
  
  function Button(props) {
    // render an anchor tag =&gt; a tag
    let button = (
      &lt;A href={props.href} onClick={props.onClick}&gt;
        {Children.toArray(props.children)}
      &lt;/A&gt;
    );
  
    return &lt;Wrapper&gt;{button}&lt;/Wrapper&gt;;
  }
  
  Button.propTypes = {
    handleRoute: PropTypes.func,
    href: PropTypes.string,
    onClick: PropTypes.func,
    children: PropTypes.node.isRequired,
  };
  
  export default Button;
  </code></pre>