From 686106d544ecc3b6ffd4db2b665d3bc879a58d8c Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 24 Sep 2012 16:22:07 -0400 Subject: ok --- node_modules/mongoose/test/crash.test.js | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 node_modules/mongoose/test/crash.test.js (limited to 'node_modules/mongoose/test/crash.test.js') diff --git a/node_modules/mongoose/test/crash.test.js b/node_modules/mongoose/test/crash.test.js new file mode 100644 index 0000000..67e6c86 --- /dev/null +++ b/node_modules/mongoose/test/crash.test.js @@ -0,0 +1,36 @@ + +// GH-407 + +var start = require('./common') + , mongoose = start.mongoose + , should = require('should') + +exports['test mongodb crash with invalid objectid string'] = function () { + var db = mongoose.createConnection("mongodb://localhost/test-crash"); + + var IndexedGuy = new mongoose.Schema({ + name: { type: String } + }); + + var Guy = db.model('Guy', IndexedGuy); + Guy.find({ + _id: { + $in: [ + '4e0de2a6ee47bff98000e145', + '4e137bd81a6a8e00000007ac', + '', + '4e0e2ca0795666368603d974'] + } + }, function (err) { + db.close(); + + // should is acting strange + try { + should.strictEqual(err.message, "Invalid ObjectId"); + } catch (er) { + console.error(err); + throw er; + } + }); + +} -- cgit v1.2.3-70-g09d2