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

TypeError: this.sequelize.runHooks is not a function #92

Open alisherafat01 opened 2 years ago

alisherafat01 commented 2 years ago

what is the reason of this error?

const UserModel = require('../../../src/models/user');
const Sequelize =require('sequelize');
var SequelizeMock = require('sequelize-mock');
var sequelize = new SequelizeMock();
describe('user.encryptPassword & user.comparePassword', () => {
    it('should encrypt user password and compare with raw password to match', async () => {
        const User = UserModel(sequelize,Sequelize.DataTypes);
        const user = new User();
        user.password = '123456';
        await user.encryptPassword();
        let matched = await user.comparePassword('123456', user.password);
        expect(matched).toBe(true);
    });
});
officialkevinbrian commented 1 year ago

@alisherafat01 have you found solution bro?