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

Commit d311b2c2 by José Moreira

Test for #1614

1 parent c6bd7b2e
Showing with 24 additions and 0 deletions
...@@ -698,6 +698,30 @@ describe(Support.getTestDialectTeaser("HasMany"), function() { ...@@ -698,6 +698,30 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
}) })
}) })
it("get associated objects with an eager load with conditions but not required", function(done) {
var Label = this.sequelize.define('Label', { 'title': DataTypes.STRING, 'isActive': DataTypes.BOOLEAN })
, Task = this.Task
Task.hasMany(Label)
Label.hasMany(Task)
Label.sync({ force: true }).success(function() {
this.User.find({
where: { username: 'John'},
include: [
{ model: this.Task, required: false, include: [
{ model: this.Label, required: false, where: { active: 1 } }
]}
]
}).done(function (err, john) {
expect(err).not.to.be.ok
expect(john.tasks).to.have.length(2);
done();
})
})
})
it('should support schemas', function (done) { it('should support schemas', function (done) {
var self = this var self = this
, AcmeUser = self.sequelize.define('User', { , AcmeUser = self.sequelize.define('User', {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!