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

Commit 8df79fa9 by Sushant Committed by GitHub

test: assert that where conditions are not ignored with empty include (#8790)

1 parent ca788b7a
Showing with 21 additions and 7 deletions
......@@ -53,6 +53,12 @@ describe(Support.getTestDialectTeaser('Model'), () => {
});
}
it('should not crash on an empty where array', function() {
return this.User.findAll({
where: []
});
});
describe('special where conditions/smartWhere object', () => {
beforeEach(function() {
this.buf = new Buffer(16);
......@@ -469,13 +475,23 @@ describe(Support.getTestDialectTeaser('Model'), () => {
});
});
it('should not crash on an empty where array', function() {
return this.User.findAll({
where: []
describe('eager loading', () => {
it('should not ignore where condition with empty includes, #8771', function() {
return this.User.bulkCreate([
{ username: 'D.E.N.N.I.S', intVal: 6 },
{ username: 'F.R.A.N.K', intVal: 5 },
{ username: 'W.I.L.D C.A.R.D', intVal: 8 }
]).then(() => this.User.findAll({
where: {
intVal: 8
},
include: []
})).then(users => {
expect(users).to.have.length(1);
expect(users[0].get('username')).to.be.equal('W.I.L.D C.A.R.D');
});
});
});
describe('eager loading', () => {
describe('belongsTo', () => {
beforeEach(function() {
const self = this;
......@@ -978,7 +994,6 @@ describe(Support.getTestDialectTeaser('Model'), () => {
});
describe('properly handles attributes:[] cases', () => {
beforeEach(function() {
this.Animal = this.sequelize.define('Animal', {
name: Sequelize.STRING,
......@@ -1066,7 +1081,6 @@ describe(Support.getTestDialectTeaser('Model'), () => {
});
});
});
});
});
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!