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

Commit bb5fca4e by Mick Hansen

dont wanna have to rewrite query generator tests

1 parent cb94fa88
......@@ -501,8 +501,8 @@ module.exports = (function() {
}
return attr
})
mainAttributes = mainAttributes || [options.table+'.*']
}.bind(this))
mainAttributes = mainAttributes || (subQuery ? [options.table+'.*'] : ['*'])
if (subQuery) {
subQueryAttributes = mainAttributes
......@@ -674,7 +674,7 @@ module.exports = (function() {
query = mainQueryItems.join('')
}
//console.log(query)
query += ";";
return query
},
......
......@@ -1138,6 +1138,40 @@ describe(Support.getTestDialectTeaser("Include"), function () {
expect(product.prices.length).to.be.ok
})
done()
}).on('sql', function (sql) {
console.log(sql)
})
})
})
it.only('should be possible use limit and a where on a hasMany with additional includes', function (done) {
var self = this
this.fixtureA(function () {
self.models.Product.findAll({
include: [
{model: self.models.Company},
{model: self.models.Tag},
{model: self.models.Price, where: {
value: {gt: 5}
}}
],
limit: 6,
order: 'id ASC'
}).done(function (err, products) {
expect(err).not.to.be.ok
expect(products.length).to.equal(6)
products.forEach(function (product) {
expect(product.tags.length).to.be.ok
expect(product.prices.length).to.be.ok
product.tags.forEach(function (tag) {
//expect(tag.name).to.equal('A')
})
})
done()
}).on('sql', function (sql) {
console.log(sql)
})
})
})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!