From 12d92b63da51e9e50b5e233570037c145e2ffd6b Mon Sep 17 00:00:00 2001 From: Louis Chatriot Date: Thu, 23 May 2013 12:14:52 +0200 Subject: [PATCH] Tests ready --- test/model.test.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/model.test.js b/test/model.test.js index a0f1d7c..3624395 100644 --- a/test/model.test.js +++ b/test/model.test.js @@ -426,6 +426,14 @@ describe('Model', function () { model.match({ number: 5, data: { tags: ['node', 'js', 'db'] } }, { "data.tags": 'j' }).should.equal(false); }); + it('Nested objects are deep-equality matched and not treated as sub-queries', function () { + model.match({ a: { b: 5 } }, { a: { b: 5 } }).should.equal(true); + model.match({ a: { b: 5, c: 3 } }, { a: { b: 5 } }).should.equal(false); + + model.match({ a: { b: 5 } }, { a: { b: { $lt: 10 } } }).should.equal(false); + model.match({ a: { b: 5 } }, { a: { $or: { b: 10, b: 5 } } }).should.equal(false); + }); + });