Skip to content

Commit

Permalink
Fix coverage. Closes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
Eran Hammer committed Sep 5, 2014
1 parent ee398d6 commit 0e94d97
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/index.js
Expand Up @@ -48,13 +48,14 @@ exports.parallel = function (array, method, callback) {
}
else {
var count = 0;
var errored = false;

var done = function (err) {

if (callback) {
if (!errored) {
if (err) {
errored = true;
callback(err);
callback = null;
}
else {
count += 1;
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "items",
"description": "Bare minimum async methods",
"version": "1.0.1",
"version": "1.0.2",
"repository": "git://github.com/hapijs/items",
"main": "index",
"keywords": [
Expand Down
7 changes: 6 additions & 1 deletion test/index.js
Expand Up @@ -147,7 +147,12 @@ describe('Items', function () {

expect(err).to.equal('error');
expect(called).to.deep.equal([1]);
done();

setTimeout(function () {

expect(called).to.deep.equal([1, 4, 2, 5]);
done();
}, 6);
});
});
});
Expand Down

0 comments on commit 0e94d97

Please sign in to comment.