diff --git a/lib/jankyqueue.js b/lib/jankyqueue.js index 3460158..25d3554 100644 --- a/lib/jankyqueue.js +++ b/lib/jankyqueue.js @@ -34,6 +34,8 @@ var Queue = function(max) { }; run = function(fn, args, callback) { + if (!callback) callback = function noop() {}; + var wrapped = function() { var results = arguments, next; diff --git a/package.json b/package.json index 952a170..4d81ac3 100644 --- a/package.json +++ b/package.json @@ -37,10 +37,5 @@ "url": "git://github.com/e14n/jankyqueue.git" }, - "licenses": [ - { - "type": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" - } - ] + "license": "Apache-2.0" } diff --git a/test/module-test.js b/test/module-test.js index 46c09bd..6168b73 100644 --- a/test/module-test.js +++ b/test/module-test.js @@ -120,8 +120,36 @@ suite.addBatch({ assert.ifError(err); } } + }, + "and we create a third instance": { + topic: function(Queue) { + return new Queue(64); + }, + "it works": function(q) { + assert.ok(q); + }, + "and we enqueue some operations and don't specify a callback": { + topic: function(q) { + var i = 0, + counter = 10, + decr = function(j, cb) { + // do something with j + counter--; + cb(null); + }; + + for (i = 0; i < 100; i++) { + q.enqueue(decr, [i]); + } + + setTimeout(this.callback, 1000); + }, + "it works": function(err) { + assert.ifError(err); + } + } } } }); -suite["export"](module); \ No newline at end of file +suite["export"](module);