Remove without options arg tested

pull/2/head
Louis Chatriot 11 years ago
parent 44459fa38d
commit 6ff7709bc2
  1. 27
      test/db.test.js

@ -979,7 +979,7 @@ describe('Database', function () {
}); // ==== End of 'Update' ==== // }); // ==== End of 'Update' ==== //
describe.only('Remove', function () { describe('Remove', function () {
it('Can remove multiple documents', function (done) { it('Can remove multiple documents', function (done) {
var id1, id2, id3; var id1, id2, id3;
@ -1124,6 +1124,31 @@ describe('Database', function () {
}); });
}); });
}); });
it('Can remove without the options arg (will use defaults then)', function (done) {
d.insert({ a:1, hello: 'world' }, function (err, doc1) {
d.insert({ a:2, hello: 'earth' }, function (err, doc2) {
d.insert({ a:5, hello: 'pluton' }, function (err, doc3) {
d.remove({ a: 2 }, function (err, nr) {
assert.isNull(err);
nr.should.equal(1);
d.find({}, function (err, docs) {
var d1 = _.find(docs, function (doc) { return doc._id === doc1._id })
, d2 = _.find(docs, function (doc) { return doc._id === doc2._id })
, d3 = _.find(docs, function (doc) { return doc._id === doc3._id })
;
d1.a.should.equal(1);
assert.isUndefined(d2);
d3.a.should.equal(5);
done();
});
});
});
});
});
});
}); // ==== End of 'Remove' ==== // }); // ==== End of 'Remove' ==== //

Loading…
Cancel
Save