From 4912000c1e72c1cf28d50c88c740d695cfedfeb7 Mon Sep 17 00:00:00 2001 From: Marcin Jekot Date: Fri, 18 Dec 2015 10:31:49 +0800 Subject: [PATCH] add one more test case for #217 dot in collections --- test/test-find-dot-collection.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/test/test-find-dot-collection.js b/test/test-find-dot-collection.js index 44b130b..d68e7f6 100644 --- a/test/test-find-dot-collection.js +++ b/test/test-find-dot-collection.js @@ -1,16 +1,27 @@ var test = require('./tape') var mongojs = require('../index') var db = mongojs('test', ['test.dot']) +var dbNoCollections = mongojs('test') test('find in dot collection', function (t) { - db['test.dot'].drop(function () { - db['test.dot'].insert({ name: 'dot' }, function (err) { + var collection = db['test.dot'] + testDropInsertAndFind(t, collection) +}) + +test('find in dot collection', function (t) { + var collection = dbNoCollections.collection('test.dot') + testDropInsertAndFind(t, collection) +}) + +function testDropInsertAndFind (t, collection) { + collection.drop(function () { + collection.insert({ name: 'dot' }, function (err) { t.error(err) - db['test.dot'].findOne(function (err, doc) { + collection.findOne(function (err, doc) { t.error(err) t.equal(doc.name, 'dot') t.end() }) }) }) -}) +}