title: How to mock FileReader using jest
body: <p>I need to mock a function that uses <code>FileReader</code> using jest.
  Specifically the function <code>readAsBinaryString</code> and <code>onload</code>.</p>
  
  <p>I've created some code:</p>
  
  <pre><code>FileReader.readAsBinaryString = () =&gt; mock.mockReturnValue(null);
  </code></pre>
  
  <p>But it doesn't work.
  How can I mock <code>FileReader</code> and your functions using jest?</p>
  
  <p>Function to test:</p>
  
  <pre><code>handleFileUpload(event) {
    let reader = new FileReader();
    let file = event.target.files[0];
  
    reader.readAsBinaryString(file);
  
    reader.onload = () =&gt; {
      let base64String = btoa(reader.result);
      this.object.image = 
    };
  },
  </code></pre>