title: React-Router: How to test href of a rendered Link?
body: <p>I have a React component that renders a <code>&lt;Link/&gt;</code>.</p>
  
  <pre><code>render: function () {
      var record = this.props.record;
      return (
          &lt;Link to="record.detail" params={{id:record.id}}&gt;
              &lt;div&gt;ID: {record.id}&lt;/div&gt;
              &lt;div&gt;Name: {record.name}&lt;/div&gt;
              &lt;div&gt;Status: {record.status}&lt;/div&gt;
          &lt;/Link&gt;
      );
  }
  </code></pre>
  
  <p>I can easily obtain the rendered <code>&lt;a/&gt;</code>, but I'm not sure how to test that the href was built properly.</p>
  
  <pre><code>function mockRecordListItem(record) {
      return stubRouterContext(require('./RecordListItem.jsx'), {record: record});
  }
  it('should handle click', function () {
      let record = {id: 2, name: 'test', status: 'completed'};
      var RecordListItem = mockRecordListItem(record);
      let item = TestUtils.renderIntoDocument(&lt;RecordListItem/&gt;);
  
      let a = TestUtils.findRenderedDOMComponentWithTag(item, 'a');
      expect(a);
  
      // TODO: inspect href?
      expect(/* something */).to.equal('/records/2');
  });
  </code></pre>
  
  <p>Notes: The <a href="https://github.com/rackt/react-router/blob/v0.13.3/docs/guides/testing.md" rel="noreferrer">stubRouterContext</a> is necessary in React-Router v0.13.3 to mock the <code>&lt;Link/&gt;</code> correctly.</p>
  
  <h2>Edit:</h2>
  
  <p>Thanks to <a href="https://stackoverflow.com/a/30332776/317951">Jordan</a> for suggesting <code>a.getDOMNode().getAttribute('href')</code>. Unfortunately when I run the test, the result is <code>null</code>. I expect this has to do with the way <code>stubRouterContext</code> is mocking the <code>&lt;Link/&gt;</code>, but how to 'fix' is still TBD...</p>