Skip to content

Commit

Permalink
fix: don't call overloaded versions of find functions internally (seq…
Browse files Browse the repository at this point in the history
  • Loading branch information
cincodenada authored and maramizo committed Jun 2, 2022
1 parent 9ccd1ee commit 618339d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/unit/model/find-one.test.js
Expand Up @@ -118,6 +118,23 @@ describe(Support.getTestDialectTeaser('Model'), () => {
});
Model.findAll = sinon.stub();

await Model.findOne();
Model.findAll.should.not.have.been.called;
Sequelize.Model.findAll.should.have.been.called;
});
it('should call internal findAll() method if findOne() is overridden', async () => {
const Model = current.define('model', {
unique1: {
type: DataTypes.INTEGER,
unique: 'unique',
},
unique2: {
type: DataTypes.INTEGER,
unique: 'unique',
},
});
Model.findAll = sinon.stub();

await Model.findOne();
Model.findAll.should.not.have.been.called;
Sequelize.Model.findAll.should.have.been.called;
Expand Down

0 comments on commit 618339d

Please sign in to comment.