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

Commit 94dfd63c by ekmartin

Add a failing test for nested includes with a lower where-clause

1 parent fc064294
Showing with 41 additions and 0 deletions
...@@ -116,6 +116,47 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -116,6 +116,47 @@ describe(Support.getTestDialectTeaser("Include"), function () {
}); });
}); });
it('should support a nested include (with a where)', function() {
var A = this.sequelize.define('A', {
name: DataTypes.STRING
});
var B = this.sequelize.define('B', {
flag: DataTypes.BOOLEAN
});
var C = this.sequelize.define('C', {
name: DataTypes.STRING
});
A.hasOne(B);
B.belongsTo(A);
B.hasMany(C);
C.belongsTo(B);
return this.sequelize
.sync({ force: true })
.then(function () {
return A.find({
include: [
{
model: B,
where: { flag: true },
include: [
{
model: C
}
]
}
]
})
})
.then(function (a) {
expect(a).to.not.exist;
});
});
it('should support many levels of belongsTo (with a lower level having a where)', function (done) { it('should support many levels of belongsTo (with a lower level having a where)', function (done) {
var A = this.sequelize.define('a', {}) var A = this.sequelize.define('a', {})
, B = this.sequelize.define('b', {}) , B = this.sequelize.define('b', {})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!