Skip to content

Commit

Permalink
test: add coverage for findOne(ObjectId)
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Sep 30, 2022
1 parent a5c6f8e commit a40844e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/query.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4138,7 +4138,12 @@ describe('Query', function() {
const Test = db.model('Test', testSchema);
const _id = new mongoose.Types.ObjectId();

const q = Test.find(_id);
let q = Test.find(_id);

assert.ok(q.getFilter()._id instanceof mongoose.Types.ObjectId);
assert.equal(q.getFilter()._id.toHexString(), _id.toHexString());

q = Test.findOne(_id);

assert.ok(q.getFilter()._id instanceof mongoose.Types.ObjectId);
assert.equal(q.getFilter()._id.toHexString(), _id.toHexString());
Expand Down

0 comments on commit a40844e

Please sign in to comment.