Skip to content
This repository has been archived by the owner on Sep 12, 2020. It is now read-only.

Unit testing components #37

Open
mikepc opened this issue Dec 12, 2016 · 0 comments
Open

Unit testing components #37

mikepc opened this issue Dec 12, 2016 · 0 comments

Comments

@mikepc
Copy link

mikepc commented Dec 12, 2016

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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant