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

Commit fef652b7 by Mick Hansen

fix(instance): undefined changed should return false

1 parent 4305a37e
...@@ -410,7 +410,7 @@ module.exports = (function() { ...@@ -410,7 +410,7 @@ module.exports = (function() {
this._changed[key] = value; this._changed[key] = value;
return this; return this;
} }
return this._changed[key]; return this._changed[key] || false;
} }
var changed = Object.keys(this.dataValues).filter(function(key) { var changed = Object.keys(this.dataValues).filter(function(key) {
......
...@@ -38,7 +38,7 @@ describe(Support.getTestDialectTeaser('Instance'), function() { ...@@ -38,7 +38,7 @@ describe(Support.getTestDialectTeaser('Instance'), function() {
}); });
user.set('name', 'a'); user.set('name', 'a');
expect(user.changed('name')).not.to.be.ok; expect(user.changed('name')).to.equal(false);
}); });
it('should return true for multiple changed values', function () { it('should return true for multiple changed values', function () {
......
...@@ -9,7 +9,7 @@ var chai = require('chai') ...@@ -9,7 +9,7 @@ var chai = require('chai')
describe(Support.getTestDialectTeaser('Instance'), function() { describe(Support.getTestDialectTeaser('Instance'), function() {
describe('set', function () { describe('set', function () {
it.only('sets nested keys in JSON objects', function () { it('sets nested keys in JSON objects', function () {
var User = this.sequelize.define('User', { var User = this.sequelize.define('User', {
meta: DataTypes.JSONB meta: DataTypes.JSONB
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!