Skip to content

Commit 5ff31ea

Browse files
author
Jason Walton
committed
Update parallel test to ensure all tasks actually get run.
1 parent 728d2dc commit 5ff31ea

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/parallel.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,15 @@ describe('parallel', () => {
4848
it('should execute tasks concurrently to a limit', () => {
4949
let running = 0;
5050
let maxRunning = 0;
51+
let complete = 0;
52+
5153
let task = () => {
5254
running++;
5355
maxRunning = Math.max(maxRunning, running);
5456

5557
return promiseTools.delay(5)
5658
.then(() => {
59+
complete++;
5760
running--;
5861
});
5962
}
@@ -64,7 +67,8 @@ describe('parallel', () => {
6467

6568
return promiseTools.parallelLimit(tasks, 3)
6669
.then(() => {
67-
expect(maxRunning).to.equal(3);
70+
expect(maxRunning, "max concurrent tasks").to.equal(3);
71+
expect(complete, "tasks run").to.equal(10);
6872
});
6973
});
7074

0 commit comments

Comments
 (0)