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

write a test case for defaultValue accepting functions

1 parent 38be9061
Showing with 16 additions and 0 deletions
......@@ -158,6 +158,22 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
it('should allow me to set a function as default value', function(done) {
var UserTable = this.sequelize.define('UserCol', {
aNumber: {
type: Sequelize.INTEGER,
defaultValue: function() {return 5}
}
}, { timestamps: true })
UserTable.sync({ force: true }).success(function() {
UserTable.create().success(function(user) {
expect(user.aNumber).to.equal(5)
done()
})
})
})
it('should allow me to override updatedAt, createdAt, and deletedAt fields', function(done) {
var UserTable = this.sequelize.define('UserCol', {
aNumber: Sequelize.INTEGER
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!