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

TypeError: this.sequelize.runHooks is not a function

Open alisherafat01 opened this issue 3 years ago • 1 comments

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

alisherafat01 avatar Dec 27 '21 07:12 alisherafat01

@alisherafat01 have you found solution bro?

officialkevinbrian avatar Aug 02 '23 15:08 officialkevinbrian