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

Commit 66d90d28 by Sascha Depold

added test for default values

1 parent e05fe99a
Showing with 15 additions and 0 deletions
...@@ -340,5 +340,19 @@ module.exports = { ...@@ -340,5 +340,19 @@ module.exports = {
testIsFinished = true testIsFinished = true
}) })
beforeExit(function() { assert.equal(testIsFinished, true) }) beforeExit(function() { assert.equal(testIsFinished, true) })
},
'default values': function(assert) {
var DefaultTest = s.define("DefaultTest", {
aString: { type: Sequelize.STRING, allowNull: false, default: 'woot'},
aNumber: { type: Sequelize.INTEGER, allowNull: true},
aBoolean: { type: Sequelize.BOOLEAN, allowNull: false, default: false},
aText: { type: Sequelize.TEXT, allowNull: true }
}),
instance = new DefaultTest({})
assert.eql(instance.aString, 'woot')
assert.isUndefined(instance.aNumber)
assert.eql(instance.aBoolean, false)
assert.isUndefined(instance.aText)
} }
} }
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!