title: Mock inner function of a functional component
body: <p>My functional component has a few functions to handle the events from html elements and they have some instructions incompatible with Jest (without adding new libs).</p>
  <p>Is it possible to mock these inner functions (that are not exported)?</p>
  <p>Here's an example:</p>
  <p>Component.js</p>
  <pre><code>export default function MyComponent() {
  
    const setTouchPosition = e =&gt; {
      const canvas = document.getElementById('canvas');
  
      const rect = canvas.getBoundingClientRect();
      // .. a few lines omitted for readability
    };
  
    const draw = e =&gt; {
      const canvas = document.getElementById('canvas');
      const context = canvas.getContext('2d');
      // .. a few lines omitted for readability
    };
  
  
    // a few more lines
  }
  </code></pre>