Tested that node errors are returned for badly formed queries

pull/2/head
Louis Chatriot 12 years ago
parent 357d83a2ba
commit 3d506c24bd
  1. 40
      test/db.test.js

@ -313,6 +313,22 @@ describe('Database', function () {
});
});
it('Returns an error if the query is not well formed', function (done) {
d.insert({ hello: 'world' }, function () {
d.find({ $or: { hello: 'world' } }, function (err, docs) {
assert.isDefined(err);
assert.isUndefined(docs);
d.findOne({ $or: { hello: 'world' } }, function (err, doc) {
assert.isDefined(err);
assert.isUndefined(doc);
done();
});
});
});
});
}); // ==== End of 'Find' ==== //
@ -586,6 +602,18 @@ describe('Database', function () {
});
});
it('Returns an error if the query is not well formed', function (done) {
d.insert({ hello: 'world' }, function () {
d.update({ $or: { hello: 'world' } }, { a: 1 }, {}, function (err, nr, upsert) {
assert.isDefined(err);
assert.isUndefined(nr);
assert.isUndefined(upsert);
done();
});
});
});
}); // ==== End of 'Update' ==== //
@ -661,6 +689,18 @@ describe('Database', function () {
});
});
it('Returns an error if the query is not well formed', function (done) {
d.insert({ hello: 'world' }, function () {
d.remove({ $or: { hello: 'world' } }, {}, function (err, nr, upsert) {
assert.isDefined(err);
assert.isUndefined(nr);
assert.isUndefined(upsert);
done();
});
});
});
}); // ==== End of 'Remove' ==== //

Loading…
Cancel
Save