Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

queue-batch

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

queue-batch - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

15

package.json
{
"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');
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc