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

You need to sign in or sign up before continuing.
Commit 47aa62a7 by Matt Broadstone

broken test for update short path

Sequelize tries to optimize which fields are being updated by
checking previous data values, and determining whether or not
fields should be used in an UPDATE clause. Unfortunately, the
case where NO fields should be used in the clause was never
checked.
1 parent 07b1dfd6
Showing with 29 additions and 0 deletions
...@@ -93,6 +93,35 @@ describe(Support.getTestDialectTeaser('Instance'), function() { ...@@ -93,6 +93,35 @@ describe(Support.getTestDialectTeaser('Instance'), function() {
}); });
}); });
it('should succeed in updating when values are unchanged (without timestamps)', function() {
var User = this.sequelize.define('User' + config.rand(), {
name: DataTypes.STRING,
bio: DataTypes.TEXT,
email: DataTypes.STRING
}, {
timestamps: false
});
return User.sync({force: true}).then(function() {
return User.create({
name: 'snafu',
email: 'email'
}, {
fields: ['name', 'email']
}).then(function(user) {
return user.update({
name: 'snafu',
email: 'email'
});
}).then(function(user) {
return user.reload();
}).then(function(user) {
expect(user.get('name')).to.equal('snafu');
expect(user.get('email')).to.equal('email');
});
});
});
it('should only save passed attributes', function () { it('should only save passed attributes', function () {
var user = this.User.build(); var user = this.User.build();
return user.save().then(function () { return user.save().then(function () {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!