title: Test a callback Function using jest and enzyme in ReactJS?
body: <p>I am new to TDD and I want to test my callback function in my Age component :
  my <strong>Age.js</strong> file is following :</p>
  
  <pre><code>import React, { Component } from "react";
  import { connect } from "react-redux";
  import actions from "../../actions";
  import TextFieldComponent from "../Module/TextFieldComponent";
  
  export class Age extends Component {
  
    ageValueCallBack = age =&gt; {
      console.log("value is : ", age);
      this.props.selectAgeAction(age)
    };
  
    render() {
      const props = {
        onChange: this.ageValueCallBack,
        hintText : 'Eg. 25',
        floatingLabelText: "Age(Years)",
        value : (this.props.usersData) ? this.props.usersData.basic.age : null
      };
      return &lt;TextFieldComponent {...props} /&gt;;
    }
  }
  
  function mapStateToProps({ usersData }) {
    return {
      usersData
    };
  }
  
  export default connect(mapStateToProps, {
    selectAgeAction: actions.selectAgeValue
  })(Age);
  </code></pre>
  
  <p>where my <strong>TextFieldComponent</strong> is following :</p>
  
  <pre><code>import TextField from "material-ui/TextField";
  
  const TextFieldComponent = props =&gt; {
    return (
      &lt;TextField
          onChange={(event, string) =&gt; {
          props.onChange(string)
        }}
        floatingLabelText={props.floatingLabelText || "floatingLabelText"}
        value={props.value || null}
        hintText={props.hintText || "hintText will be here"}
        autoFocus ={true || props.autoFocus}
      /&gt;
    );
  };
  </code></pre>
  
  <p>I want to test <strong>ageValueCallBack</strong> function of Age component but I'm not getting any particular method to reach there.</p>
  
  <p>Any insight will be helpful.</p>
  
  <p>Thanks..</p>