Add test to catch invalid date property
Signed-off-by: Supasate Choochaisri <supasate.c@gmail.com>
This commit is contained in:
parent
cca14a0230
commit
94c5c18541
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue