Mock kue in tests
mock-kue is a small mocking library for kue. It mocks out
process functions in kue, while maintaining the jobs in an internal array. You can then inspect the job count and run them at any given time. No connection to redis will be made by kue.
npm install mock-kue
To use, simply require the library:
You can inspect the job count as follows:
var kue =jobs = kue;jobs;kue; // -> '1'
To process the jobs in the queue, you need to call the
returns a promise. The promise will be fulfilled once all the jobs are done processing. Here's an example:
To clear a job, call the
jobs;kue; // -> '1'kueclear;kue; // -> '0'
To get the access to created jobs, call the
jobs;jobs;kue; // -> '2'kue; // -> rturns the array of created jobs
Copyright (c) 2014 built.io team. This software is licensed under the MIT License.