From 542acbcbe743a76bd01ee13fb90c0b08e05342ad Mon Sep 17 00:00:00 2001 From: Louis Chatriot Date: Sun, 20 Oct 2013 12:58:26 +0200 Subject: [PATCH] All tests pass --- lib/datastore.js | 14 -------------- test/indexes.test.js | 6 ++++-- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/lib/datastore.js b/lib/datastore.js index 5b0acee..512f4f1 100644 --- a/lib/datastore.js +++ b/lib/datastore.js @@ -490,19 +490,5 @@ Datastore.prototype.remove = function () { }; -/* -var db = new Datastore({ inMemoryOnly: true }) - -db.ensureIndex({ fieldName: 'tag' }); - -db.insert({ tag: ['a', 'b', 'c'] }, function () { - db.find({ tag: 'b' }, function (err, item) { - console.log(err); - console.log(item); - }); -}); -*/ - - module.exports = Datastore; \ No newline at end of file diff --git a/test/indexes.test.js b/test/indexes.test.js index 7060c71..fc881df 100644 --- a/test/indexes.test.js +++ b/test/indexes.test.js @@ -121,7 +121,7 @@ describe('Indexes', function () { assert.deepEqual(idx.tree.search('bloup'), []); }); - describe.only('Array fields', function () { + describe('Array fields', function () { it('Inserts one entry per array element in the index', function () { var obj = { tf: ['aa', 'bb'], really: 'yeah' } @@ -199,7 +199,7 @@ describe('Indexes', function () { it('If a unique constraint is violated when inserting an array key, roll back all inserts before the key', function () { var obj = { tf: ['aa', 'bb'], really: 'yeah' } - , obj2 = { tf: ['cc', 'dd', 'aa'], yes: 'indeed' } + , obj2 = { tf: ['cc', 'dd', 'aa', 'ee'], yes: 'indeed' } , idx = new Index({ fieldName: 'tf', unique: true }) ; @@ -209,6 +209,7 @@ describe('Indexes', function () { idx.getMatching('bb').length.should.equal(1); idx.getMatching('cc').length.should.equal(0); idx.getMatching('dd').length.should.equal(0); + idx.getMatching('ee').length.should.equal(0); (function () { idx.insert(obj2); }).should.throw(); idx.getAll().length.should.equal(2); @@ -216,6 +217,7 @@ describe('Indexes', function () { idx.getMatching('bb').length.should.equal(1); idx.getMatching('cc').length.should.equal(0); idx.getMatching('dd').length.should.equal(0); + idx.getMatching('ee').length.should.equal(0); }); }); // ==== End of 'Array fields' ==== //