Test with no or empty projection

pull/2/head
Louis Chatriot 10 years ago
parent b6fe7c8541
commit 6841ea862a
  1. 36
      test/cursor.test.js

@ -652,6 +652,42 @@ describe('Cursor', function () {
}); // ===== End of 'Sorting' ===== }); // ===== End of 'Sorting' =====
describe.only('Projections', function () {
beforeEach(function (done) {
// We don't know the order in which docs wil be inserted but we ensure correctness by testing both sort orders
d.insert({ age: 5, name: 'Jo', planet: 'B' }, function (err) {
d.insert({ age: 57, name: 'Louis', planet: 'R' }, function (err) {
d.insert({ age: 52, name: 'Grafitti', planet: 'C' }, function (err) {
d.insert({ age: 23, name: 'LM', planet: 'S' }, function (err) {
d.insert({ age: 89, planet: 'Earth' }, function (err) {
return done();
});
});
});
});
});
});
it('Takes all results if no projection or empty object given', function (done) {
var cursor = new Cursor(d, {});
cursor.exec(function (err, docs) {
assert.isNull(err);
docs.length.should.equal(5);
cursor.projection({});
cursor.exec(function (err, docs) {
assert.isNull(err);
docs.length.should.equal(5);
done();
});
});
});
}); // ==== End of 'Projections' ====
}); });

Loading…
Cancel
Save