react-redux-jwt-auth-example
react-redux-jwt-auth-example copied to clipboard
Unit testing components
I was surprised to see that the boilerplate only contained unit tests for the actions, with no test coverage at the component level.
Then I started writing the component tests..
Does anyone have some boilerplate samples that they have gotten to work unit testing the smart components?
I'm brand new to React (this is my first real project) but I really would like to get unit tests working for components. I've spent some time researching it but all the responses were pretty disjointed to me, and I really just want a basic example of how to unit test a component, a component with this stuff at the bottom of it:
reactMixin(TimeBox.prototype, React.addons.LinkedStateMixin);
const mapStateToProps = (state) => ({ edit : state.storeHours.edithours, hours : state.storeHours.hours });
const mapDispatchToProps = (dispatch) => ({ actions : bindActionCreators(actionCreators, dispatch) });
export default connect(mapStateToProps, mapDispatchToProps)(TimeBox);
Currently when I run my test against this component I receive: TypeError: Cannot read property 'LinkedStateMixin' of undefined
This would be akin to testing the ProtectedView component from the boilerplate.
Thank you very much in advance!