Cleanup
This commit is contained in:
47
node_modules/kareem/test/examples.test.js
generated
vendored
47
node_modules/kareem/test/examples.test.js
generated
vendored
@@ -17,7 +17,10 @@ describe('pre hooks', function() {
|
||||
|
||||
it('runs without any hooks specified', function(done) {
|
||||
hooks.execPre('cook', null, function() {
|
||||
// ...
|
||||
// acquit:ignore:start
|
||||
done();
|
||||
// acquit:ignore:end
|
||||
});
|
||||
});
|
||||
|
||||
@@ -34,7 +37,9 @@ describe('pre hooks', function() {
|
||||
|
||||
hooks.execPre('cook', null, function() {
|
||||
assert.equal(1, count);
|
||||
// acquit:ignore:start
|
||||
done();
|
||||
// acquit:ignore:end
|
||||
});
|
||||
});
|
||||
|
||||
@@ -55,7 +60,9 @@ describe('pre hooks', function() {
|
||||
hooks.execPre('cook', null, function() {
|
||||
assert.equal(1, count1);
|
||||
assert.equal(1, count2);
|
||||
// acquit:ignore:start
|
||||
done();
|
||||
// acquit:ignore:end
|
||||
});
|
||||
});
|
||||
|
||||
@@ -78,7 +85,9 @@ describe('pre hooks', function() {
|
||||
assert.equal(null, error);
|
||||
assert.equal(1, count1);
|
||||
assert.equal(1, count2);
|
||||
// acquit:ignore:start
|
||||
done();
|
||||
// acquit:ignore:end
|
||||
});
|
||||
});
|
||||
|
||||
@@ -102,7 +111,9 @@ describe('pre hooks', function() {
|
||||
assert.equal(null, error);
|
||||
assert.equal(3, obj.bacon);
|
||||
assert.equal(4, obj.eggs);
|
||||
// acquit:ignore:start
|
||||
done();
|
||||
// acquit:ignore:end
|
||||
});
|
||||
});
|
||||
|
||||
@@ -140,7 +151,9 @@ describe('pre hooks', function() {
|
||||
assert.equal(3, obj.bacon);
|
||||
assert.equal(4, obj.eggs);
|
||||
assert.equal(false, obj.waffles);
|
||||
// acquit:ignore:start
|
||||
done();
|
||||
// acquit:ignore:end
|
||||
});
|
||||
});
|
||||
|
||||
@@ -162,7 +175,9 @@ describe('pre hooks', function() {
|
||||
|
||||
hooks.execPre('cook', obj, function() {
|
||||
assert.equal(3, obj.bacon);
|
||||
// acquit:ignore:start
|
||||
done();
|
||||
// acquit:ignore:end
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -193,7 +208,9 @@ describe('post hooks', function() {
|
||||
assert.ifError(error);
|
||||
assert.equal(1, eggs);
|
||||
assert.equal(2, bacon);
|
||||
// acquit:ignore:start
|
||||
done();
|
||||
// acquit:ignore:end
|
||||
});
|
||||
});
|
||||
|
||||
@@ -220,7 +237,33 @@ describe('post hooks', function() {
|
||||
assert.ok(execed.second);
|
||||
assert.equal(1, eggs);
|
||||
assert.equal(2, bacon);
|
||||
// acquit:ignore:start
|
||||
done();
|
||||
// acquit:ignore:end
|
||||
});
|
||||
});
|
||||
|
||||
/* You can also return a promise from your post hooks instead of calling
|
||||
* `next()`. When the returned promise resolves, kareem will kick off the
|
||||
* next middleware.
|
||||
*/
|
||||
it('supports returning a promise', function(done) {
|
||||
hooks.post('cook', function(bacon) {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
this.bacon = 3;
|
||||
resolve();
|
||||
}, 100);
|
||||
});
|
||||
});
|
||||
|
||||
var obj = { bacon: 0 };
|
||||
|
||||
hooks.execPost('cook', obj, obj, function() {
|
||||
assert.equal(obj.bacon, 3);
|
||||
// acquit:ignore:start
|
||||
done();
|
||||
// acquit:ignore:end
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -271,7 +314,9 @@ describe('wrap()', function() {
|
||||
assert.equal('no', obj.tofu);
|
||||
|
||||
assert.equal(obj, result);
|
||||
// acquit:ignore:start
|
||||
done();
|
||||
// acquit:ignore:end
|
||||
});
|
||||
|
||||
hooks.wrap(
|
||||
@@ -343,7 +388,9 @@ describe('createWrapper()', function() {
|
||||
assert.equal('no', obj.tofu);
|
||||
|
||||
assert.equal(obj, result);
|
||||
// acquit:ignore:start
|
||||
done();
|
||||
// acquit:ignore:end
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user