How can you set path of match with MemoryRouter and Jest? (not location or history) How can you set path of match with MemoryRouter and Jest? (not location or history) reactjs reactjs

How can you set path of match with MemoryRouter and Jest? (not location or history)


You can wrap your <Hello store={store} /> component with <Route ... /> component like:

import React from 'react';import { MemoryRouter, Route } from 'react-router-dom';// later in tests<MemoryRouter initialEntries={['/home']}>        <Route component={props => <HomeComponent {...props} />} path="/home" /> </MemoryRouter>

Then you should have access to proper match object by props.