Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/jankyqueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
30 changes: 29 additions & 1 deletion test/module-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
suite["export"](module);