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

Commit b68e5345 by Mick Hansen

fix tests

1 parent 2c3f4dd3
Showing with 12 additions and 37 deletions
......@@ -671,6 +671,12 @@ module.exports = (function() {
}
options = options || { isNewRecord: true, isDirty: true }
if (options.attributes) {
options.attributes = options.attributes.map(function (attribute) {
return Array.isArray(attribute) ? attribute[1] : attribute
})
}
if (options.hasOwnProperty('include') && options.include && !options.includeValidated) {
validateIncludedElements.call(this, options)
}
......@@ -685,6 +691,12 @@ module.exports = (function() {
validateIncludedElements.call(this, options)
}
if (options.attributes) {
options.attributes = options.attributes.map(function (attribute) {
return Array.isArray(attribute) ? attribute[1] : attribute
})
}
return valueSets.map(function (values) {
return this.build(values, options)
}.bind(this))
......
......@@ -1050,43 +1050,6 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
})
})
})
describe('many to many relations', function() {
var udo;
beforeEach(function(done) {
var self = this
this.User = this.sequelize.define('UserWithUsernameAndAgeAndIsAdmin', {
username: DataTypes.STRING,
age: DataTypes.INTEGER,
isAdmin: DataTypes.BOOLEAN
}, {timestamps: false})
this.Project = this.sequelize.define('NiceProject',
{ title: DataTypes.STRING }, {timestamps: false})
this.Project.hasMany(this.User)
this.User.hasMany(this.Project)
this.User.sync({ force: true }).success(function() {
self.Project.sync({ force: true }).success(function() {
self.User.create({ username: 'fnord', age: 1, isAdmin: true })
.success(function(user) {
udo = user
done()
})
})
})
})
it('Should assign a property to the instance', function(done) {
var self = this;
this.User.find({id: udo.id})
.success(function(user) {
user.NiceProjectId = 1;
expect(user.NiceProjectId).to.equal(1);
done();
})
})
})
describe('toJSON', function() {
beforeEach(function(done) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!