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

Commit 82fd4174 by Sascha Depold

test for destroy

1 parent 9f261eb7
Showing with 24 additions and 0 deletions
var assert = require("assert")
, config = require("./../config")
, Sequelize = require("./../../index")
, sequelize = new Sequelize(config.database, config.username, config.password, {logging: false})
module.exports = {
'destroy should delete a saved record from the database': function(exit) {
var User = sequelize.define('User' + parseInt(Math.random() * 99999999), { name: Sequelize.STRING, bio: Sequelize.TEXT })
User.sync({force: true}).on('success', function() {
User.create({name: 'hallo', bio: 'welt'}).on('success', function(u) {
User.all.on('success', function(users) {
assert.eql(users.length, 1)
u.destroy().on('success', function() {
User.all.on('success', function(users) {
assert.eql(users.length, 0)
exit()
})
})
})
})
})
}
}
\ 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!