I'm new to TDD and unit testing my js, and am looking into using the mocha/react shallow renderer to test my React components. My test component looks something like this:
var React = require('react');
var test = React.createClass({
render: function() {
return (
<div>My custom test component ({this.props.testAttribute})</div>
);
},
testFunction: function () {
return true;
}
});
module.exports = test;
So in addition to shallow rendering and making sure the component is rendering the way i need it to (which i can do now), i also want to test testFunction(), and make sure that is behaving as well. How would I go about doing that?