title: React Jest test Cannot read property 'pathname' of undefined
body: <p>Not sure why I'm getting this error in my simple Main.test file.</p>
  
  <p><a href="https://i.stack.imgur.com/kSKGg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/kSKGg.png" alt="enter image description here"></a></p>
  
  <h2>The constructor of Main.js</h2>
  
  <pre><code>export class Main extends Component {
      constructor(props) {
          super(props);
  
          this.state = {
              location: splitString(props.location.pathname, '/dashboard/')
          }
  
          if (R.isEmpty(props.view)) {
              isViewServices(this.state.location)
                  ? this.props.gotoServicesView()
                  : this.props.gotoUsersView()
          }
      }
  </code></pre>
  
  <h2>Main.test</h2>
  
  <pre><code>import React from 'react'
  import * as enzyme from 'enzyme'
  import toJson from 'enzyme-to-json'
  import { Main } from './Main'
  import Sidebar from '../../components/Common/sidebar'
  
  const main = enzyme.shallow(&lt;Main /&gt;);
  
  describe('&lt;Main /&gt; component', () =&gt; {
  
    it('should render', () =&gt; {
      const tree = toJson(main);
      expect(tree).toMatchSnapshot();
    });
  
    it('contains the Sidebar', () =&gt; {
      expect(main.find(Sidebar).length).toBe(1);
    });
  });
  </code></pre>
  
  <p>Is there a way to mock up the 'pathname'?</p>