【发布时间】:2018-03-04 09:45:48
【问题描述】:
尝试用酶浅对redux-form FormSection组件进行单元测试,得到以下错误
Error: FormSection must be inside a component decorated with reduxForm()
避免此错误的最佳选择是什么?
【问题讨论】:
标签: reactjs unit-testing jestjs redux-form enzyme
尝试用酶浅对redux-form FormSection组件进行单元测试,得到以下错误
Error: FormSection must be inside a component decorated with reduxForm()
避免此错误的最佳选择是什么?
【问题讨论】:
标签: reactjs unit-testing jestjs redux-form enzyme
我可以通过在上下文中模拟 reduxForm 来解决此错误,如下所示:
shallow(<MyComponent {...props} />, { context:{ _reduxForm: {}}});
【讨论】: