title: Jest testing/mocking Moment in React Native
body: <p>I am trying to make some tests for my React Native component that uses moment.js for a datepicker. I am having trouble testing/mocking moment.js and was wondering if I could get any examples/pointers. The two functions I am trying to test are below:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>setDate = (newDate) =&gt; {
      this.setState({ selectedDate: moment(newDate) });
  }
  
  handleOnPress = () =&gt; {
      this.props.onModalButtonPress(this.state.selectedDate.unix());
  }</code></pre>
  </div>
  </div>
  </p>