diff --git a/Gruntfile.js b/Gruntfile.js index 1dfa489..2c4fea7 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -14,8 +14,7 @@ module.exports = function (grunt) { reporter: 'spec', timeout: 20000 }, - // src: ['test/**/*.js'] - src: ['test/schedule/schedule.spec.js'] + src: ['test/**/*.js'] } }, jshint: { diff --git a/README.md b/README.md index f4a81d2..44bb2ab 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# kue-scheduler(Unstable) +# kue-scheduler [![Build Status](https://travis-ci.org/lykmapipo/kue-scheduler.svg?branch=master)](https://travis-ci.org/lykmapipo/kue-scheduler) [![Dependency Status](https://img.shields.io/david/lykmapipo/kue-scheduler.svg?style=flat)](https://david-dm.org/lykmapipo/kue-scheduler) @@ -10,6 +10,8 @@ Scheduling API is heavily inspired and borrowed from [agenda](https://github.com *Note!: expiry key notification are now enabled by default, if provided kue options has a permission to do so unless explicit disabled by passing `skipConfig` option when creating `kue` instance* +*Note!: kue-scheduler v0.6.0 is a refactored version of previous kue-scheduler to allow redis data structure and schedule queue best practice. API is the same but some of internal working may not work as previous ones* + ## Requirements - Redis 2.8.0 or higher. diff --git a/test/capability.spec.js b/test/capability.spec.js index 10beeb4..53d2b31 100644 --- a/test/capability.spec.js +++ b/test/capability.spec.js @@ -20,7 +20,9 @@ describe('Queue Scheduling Capabilities', function () { }); after(function (done) { - Queue.shutdown(done); + Queue.clear(function ( /*error,results*/ ) { + Queue.shutdown(done); + }); }); diff --git a/test/instatiation.spec.js b/test/instatiation.spec.js index 74c4edc..bba3810 100644 --- a/test/instatiation.spec.js +++ b/test/instatiation.spec.js @@ -10,8 +10,10 @@ var Queue; describe('Queue Job Scheduler & Listener', function () { afterEach(function (done) { - Queue.shutdown(done); - Queue = null; + Queue.clear(function ( /*error,results*/ ) { + Queue.shutdown(done); + Queue = null; + }); }); it('should be able to instantiate kue-scheduler with custom options', diff --git a/test/job_builder.spec.js b/test/job_builder.spec.js index 8f9eaaf..1361e9a 100644 --- a/test/job_builder.spec.js +++ b/test/job_builder.spec.js @@ -15,7 +15,9 @@ describe('Queue JobBuilder', function () { }); after(function (done) { - Queue.shutdown(done); + Queue.clear(function ( /*error,results*/ ) { + Queue.shutdown(done); + }); }); diff --git a/test/non_default_db.spec.js b/test/non_default_db.spec.js index 06ef549..2b2296d 100644 --- a/test/non_default_db.spec.js +++ b/test/non_default_db.spec.js @@ -6,32 +6,9 @@ var _ = require('lodash'); var path = require('path'); var kue = require(path.join(__dirname, '..', 'index')); var faker = require('faker'); -var async = require('async'); var Queue; var redisPublishClient; -//TODO: Clean up the cleanup. - -//redis client for database cleanups -var redisCleanUpClient = kue.redis.createClientFactory({ - redis: { - db: 2 - } -}); - -function cleanup(callback) { - redisCleanUpClient - .keys('q*', function (error, rows) { - if (error) { - callback(error); - } else { - async.each(rows, function (row, next) { - redisCleanUpClient.del(row, next); - }, callback); - } - }); -} - describe('Queue non-default database', function () { beforeEach(function (done) { @@ -44,9 +21,9 @@ describe('Queue non-default database', function () { done(); }); - afterEach(function (done) { - Queue.shutdown(function () { - cleanup(done); + after(function (done) { + Queue.clear(function ( /*error,results*/ ) { + Queue.shutdown(done); }); }); diff --git a/test/schedule/messages.spec.js b/test/schedule/messages.spec.js index 3dcdcf8..566363c 100644 --- a/test/schedule/messages.spec.js +++ b/test/schedule/messages.spec.js @@ -16,7 +16,9 @@ describe('Queue#redis messages', function () { }); after(function (done) { - Queue.shutdown(done); + Queue.clear(function ( /*error,results*/ ) { + Queue.shutdown(done); + }); }); it('should be able to filter unrelated redis published messages',