import { RouteComponentProps } from 'react-router-dom'; import { Omit } from 'react-redux'; interface IProps { match: RouteComponentProps['match']; location: Omit['location'], 'state'>; history: { length: RouteComponentProps['history']['length']; action: RouteComponentProps['history']['action']; location: RouteComponentProps['history']['location']; }; } export const createMockRouteComponentProps = (props: IProps): RouteComponentProps => ({ location: { state: {}, ...props.location }, match: { ...props.match }, history: { push: () => null, replace: () => null, createHref: () => '', block: () => () => null, go: () => null, goBack: () => null, goForward: () => null, listen: () => () => null, location: { state: {}, ...props.history.location }, ...props.history } });