How to mock useHistory hook in jest?
问题 I am using UseHistory hook in react router v5.1.2 with typescript? When running unit test, I have got issue. TypeError: Cannot read property 'history' of undefined. import { mount } from 'enzyme'; import React from 'react'; import {Action} from 'history'; import * as router from 'react-router'; import { QuestionContainer } from './QuestionsContainer'; describe('My questions container', () => { beforeEach(() => { const historyHistory= { replace: jest.fn(), length: 0, location: { pathname: '',