Skip to content

Commit a22ff61

Browse files
authored
Merge pull request #1000 from supasate/test-datatype-invalid-date
Add test to catch invalid date property
2 parents cca14a0 + 94c5c18 commit a22ff61

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/datatype.test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ describe('datatypes', function() {
5252
done();
5353
});
5454

55+
it('throws an error when property of type Date is set to an invalid value',
56+
function() {
57+
var myModel = db.define('myModel', {
58+
date: { type: Date },
59+
});
60+
61+
(function() {
62+
myModel.create({ date: 'invalid' });
63+
}).should.throw({ message: 'Invalid date: invalid' });
64+
});
65+
5566
it('should keep types when get read data from db', function(done) {
5667
var d = new Date, id;
5768

0 commit comments

Comments
 (0)