title: Testing if an event has been triggered in NestJS
body: <p>In the project we are building, there is a standard sequence in the workflow.</p>
  <ol>
  <li>Controller receives a request</li>
  <li>Then fires an event through @nestjs/event-emitter</li>
  <li>Event listener listens to it and executes some code depending on the event</li>
  </ol>
  <p>How can we properly test if an event has been triggered but without actually executing the code inside?</p>
  <p>We are using Jest for testing.</p>
  <p>Mocking with Jest doesn't seem to work, because we want to test the actual trigger event and not the result.</p>
  <p>Any suggestions?</p>
  <pre><code>&quot;node&quot;: &quot;16.14.2&quot;
  &quot;@nestjs/event-emitter&quot;: &quot;^1.1.0&quot;,
  &quot;jest&quot;: &quot;^27.5.1&quot;,
  </code></pre>