title: Unit test with jest involving a class instance declared within a vue method
body: <p>I have this logic for temporarily reading and displaying a profile image:</p>
  <pre><code>setTempProfileImage(file) {
        if (file) {
          let reader = new FileReader()
          reader.onload = e =&gt; {
            this.generalInfo.profileImage = e.target.result
          }
          reader.readAsDataURL(file)
        }
      }
  </code></pre>
  <p>where file is a BLOB object (which for testing is an 'empty' blob object).</p>
  <p>But I'm struggling to write a unit test that checks the onload function call and reader.readDataAsURL(file).</p>
  <p>I've got this unit test so far:</p>
  <pre><code>let file = new Blob([&quot;testing&quot;], { type: &quot;application/pdf&quot; });
  wrapper.vm.setTempProfileImage(file)
  wrapper.vm.$nextTick()
  console.log(wrapper.vm.profileImage)
  expect(wrapper.vm.generalInfo.profileImage).toBe(file)
  </code></pre>
  <p>but it simply reads back as 'undefined'</p>