📅  最后修改于: 2022-03-11 15:03:29.503000             🧑  作者: Mango
const mockHistoryPush = jest.fn();
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useHistory: () => ({
push: mockHistoryPush,
}),
useLocation: () => ({
pathname: "/"
})
}));