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

Commit 4e0d4884 by Martin Blumenstingl

Prove with a unit-test that min() and max() do not work for date.

1 parent 92a7bac7
Showing with 22 additions and 0 deletions
...@@ -1036,6 +1036,17 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () { ...@@ -1036,6 +1036,17 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
}) })
}) })
}) })
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(){
self.User.min('theDate').success(function(min){
expect(min).to.be.a('Date');
expect(new Date(1990, 01, 01)).to.equalDate(min)
done()
})
})
})
}) })
describe('max', function() { describe('max', function() {
...@@ -1107,6 +1118,17 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () { ...@@ -1107,6 +1118,17 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
}) })
}) })
it("should allow dates in max", function(done) {
var self = this
this.User.bulkCreate([{theDate: new Date(2013, 12, 31)}, {theDate: new Date(2000, 01, 01)}]).success(function(){
self.User.max('theDate').success(function(max){
expect(max).to.be.a('Date');
expect(max).to.equalDate(new Date(2013, 12, 31))
done()
})
})
})
it('allows sql logging', function(done) { it('allows sql logging', function(done) {
this.UserWithAge.max('age').on('sql', function(sql) { this.UserWithAge.max('age').on('sql', function(sql) {
expect(sql).to.exist 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!