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

Commit fac5fabf by Mick Hansen

fix: intermittent test failure

1 parent 3b656127
Showing with 22 additions and 11 deletions
...@@ -131,6 +131,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() { ...@@ -131,6 +131,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() {
return this.sequelize.sync({force: true}).then(function() { return this.sequelize.sync({force: true}).then(function() {
return Promise.join( return Promise.join(
User.create({ User.create({
id: 1,
tasks: [ tasks: [
{title: 'b', subtasks: [ {title: 'b', subtasks: [
{title:'c'}, {title:'c'},
...@@ -152,6 +153,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() { ...@@ -152,6 +153,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() {
include: [{association: User.Tasks, include: [Task.SubTasks]}] include: [{association: User.Tasks, include: [Task.SubTasks]}]
}), }),
User.create({ User.create({
id: 2,
tasks: [ tasks: [
{title: 'a', subtasks: [ {title: 'a', subtasks: [
{title:'b'}, {title:'b'},
...@@ -171,17 +173,26 @@ describe(Support.getTestDialectTeaser('HasMany'), function() { ...@@ -171,17 +173,26 @@ describe(Support.getTestDialectTeaser('HasMany'), function() {
}) })
); );
}).then(function(users) { }).then(function(users) {
return User.findAll( return User.findAll({
{ include: [{
include: [{ association: User.Tasks,
association: User.Tasks, limit: 2,
limit: 2, order: [['title', 'ASC']],
order: [['title', 'ASC']], separate: true,
separate: true, as: 'tasks',
as: 'tasks', include: [
include: [{association: Task.SubTasks, order: [['title', 'DESC']], separate: true, as: 'subtasks'}] {
}] association: Task.SubTasks,
}).then(function(users) { order: [['title', 'DESC']],
separate: true,
as: 'subtasks'
}
]
}],
order: [
['id', 'ASC']
]
}).then(function(users) {
expect(users[0].tasks.length).to.equal(2); expect(users[0].tasks.length).to.equal(2);
expect(users[0].tasks[0].title).to.equal('a'); expect(users[0].tasks[0].title).to.equal('a');
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!