mongojs-hooks
Advanced tools
Comparing version
{ | ||
"name": "mongojs-hooks", | ||
"description": "Wrap monogjs in pre and post hooks", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"main": "./mongojs-hooks", | ||
@@ -14,3 +14,3 @@ "author": { | ||
"dependencies": { | ||
"mongojs": "0.9.x", | ||
"mongojs": "0.18.x", | ||
"fn-hooks": "0.1.x", | ||
@@ -17,0 +17,0 @@ "lodash": "2.4.x" |
require("should"); | ||
var sinon = require("sinon"); | ||
var stream = require("stream"); | ||
var mongo = require("../mongojs-hooks"); | ||
@@ -216,46 +215,3 @@ var mongojs = require("mongojs"); | ||
}); | ||
describe("when streaming", function () { | ||
var findStub; | ||
beforeEach(function () { | ||
//findStub = sinon.stub(mongojs.Collection.prototype, "find").callsArg(1); | ||
}); | ||
afterEach(function () { | ||
//findStub.restore(); | ||
}); | ||
it("with post() hook should get called before next transform in pipeline", function (done) { | ||
var tests = mongo.collection("tests"); | ||
var postStub = sinon.stub(); | ||
tests.post("find", function (next) { | ||
console.log("HERE", arguments); | ||
// mongojs.Collection.prototype.find.calledWith({ test: "property" }).should.be.ok; | ||
// postStub(); | ||
next(); | ||
}); | ||
var transform = stream.Transform({ objectMode: true }); | ||
transform._transform = function (object, enc, next) { | ||
console.log("trans", object); | ||
next(); | ||
}; | ||
// db.collection("tests").find({ test: "property" }, function () { | ||
// postStub.callCount.should.equal(1); | ||
// done(); | ||
// }); | ||
db.collection("tests").find({ test: "property" }) | ||
.pipe(transform) | ||
.on("finish", done); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
23159
-4.39%427
-6.97%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
Updated