Merge pull request #1000 from supasate/test-datatype-invalid-date

Add test to catch invalid date property
This commit is contained in:
Simon Ho 2016-07-15 10:45:13 -07:00 committed by GitHub
commit a22ff61af2
1 changed files with 11 additions and 0 deletions

View File

@ -52,6 +52,17 @@ describe('datatypes', function() {
done(); done();
}); });
it('throws an error when property of type Date is set to an invalid value',
function() {
var myModel = db.define('myModel', {
date: { type: Date },
});
(function() {
myModel.create({ date: 'invalid' });
}).should.throw({ message: 'Invalid date: invalid' });
});
it('should keep types when get read data from db', function(done) { it('should keep types when get read data from db', function(done) {
var d = new Date, id; var d = new Date, id;