From 8b8d65eb398c2201406c28ade80784c047b5dde9 Mon Sep 17 00:00:00 2001 From: Sushant Date: Sun, 21 Jan 2018 11:35:20 +0530 Subject: [PATCH] test: scope with operators work for findAll (#8926) --- test/integration/model/scope.test.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/integration/model/scope.test.js b/test/integration/model/scope.test.js index 32b9407fccf5..b68db92e4318 100644 --- a/test/integration/model/scope.test.js +++ b/test/integration/model/scope.test.js @@ -33,6 +33,13 @@ describe(Support.getTestDialectTeaser('Model'), () => { { access_level: { [Sequelize.Op.eq]: 10 } } ] } + }, + lessThanFour: { + where: { + [Sequelize.Op.and]: [ + { access_level: { [Sequelize.Op.lt]: 4 } } + ] + } } } }); @@ -61,6 +68,12 @@ describe(Support.getTestDialectTeaser('Model'), () => { return this.ScopeMe.scope('highAccess').findOne() .then(record => { expect(record.username).to.equal('tobi'); + return this.ScopeMe.scope('lessThanFour').findAll(); + }) + .then(records => { + expect(records).to.have.length(2); + expect(records[0].get('access_level')).to.equal(3); + expect(records[1].get('access_level')).to.equal(3); }); }); });