From 29db19762534685acaf19f43b4e8dca362f1e05f Mon Sep 17 00:00:00 2001 From: Louis Chatriot Date: Mon, 15 Jul 2013 20:53:50 +0200 Subject: [PATCH] Basic browser test framework ok --- browser-version/test/index.html | 22 ++++++++++++++++++++++ browser-version/test/nedb-browser.js | 24 ++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 browser-version/test/index.html create mode 100644 browser-version/test/nedb-browser.js diff --git a/browser-version/test/index.html b/browser-version/test/index.html new file mode 100644 index 0000000..219f1a6 --- /dev/null +++ b/browser-version/test/index.html @@ -0,0 +1,22 @@ + + + + + Mocha tests for NeDB + + + +
+ + + + + + + + + diff --git a/browser-version/test/nedb-browser.js b/browser-version/test/nedb-browser.js new file mode 100644 index 0000000..4fc2e01 --- /dev/null +++ b/browser-version/test/nedb-browser.js @@ -0,0 +1,24 @@ +var assert = chai.assert; +chai.should(); + + +describe('Basic test', function () { + + it('Can create a database, insert some docs and query them', function () { + var db = new Nedb(); + + // Can use callback-less syntax since commands are queued + db.insert({ a: 4 }); + db.insert({ a: 40 }); + db.insert({ a: 400 }); + db.find({ a: { $gt: 36 } }, function (err, docs) { + docs.length.should.equal(2); + + db.find({ a: { $lt: 36 } }, function (err, docs) { + docs.length.should.equal(1); + docs[0].a.should.equal(4); + }); + }); + }); + +});