Fix the regression for date conversion

This commit is contained in:
Raymond Feng 2015-07-03 09:29:17 -07:00
parent 014e91ea0c
commit eb20eebe95
2 changed files with 18 additions and 1 deletions

View File

@ -1173,7 +1173,7 @@ DataAccessObject._coerce = function (where) {
break;
}
}
} else
}
// Coerce the array items
if (Array.isArray(val)) {
for (var i = 0; i < val.length; i++) {

View File

@ -270,6 +270,15 @@ describe('Memory connector', function() {
});
});
it('should successfully extract 2 users using date range', function(done) {
User.find({where: {birthday: {between:
[new Date(1940, 0).toISOString(), new Date(1990, 0).toISOString()]}}},
function(err, users) {
should(users.length).be.equal(2);
done();
});
});
it('should successfully extract 0 user from the db', function(done) {
User.find({where: {birthday: {between: [new Date(1990,0), Date.now()]}}},
function(err, users) {
@ -278,6 +287,14 @@ describe('Memory connector', function() {
});
});
it('should count using date string', function(done) {
User.count({birthday: {lt: new Date(1990,0).toISOString()}},
function(err, count) {
should(count).be.equal(2);
done();
});
});
it('should support order with multiple fields', function(done) {
User.find({order: 'vip ASC, seq DESC'}, function(err, posts) {
should.not.exist(err);