sequelize-mock icon indicating copy to clipboard operation
sequelize-mock copied to clipboard

Feature Request - Model.findByPk

Open JustinMGaiam opened this issue 6 years ago • 1 comments

Sequelize 5.x removed findById and added findByPk can this be added to Sequelize mock?

JustinMGaiam avatar Apr 10 '19 17:04 JustinMGaiam

Still waiting on this. For now I've patched my tests with things like this:

const dbMock = new SequelizeMock();
const User = dbMock.define('user');
User.findByPk = async (id: string | number, options: any) => {
  return User.findOne({
    where: {
      id,
    },
    ...options,
  });
};

danomatic avatar Apr 23 '23 21:04 danomatic