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

Commit e23ff90b by Mick Hansen

Merge branch 'nested_include_where' of https://github.com/ekmartin/sequelize int…

…o ekmartin-nested_include_where
2 parents 7c5cb57b 94dfd63c
Showing with 41 additions and 0 deletions
......@@ -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) {
var A = this.sequelize.define('a', {})
, 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!