sequelize-mock
sequelize-mock copied to clipboard
TypeError: this.sequelize.runHooks is not a function
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 have you found solution bro?