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

Commit 8b8d65eb by Sushant Committed by GitHub

test: scope with operators work for findAll (#8926)

1 parent 1d0553b4
Showing with 13 additions and 0 deletions
...@@ -33,6 +33,13 @@ describe(Support.getTestDialectTeaser('Model'), () => { ...@@ -33,6 +33,13 @@ describe(Support.getTestDialectTeaser('Model'), () => {
{ access_level: { [Sequelize.Op.eq]: 10 } } { 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'), () => { ...@@ -61,6 +68,12 @@ describe(Support.getTestDialectTeaser('Model'), () => {
return this.ScopeMe.scope('highAccess').findOne() return this.ScopeMe.scope('highAccess').findOne()
.then(record => { .then(record => {
expect(record.username).to.equal('tobi'); 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);
}); });
}); });
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!