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

Commit 5df7c134 by Jan Aagaard Meier

test(include.separate) Hopefully this test will fail a little less often on postgres

1 parent 0ed07d90
Showing with 13 additions and 9 deletions
...@@ -7,7 +7,8 @@ var chai = require('chai') ...@@ -7,7 +7,8 @@ var chai = require('chai')
, Support = require(__dirname + '/../support') , Support = require(__dirname + '/../support')
, Sequelize = require(__dirname + '/../../../index') , Sequelize = require(__dirname + '/../../../index')
, current = Support.sequelize , current = Support.sequelize
, Promise = Sequelize.Promise; , Promise = Sequelize.Promise
, _ = require('lodash');
if (current.dialect.supports.groupedLimit) { if (current.dialect.supports.groupedLimit) {
describe(Support.getTestDialectTeaser('Include'), function() { describe(Support.getTestDialectTeaser('Include'), function() {
...@@ -250,12 +251,16 @@ if (current.dialect.supports.groupedLimit) { ...@@ -250,12 +251,16 @@ if (current.dialect.supports.groupedLimit) {
logging: sqlSpy logging: sqlSpy
}); });
}).then(function (users) { }).then(function (users) {
expect(users[0].get('projects')).to.be.ok; var u1projects = users[0].get('projects');
expect(users[0].get('projects')[0].get('tasks')).to.be.ok;
expect(users[0].get('projects')[1].get('tasks')).to.be.ok; expect(u1projects).to.be.ok;
expect(users[0].get('projects').length).to.equal(2); expect(u1projects[0].get('tasks')).to.be.ok;
expect(users[0].get('projects')[0].get('tasks').length).to.equal(3); expect(u1projects[1].get('tasks')).to.be.ok;
expect(users[0].get('projects')[1].get('tasks').length).to.equal(1); expect(u1projects.length).to.equal(2);
// WTB ES2015 syntax ...
expect(_.find(u1projects, function (p) { return p.id === 1; }).get('tasks').length).to.equal(3);
expect(_.find(u1projects, function (p) { return p.id === 2; }).get('tasks').length).to.equal(1);
expect(users[1].get('projects')).to.be.ok; expect(users[1].get('projects')).to.be.ok;
expect(users[1].get('projects')[0].get('tasks')).to.be.ok; expect(users[1].get('projects')[0].get('tasks')).to.be.ok;
...@@ -268,4 +273,4 @@ if (current.dialect.supports.groupedLimit) { ...@@ -268,4 +273,4 @@ if (current.dialect.supports.groupedLimit) {
}); });
}); });
}); });
} }
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!