Skip to content

Commit

Permalink
All tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
louischatriot committed Jan 19, 2016
1 parent 7c25401 commit d446bdb
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions test/db.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ describe('Database', function () {
}); // ==== End of 'Insert' ==== //


describe.only('#getCandidates', function () {
describe('#getCandidates', function () {

it('Can use an index to get docs with a basic match', function (done) {
d.ensureIndex({ fieldName: 'tf' }, function (err) {
Expand Down Expand Up @@ -539,12 +539,23 @@ describe('Database', function () {
assert.isNull(err);
assert.isNull(doc);

d.findOne({}, function (err, doc) {
assert.isNull(err);
assert.isNull(doc);
d.on('compaction.done', function () {
// After compaction, no more mention of the document, correctly removed
var datafileContents = fs.readFileSync(testDb, 'utf8');
datafileContents.split('\n').length.should.equal(2);
assert.isNull(datafileContents.match(/world/));

done();
// New datastore on same datafile is empty
var d2 = new Datastore({ filename: testDb, autoload: true });
d2.findOne({}, function (err, doc) {
assert.isNull(err);
assert.isNull(doc);

done();
});
});

d.persistence.compactDatafile();
});
}, 101);
});
Expand Down

0 comments on commit d446bdb

Please sign in to comment.