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

Commit 71fc3f84 by GongYi Committed by Sushant

Fix the unstable test "should work with two schema models in a hasMany association" (#6353)

The origin test rely on the record insert order which makes the result randomly
Fix the test
1 parent b4c8b4ca
Showing with 3 additions and 1 deletions
...@@ -389,6 +389,7 @@ if (current.dialect.supports.groupedLimit) { ...@@ -389,6 +389,7 @@ if (current.dialect.supports.groupedLimit) {
return this.sequelize.sync({force: true}).then(() => { return this.sequelize.sync({force: true}).then(() => {
return Promise.join( return Promise.join(
User.create({ User.create({
id:1,
tasks: [ tasks: [
{id: 1, title: 'b'}, {id: 1, title: 'b'},
{id: 2, title: 'd'}, {id: 2, title: 'd'},
...@@ -399,6 +400,7 @@ if (current.dialect.supports.groupedLimit) { ...@@ -399,6 +400,7 @@ if (current.dialect.supports.groupedLimit) {
include: [User.Tasks] include: [User.Tasks]
}), }),
User.create({ User.create({
id:2,
tasks: [ tasks: [
{id: 5, title: 'a'}, {id: 5, title: 'a'},
{id: 6, title: 'c'}, {id: 6, title: 'c'},
...@@ -410,7 +412,7 @@ if (current.dialect.supports.groupedLimit) { ...@@ -410,7 +412,7 @@ if (current.dialect.supports.groupedLimit) {
); );
}).then((users) => { }).then((users) => {
return User.findAll({ return User.findAll({
include: [{ model: Task, limit: 2, as: 'tasks' }], include: [{ model: Task, limit: 2, as: 'tasks', order:[['id', 'ASC']] }],
order: [ order: [
['id', 'ASC'] ['id', 'ASC']
], ],
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!