Skip to content

Commit

Permalink
test(query): repro #1698
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Dec 1, 2017
1 parent f46e033 commit 0de9867
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions test/query.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ describe('Query', function() {
assert.ok(!threw);
done();
});

it('works with overwriting previous object args (1176)', function(done) {
var q = new Query({}, {}, null, p1.collection);
assert.doesNotThrow(function() {
Expand Down Expand Up @@ -1862,11 +1863,11 @@ describe('Query', function() {

var MyModel = db.model('gh4378', schema);

assert.throws(function() {
MyModel.findOne('');
}, /Invalid argument to findOne()/);

done();
MyModel.findOne('', function(error) {
assert.ok(error);
assert.equal(error.name, 'ObjectParameterError');
done();
});
});

it('handles geoWithin with $center and mongoose object (gh-4419)', function(done) {
Expand Down Expand Up @@ -2251,6 +2252,19 @@ describe('Query', function() {
});
});

it('with non-object args (gh-1698)', function(done) {
var schema = new mongoose.Schema({
email: String
});
var M = db.model('gh1698', schema);

M.find(42, function(error) {
assert.ok(error);
assert.equal(error.name, 'ObjectParameterError');
done();
});
});

it('queries with BSON overflow (gh-5812)', function(done) {
this.timeout(10000);

Expand Down

0 comments on commit 0de9867

Please sign in to comment.