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

Commit cca388be by Eric Koslow

Add postgres failing test

New integration test for grouped limit with schemas.
1 parent 8a4f5280
Showing with 48 additions and 0 deletions
...@@ -707,6 +707,54 @@ describe(Support.getTestDialectTeaser('Includes with schemas'), function() { ...@@ -707,6 +707,54 @@ describe(Support.getTestDialectTeaser('Includes with schemas'), function() {
}); });
}); });
it('should be possible to define a hasMany include with grouped limit', function() {
var User = this.sequelize.define('User', {}, {schema: 'account'})
, Task = this.sequelize.define('Task', {
title: DataTypes.STRING
}, {schema: 'account'});
User.Tasks = User.hasMany(Task, {as: 'tasks'});
return this.sequelize.sync({force: true}).then(function () {
return Promise.join(
User.create({
tasks: [
{title: 'b'},
{title: 'd'},
{title: 'c'},
{title: 'a'}
]
}, {
include: [User.Tasks]
}),
User.create({
tasks: [
{title: 'a'},
{title: 'c'},
{title: 'b'}
]
}, {
include: [User.Tasks]
})
);
}).then(function (users) {
return User.findAll({
include: [{ model: Task, limit: 2, as: 'tasks' }],
order: [
['id', 'ASC']
]
}).then(function (result) {
expect(result[0].tasks.length).to.equal(2);
expect(result[0].tasks[0].title).to.equal('b');
expect(result[0].tasks[1].title).to.equal('d');
expect(result[1].tasks.length).to.equal(2);
expect(result[1].tasks[0].title).to.equal('a');
expect(result[1].tasks[1].title).to.equal('c');
});
});
});
it('should be possible to define a belongsTo include as required with child hasMany with limit and aliases', function() { it('should be possible to define a belongsTo include as required with child hasMany with limit and aliases', function() {
var User = this.sequelize.define('User', {}, {schema: 'account'}) var User = this.sequelize.define('User', {}, {schema: 'account'})
, Group = this.sequelize.define('Group', { , Group = this.sequelize.define('Group', {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!