title: Testing Node.js application that uses Kue
body: <p>I would like to test an application that uses <a href="https://github.com/Automattic/kue" rel="nofollow">Kue</a> so that job queue is empty before each test and cleared after each test. Queue should be fully functional and I need to be able to check status of jobs that are already in the queue. </p>
  
  <p>I tried <a href="https://www.npmjs.com/package/mock-kue" rel="nofollow">mock-kue</a> and it worked well until I had to get jobs from the queue and analyze them. I couldn't get it to return jobs by job ID.</p>
  
  <p>Situations that I need to be able to test:</p>
  
  <ol>
  <li>Something happens and there should be a job of a given type in the queue,</li>
  <li>Something happens and produces a job. Something else happens and that job gets removed and replaced with another job (rescheduling or existing job).</li>
  </ol>
  
  <p>Seams straightforward, but I have hard time wrapping my head around the problem. All pointers are welcome.</p>