BlinkUX / sequelize-mock

A simple mock interface specifically for testing code relying on Sequelize models
https://sequelize-mock.readthedocs.io
MIT License
139 stars 73 forks source link

Feature Request - Model.findByPk #71

Open JustinMGaiam opened 5 years ago

JustinMGaiam commented 5 years ago

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

danomatic commented 1 year ago

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,
  });
};