You can't directly render
Routes, but a component with
Router that uses routes inside. The answer you pointed to has the complete solution.
You will probably also need to change the
browserHistory under test environment to use a different
history that works on node. Old v3 docs:
As a side note, what's the point of testing
Route which I assume is already tested in the library itself? Perhaps your test should focus on your route components: do they render what they should based on route params? Those params you can easily mock in your tests because they're just props.
I'm telling you this because in my experience understanding what to test was as important as learning how to test. Hope it helps :)
- Testing React Router with Jest and Enzyme
- Testing debounced function in React component with Jest and Enzyme
- Testing react router v4 with jest enzyme
- React testing with Jest and Enzyme (in Symfony) got "Syntax Error: Unexpected token import"
- React testing state of component with Jest and Enzyme
- Getting started testing React components with Enzyme and Jest
- testing custom react methods with jest and enzyme
- Testing react app with jest and enzyme token problem
- React testing with Jest and Enzyme @react-google-maps/api returns TypeError: Cannot read property 'maps' of undefined
- Testing component function in React with Enzyme and Jest
- Faced error during testing with Jest and Enzyme in React
- How to test a className with the Jest and React testing library
- How to mock React component methods with jest and enzyme
- Testing with React's Jest and Enzyme when simulated clicks call a function that calls a promise
- Testing with React's Jest and Enzyme when async componentDidMount
- Testing react-router v4 with Jest and Enzyme
- How to read console.log from a mounted component with Enzyme and Jest in Create React App
- _this.store.getState is not a function when testing react component with enzyme and mocha
- Testing component with react-router v4, Jest and Enzyme
- how can I test if useState hook has been called with jest and react testing library?
- How to test React Router params with Redux and enzyme
- Testing react context with jest and react-testing-library
- Unit test method that calls clearInterval with Jest and Enzyme on React
- How to test redux state update with react testing library and jest
- testing click behavior on React Router Links with Enzyme
- Testing React Async with Jest and create-react-app
- Testing react-router Redirects with Jest and Enzyme
- TypeError: dispatch is not a function when testing with react-create-app jest and enzyme
- Testing Material UI Component with Jest and Enzyme
- Testing components that contain react router Link with Enzyme
More Query from same tag
- Type error while using antd Button with TypeScript
- Cypress: How to save CSS color to a variable?
- How to style classes in React
- Mouseup event not getting triggered when component is dropped using React-dnd
- Change size of FontAwesomeIcon
- How to get axios post data request on nodeJs
- Sorting number with comma in react-bootstrap-table2
- useReducer Cannot set properties of undefined after second attempt to edit the value
- Getting CORS error when using PassportJS for Google OAuth in React/Express
- Regex for input with numbers and commas
- How do I override the defaultValues in useForm and maintain the isDirty function?
- Infinite autoplay slider ends prematurely, and doesn't infinitely loop
- Sharpspring script not loading consistently on a Gatsby page
- Preloading getServerSideProps data with Next.js?
- Overriding children prop in React with Typescript 3.5+
- How to horizontally center a component while there are other components in the same row?
- Problem in implementing hardcoded Auth in Reactjs
- Single ant upload list item only
- Why do I need import React statement even if I don't use React explicitly?
- Deleting an item in ReactJS
- TypeError: wrapper.exists is not a function && TypeError: wrapper.find is not a function
- How to pass all props in one variable in React?
- FullCalendar React - How to use selectConstraint With Background Events of Display Background & Inverse
- VideoJS currentTime() always returning 0
- React v4 and Redux: Update URL after API call to show new route?
- Fetch data from api(RESTful) db(mongodb) according to user input
- Phone format in React
- How to nest children components into parent and export them?
- Unknown error acquiring position GeolocationPositionError code 2 - Firefox Linux Mint
- react google maps node module map style loads empty object, not json