title: How to execute tests after an event
body: <p>I want to test some functions that require a Discord.js Client to be "ready", but I don't find how to make Jest run my tests after an event. I tried moving the tests in a function like</p>
  
  <pre><code>client.on("ready", () =&gt; {
    test(...);
  })
  </code></pre>
  
  <p>but when I run <code>npm test</code> it detects 0 tests.
  I also tried to write the <code>client.on</code> function inside the tests but it doesn't detect the <code>expect</code> and passes without checking anything.</p>
  
  <pre><code>test("sample", () =&gt; {
    client.on("ready", () =&gt; {
      expect(...);
    })
  })
  </code></pre>
  
  <p>I tried looking at the <a href="https://facebook.github.io/jest/docs/en/getting-started.html" rel="nofollow noreferrer">docs</a> but I didn't find anything.
  Can somebody help me?</p>