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

Commit cd76ad08 by Igor Nawrocki

added pretty complicated case, that fails at the moment

1 parent c6982f2c
Showing with 55 additions and 2 deletions
...@@ -234,8 +234,61 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -234,8 +234,61 @@ describe(Support.getTestDialectTeaser("Include"), function () {
}, done.bind(this)) }, done.bind(this))
}) })
} }
}) });
it.only('should work on pretty complicated case', function () {
var User = this.sequelize.define('User', {
})
, SubscriptionForm = this.sequelize.define('SubscriptionForm', {
})
, Collection = this.sequelize.define('Collection', {
})
, Category= this.sequelize.define('Category', {
})
, SubCategory = this.sequelize.define('SubCategory', {
})
, Capital = this.sequelize.define('Capital', {
});
Capital.hasMany(Category, { foreignKey: 'boundCapital'})
SubCategory.belongsTo(Category, {foreignKey: 'boundCategory'})
Category.belongsTo(Capital, {foreignKey:'boundCapital'})
Category.hasMany(SubCategory, {foreignKey:'boundCapital'})
Category.hasMany(SubscriptionForm, {foreignKey:'boundCategory'})
Collection.belongsTo(SubscriptionForm, {foreignKey:'boundDesigner'})
SubscriptionForm.belongsTo(User, {foreignKey:'boundUser'})
SubscriptionForm.belongsTo(Category, {foreignKey:'boundCategory'})
SubscriptionForm.hasOne(Collection, {foreignKey:'boundDesigner'})
User.hasOne(SubscriptionForm, {foreignKey:'boundUser'})
return this.sequelize.sync({force: true})
.then(function() {
return User.find({
include: [
{
model: SubscriptionForm,
include: [
{
model: Collection,
where: {
id: 0
}
}, {
model: Category,
include: [
{
model: SubCategory
}, {
model: Capital,
include: [
{
model: Category
}]
}]
}]
}]
})
})
});
it('should accept nested `where` and `limit` at the same time', function () { it('should accept nested `where` and `limit` at the same time', function () {
var Product = this.sequelize.define('Product', { var Product = this.sequelize.define('Product', {
title: DataTypes.STRING title: DataTypes.STRING
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!