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

Commit 5933bc89 by Mick Hansen

add extra case to test

1 parent a814e7fa
Showing with 17 additions and 4 deletions
......@@ -500,16 +500,29 @@ describe(Support.getTestDialectTeaser("Include"), function () {
Project.hasMany(Task)
Task.belongsTo(Project)
this.sequelize.sync().done(function() {
Task.create({title: 'FooBar'}).done(function (err) {
Task.findAll({attributes: ['title'], include: [Project]}).done(function(err, tasks) {
this.sequelize.sync({force: true}).done(function() {
Project.create({
title: 'BarFoo'
}).done(function (err, project) {
Task.create({title: 'FooBar'}).done(function (err, task) {
task.setProject(project).done(function () {
Task.findAll({
attributes: ['title'],
include: [
{model: Project, attributes: ['title']}
]
}).done(function(err, tasks) {
expect(err).not.to.be.ok
expect(tasks[0].title).to.equal('FooBar')
expect(tasks[0].project.title).to.equal('BarFoo');
done()
})
})
})
})
})
})
it('should support self associated hasMany (with through) include', function (done) {
var Group = this.sequelize.define('Group', {
......@@ -518,7 +531,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
Group.hasMany(Group, { through: 'groups_outsourcing_companies', as: 'OutsourcingCompanies'});
this.sequelize.sync().done(function (err) {
this.sequelize.sync({force: true}).done(function (err) {
Group.bulkCreate([
{name: 'SoccerMoms'},
{name: 'Coca Cola'},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!