I've been trying to test a react+redux application and came across a problem. My reducer expects action of type "FOO" to bo a nested Javascript object, like here:
{
type: "FOO"
data: {
bar: "foo"
}
}
When I passed an object without data field to the reducer in my test, the reducer obviously crashed.
My question is: While implementing/testing reducers can I assume, that action creators have already handled errors and actions of given types are always properly structured, or should handle errors in reducers as well (which might cause a risk of faulty state passed to components and selectors and makes error handling a nightmare)? Or do I miss something?