summaryrefslogtreecommitdiff
path: root/node_modules/mongoose/test/crash.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/mongoose/test/crash.test.js')
-rw-r--r--node_modules/mongoose/test/crash.test.js36
1 files changed, 36 insertions, 0 deletions
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;
+ }
+ });
+
+}