summaryrefslogtreecommitdiff
path: root/test/during.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/during.js')
-rw-r--r--test/during.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/during.js b/test/during.js
index 13db8b3..e0636e5 100644
--- a/test/during.js
+++ b/test/during.js
@@ -34,6 +34,22 @@ describe('during', function() {
);
});
+ it('during canceling', (done) => {
+ let counter = 0;
+ async.during(
+ cb => cb(null, true),
+ cb => {
+ counter++
+ cb(counter === 2 ? false : null);
+ },
+ () => { throw new Error('should not get here')}
+ );
+ setTimeout(() => {
+ expect(counter).to.equal(2);
+ done();
+ }, 10)
+ })
+
it('doDuring', function(done) {
var call_order = [];
@@ -95,4 +111,36 @@ describe('during', function() {
}
);
});
+
+ it('doDuring canceling', (done) => {
+ let counter = 0;
+ async.doDuring(
+ cb => {
+ counter++
+ cb(counter === 2 ? false : null);
+ },
+ cb => cb(null, true),
+ () => { throw new Error('should not get here')}
+ );
+ setTimeout(() => {
+ expect(counter).to.equal(2);
+ done();
+ }, 10)
+ })
+
+ it('doDuring canceling in test', (done) => {
+ let counter = 0;
+ async.doDuring(
+ cb => {
+ counter++
+ cb(null, counter);
+ },
+ (n, cb) => cb(n === 2 ? false : null, true),
+ () => { throw new Error('should not get here')}
+ );
+ setTimeout(() => {
+ expect(counter).to.equal(2);
+ done();
+ }, 10)
+ })
});