title: Testing function that starts file download with jest
body: <p>I'm trying to test this function with JEST library (I'm using also enzyme in the project), but I completely stuck. </p>
  
  <p>Describing this function in a few words, I use it to export previously prepared data. I machine some data and then pass it in the form of a single string, which this func wraps into a single text file and starts a download.</p>
  
  <p>Mostly, it's csv, tsv and text.</p>
  
  <pre><code>/**
   * Function creating text file and starting download process
   *
   * @param name - file name
   * @param extension - file extension
   * @param content - file content
   */
  export const downloadTextFile = (name: string, extension: string, content: string) =&gt; {
      const link = document.createElement('a');
      link.className = 'download-helper';
      link.download = name + '.' + extension;
      link.href = `data:application/${extension},` + escape(content);
      link.click();
  };
  </code></pre>
  
  <p>I want to develop good testing habits, so I'm also trying to understand edge cases like this one here. Any tips on how to start it?</p>
  
  <p></p>