Until now, in unit tests, react router match params were retrieved as props of component. So testing a component considering some specific match, with specific url parameter
If using the enzyme library, I found a much less verbose way to solve the problem (using this section from the react-router-dom docs):
import React from 'react'
import { shallow } from 'enzyme'
import { MemoryRouter } from 'react-router-dom'
import Navbar from './Navbar'
it('renders Navbar component', () => {
expect(
shallow(
)
).toMatchSnapshot()
})