在编写依赖于路由的组件的测试时:
const history = createMemoryHistory('/');
const wrapper = mount(<App history={history} />);
我收到大量警告:
(node:24823) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): TypeError: Cannot read property 'history' of undefined
(node:24823) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:24823) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): TypeError: Cannot read property 'history' of undefined
我不知道如何消除它们。愿任何人帮忙吗?
我的应用将此history
媒体资源转发至<Router />