title: MemoryRouter TypeError: Cannot read property 'pathname' of undefined
body: <p>I have a redux container which I want to mount in my test case. It has a component which is using react-router link. Mounting the container was throwing me history not defined error, after reading this <a href="https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/guides/testing.md" rel="nofollow noreferrer">https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/guides/testing.md</a> I implemented MemoryRouter, now the history error is gone, but I am getting following error:</p>
  
  <pre><code>TypeError: Cannot read property 'pathname' of undefined
        at Object.createPath (node_modules/history/PathUtils.js:47:26)
        at Link.render (node_modules/react-router-dom/Link.js:76:44)
  </code></pre>
  
  <p>My test case:</p>
  
  <pre><code>it('should load popup component', () =&gt; {
      const container = mount(
          &lt;Provider store={ store }&gt;
              &lt;MemoryRouter initialIndex='2' initialEntries={ ['/', 'home'] } &gt;
                  &lt;HomeContainer /&gt;
              &lt;/MemoryRouter&gt;
          &lt;/Provider&gt;
      );
      assert.equal(container.find('PopUp').length, 1, 'Popup component is not mounted');
  });
  </code></pre>
  
  <p>My Component:</p>
  
  <pre><code>class Home extends Component {
      componentWillMount() {
          this.props.init();
      }
  
      componentDidMount() {
          document.title = 'Home';
      }
  
      render() {
          return (
              &lt;div&gt;
                  &lt;Popup /&gt;
              &lt;/div&gt;
          );
      }
  }
  export default Home;
  </code></pre>
  
  <p>My Container:</p>
  
  <pre><code>const mapStateToProps = state =&gt; ({
      data: state.mainReducer.data
  });
  const HomeContainer = connect(mapStateToProps, { init })(Home);
  export default HomeContainer;
  </code></pre>