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

Commit 62dfc1a5 by Sascha Depold

some tests

1 parent 17fd3447
...@@ -74,4 +74,6 @@ ModelDefinition.prototype.build = function(values) { ...@@ -74,4 +74,6 @@ ModelDefinition.prototype.build = function(values) {
ModelDefinition.prototype.create = function(values) { ModelDefinition.prototype.create = function(values) {
return this.build(values).save return this.build(values).save
} }
\ No newline at end of file
Utils._.map(require("./association-mixin").classMethods, function(fct, name) { ModelDefinition.prototype[name] = fct })
\ No newline at end of file
var assert = require("assert") var assert = require("assert")
, Model = require("./../../lib/sequelize/model") , ModelDefinition = require("./../../lib/sequelize/model-definition")
module.exports = { module.exports = {
'mixin should be correctly added to the model': function() { 'mixin should be correctly added to the model': function() {
assert.isDefined(Model.hasOne) assert.isDefined(ModelDefinition.prototype.hasOne)
assert.isDefined(Model.hasMany) assert.isDefined(ModelDefinition.prototype.hasMany)
assert.isDefined(Model.belongsTo) assert.isDefined(ModelDefinition.prototype.belongsTo)
},
'model methods should be correctly added to the model': function() {
assert.isDefined(Model.drop)
assert.isDefined(Model.sync)
assert.isDefined(Model.prototype.save)
assert.isDefined(Model.prototype.destroy)
} }
} }
\ No newline at end of file
var assert = require("assert")
, config = require("./../config")
, Sequelize = require("./../../index")
, sequelize = new Sequelize(config.database, config.username, config.password)
module.exports = {
'sync should work': function(beforeExit) {
var User = sequelize.define('User', {
name: Sequelize.STRING,
bio: Sequelize.TEXT
})
User.sync().on('success', beforeExit)
}
}
\ 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!