2017-09-22 90 views
0

試圖單元測試與酶淺一Redux的形式FormSection成分,並獲得以下錯誤
Error: FormSection must be inside a component decorated with reduxForm() 單元測試FormSection組件

什麼是避免這種錯誤的最佳選擇?

回答

3

我能夠在上下文嘲諷reduxForm來解決這個錯誤,如下所示:
shallow(<MyComponent {...props} />, { context:{ _reduxForm: {}}});