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

Commit 2dfd1cec by Mick Hansen

Merge pull request #1486 from sequelize/dottie-upgrade

upgrade dottie to cover new failing test-case
2 parents 66fabc40 d73b4b46
Showing with 31 additions and 2 deletions
......@@ -46,7 +46,7 @@
"lingo": "~0.0.5",
"validator": "~3.2.0",
"moment": "~2.5.0",
"dottie": "0.1.0",
"dottie": "0.2.0",
"toposort-class": "~0.3.0",
"generic-pool": "2.0.4",
"sql": "~0.35.0",
......
......@@ -18,7 +18,7 @@ var sortById = function(a, b) {
describe(Support.getTestDialectTeaser("Include"), function () {
describe('find', function () {
it('should support a empty belongsTo include', function (done) {
it('should support an empty belongsTo include', function (done) {
var Company = this.sequelize.define('Company', {})
, User = this.sequelize.define('User', {})
......@@ -36,6 +36,35 @@ describe(Support.getTestDialectTeaser("Include"), function () {
})
})
// We don't support naming associations the same as the foreign key, however the system should not crash because of it, the results hould just be wrong as is expected behaviour currently.
it('should not throw an error when an empty include is named the same as the foreign key', function (done) {
var section = this.sequelize.define('section', { name: DataTypes.STRING });
var layout = this.sequelize.define('layout', { name: DataTypes.STRING });
section.belongsTo(layout, {
as: layout.name,
foreignKey: layout.name,
foreignKeyConstraint: true
});
this.sequelize.sync({force: true}).done(function(err) {
expect(err).to.be.null
section.create({ name: 'test1' }).success(function() {
section.find({
where: { name: 'test1' },
include: [
{ model: layout, as: 'layout'}
]
}).done(function(err, user) {
expect(err).to.be.null
expect(user).to.be.ok
done()
});
});
});
})
it('should support a empty hasOne include', function (done) {
var Company = this.sequelize.define('Company', {})
, Person = this.sequelize.define('Person', {})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!