queue-batch
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "queue-batch", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Basic batch processing queue library", | ||
@@ -13,3 +13,14 @@ "main": "index.js", | ||
"tape": "^4.8.0" | ||
} | ||
}, | ||
"directories": { | ||
"test": "tests" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/DivineGod/queue-batch.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/DivineGod/queue-batch/issues" | ||
}, | ||
"homepage": "https://github.com/DivineGod/queue-batch#readme" | ||
} |
@@ -139,1 +139,41 @@ /* @flow */ | ||
}); | ||
test('handle error from concurrent function', (t) => { | ||
t.plan(11); | ||
var testItem = 'hello, world'; | ||
var testArray = [testItem, 1, testItem]; | ||
var testError = 'error'; | ||
var testDateLower = new Date(); | ||
var testDateUpper = new Date(testDateLower); | ||
var timeoutValue = 100.0 | ||
var testCallback = (item, cb) => { | ||
if (item === 1) { | ||
t.equal(item, 1, 'Correct item'); | ||
return setTimeout(() => cb(testError), timeoutValue); | ||
} | ||
t.equal(item, testItem, 'Correct item'); | ||
setTimeout(cb, timeoutValue); | ||
}; | ||
var secondsEpsilon = 50.0; | ||
var processor = new Processor(testCallback, 2); | ||
processor.on('empty', () => { | ||
var now = new Date(); | ||
testDateLower.setMilliseconds(testDateLower.getMilliseconds() + 3*timeoutValue); | ||
testDateUpper.setMilliseconds(testDateUpper.getMilliseconds() + 3*timeoutValue + secondsEpsilon); | ||
t.ok(now.getTime() >= testDateLower.getTime()); | ||
t.ok(now.getTime() <= testDateUpper.getTime()); | ||
t.end(); | ||
}); | ||
processor.on('error', (error) => { | ||
t.equal(error, testError, 'correct error'); | ||
}); | ||
processor.concat(testArray); | ||
processor.concat(testArray); | ||
t.equal(processor.concurrency, 2, 'correct concurrency'); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
17184
186
0
0
0