Alex
Alex

Reputation: 9429

Unit test FormSection component

Trying to unit test a redux-form FormSection component with enzyme shallow, and get the following error
Error: FormSection must be inside a component decorated with reduxForm()

What is the best option to avoid this error?

Upvotes: 0

Views: 453

Answers (1)

Alex
Alex

Reputation: 9429

I was able to get around this error by mocking the reduxForm in the context as follows:
shallow(<MyComponent {...props} />, { context:{ _reduxForm: {}}});

Upvotes: 3

Related Questions