不要怂,就是干,撸起袖子干!

Commit b2bc9a26 by Martin Blumenstingl

Add a test for max(String) and min(String) and support BIGINT as well.

1 parent c80079ae
......@@ -689,6 +689,7 @@ module.exports = (function() {
if (options && options.dataType) {
switch (options.dataType) {
case DataTypes.INTEGER:
case DataTypes.BIGINT:
result = parseInt(result, 10);
break;
case DataTypes.FLOAT:
......@@ -697,6 +698,9 @@ module.exports = (function() {
case DataTypes.DATE:
result = new Date(result + 'Z');
break;
case DataTypes.STRING:
// Nothing to do, result is already a string.
break;
}
}
......
......@@ -1037,6 +1037,16 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
it("should allow strings in min", function(done) {
var self = this
this.User.bulkCreate([{username: 'bbb'}, {username: 'yyy'}]).success(function(){
self.User.min('username').success(function(min){
expect(min).to.equal('bbb')
done()
})
})
})
it("should allow dates in min", function(done){
var self = this
this.User.bulkCreate([{theDate: new Date(2000, 01, 01)}, {theDate: new Date(1990, 01, 01)}]).success(function(){
......@@ -1129,6 +1139,16 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
it("should allow strings in max", function(done) {
var self = this
this.User.bulkCreate([{username: 'aaa'}, {username: 'zzz'}]).success(function(){
self.User.max('username').success(function(max){
expect(max).to.equal('zzz')
done()
})
})
})
it('allows sql logging', function(done) {
this.UserWithAge.max('age').on('sql', function(sql) {
expect(sql).to.exist
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!