{"action":"created","issue":{"url":"https://api.github.com/repos/QubitProducts/react-test-tree/issues/41","labels_url":"https://api.github.com/repos/QubitProducts/react-test-tree/issues/41/labels{/name}","comments_url":"https://api.github.com/repos/QubitProducts/react-test-tree/issues/41/comments","events_url":"https://api.github.com/repos/QubitProducts/react-test-tree/issues/41/events","html_url":"https://github.com/QubitProducts/react-test-tree/issues/41","id":101788408,"number":41,"title":"How do you test React Router?","user":{"login":"yanivtal","id":1707828,"avatar_url":"https://avatars.githubusercontent.com/u/1707828?v=3","gravatar_id":"","url":"https://api.github.com/users/yanivtal","html_url":"https://github.com/yanivtal","followers_url":"https://api.github.com/users/yanivtal/followers","following_url":"https://api.github.com/users/yanivtal/following{/other_user}","gists_url":"https://api.github.com/users/yanivtal/gists{/gist_id}","starred_url":"https://api.github.com/users/yanivtal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yanivtal/subscriptions","organizations_url":"https://api.github.com/users/yanivtal/orgs","repos_url":"https://api.github.com/users/yanivtal/repos","events_url":"https://api.github.com/users/yanivtal/events{/privacy}","received_events_url":"https://api.github.com/users/yanivtal/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-08-19T01:51:53Z","updated_at":"2015-08-19T23:10:58Z","closed_at":"2015-08-19T23:10:57Z","body":"As a harness for React Router you have something like this:\r\n```\r\nclass TestHarness extends Component {\r\n  render() {\r\n    return (\r\n      <Router history={createMemoryHistory('/')} ref='router'>\r\n        <Route path=\"/\" component={ComponentWrapper} ref='route'/>\r\n      </Router>\r\n    );\r\n  }\r\n}\r\n```\r\n\r\nWhere the ComponentWrapper you want to test may look like this:\r\n```\r\nclass ComponentWrapper extends Component {\r\n  render() {\r\n    return (\r\n      <Navbar links={links} ref='navbarWrapper'/>\r\n    );\r\n  }\r\n}\r\n```\r\n\r\nIn this case I want to get to the navbarWrapper. The complication is that the router needs to render the component for things like Links to work. Neither the Router nor the Routes are actually rendered as React Components. If I render the TestHarness with react-test-tree I can access the router on tree.router. That's as far as I can get though. If I do a tree.router.getDOMNode() I get the rendered DOM for the ComponentWrapper, but I can't for the life of me figure out how to get a ref to navbarWrapper.\r\n\r\nHas anyone figured this out?\r\n"},"comment":{"url":"https://api.github.com/repos/QubitProducts/react-test-tree/issues/comments/132821839","html_url":"https://github.com/QubitProducts/react-test-tree/issues/41#issuecomment-132821839","issue_url":"https://api.github.com/repos/QubitProducts/react-test-tree/issues/41","id":132821839,"user":{"login":"yanivtal","id":1707828,"avatar_url":"https://avatars.githubusercontent.com/u/1707828?v=3","gravatar_id":"","url":"https://api.github.com/users/yanivtal","html_url":"https://github.com/yanivtal","followers_url":"https://api.github.com/users/yanivtal/followers","following_url":"https://api.github.com/users/yanivtal/following{/other_user}","gists_url":"https://api.github.com/users/yanivtal/gists{/gist_id}","starred_url":"https://api.github.com/users/yanivtal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yanivtal/subscriptions","organizations_url":"https://api.github.com/users/yanivtal/orgs","repos_url":"https://api.github.com/users/yanivtal/repos","events_url":"https://api.github.com/users/yanivtal/events{/privacy}","received_events_url":"https://api.github.com/users/yanivtal/received_events","type":"User","site_admin":false},"created_at":"2015-08-19T23:10:57Z","updated_at":"2015-08-19T23:10:57Z","body":"Nice! Batman over here with the tricks. Works like a charm."}}