Skip to content

Commit cfc3194

Browse files
committedNov 5, 2015
repro; #3539
1 parent a2a3b8b commit cfc3194

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

‎test/schema.validation.test.js

+13
Original file line numberDiff line numberDiff line change
@@ -1013,5 +1013,18 @@ describe('schema', function() {
10131013
done();
10141014
});
10151015
});
1016+
1017+
it('skips conditional required (gh-3539)', function(done) {
1018+
var s = mongoose.Schema({
1019+
n: { type: Number, required: function() { return false; }, min: 0 }
1020+
});
1021+
var M = mongoose.model('gh3539', s);
1022+
1023+
var m = new M();
1024+
m.validate(function(error) {
1025+
assert.ifError(error);
1026+
done();
1027+
});
1028+
});
10161029
});
10171030
});

0 commit comments

Comments
 (0)
Please sign in to comment.