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
In your component use hooks as below
import {useLocation} from 'react-router';
const location = useLocation()
In your test spy on reactRouter Object as below
import routeData from 'react-router';
const mockLocation = {
pathname: '/welcome',
hash: '',
search: '',
state: ''
}
beforeEach(() => {
jest.spyOn(routeData, 'useLocation').mockReturnValue(mockLocation)
});