Hello, I'm running into issue with writing an unit test for this method:
email: string,
password: string,
): Promise<User | null> {
const user = await this._userService.getOne({ where: { email } });
if (!user || (await bcrypt.compare(password, user.password))) {
return null;
}
return user;
}```
What I have now is:
```it('should return null if passwords do not match', async () => {
const email = '[email protected]';
const password = '134';
jest.spyOn(userService, 'getOne').mockResolvedValueOnce(user);
jest.spyOn(bcrypt, 'compare').mockReturnValue(false);
const actualResult = await authService.validateUser(email, password);
// eslint-disable-next-line @typescript-eslint/unbound-method
expect(userService.getOne).toHaveBeenCalledWith({ where: { email } });
expect(bcrypt.compare).toHaveBeenCalledWith(password, user.password);
expect(actualResult).toBeNull();
});```
It does not pass because ```Argument of type 'boolean' is not assignable to parameter of type 'void'.``` in ```jest.spyOn(bcrypt, 'compare').mockReturnValue(false);``` but if I pass nothing ```expect(actualResult).toBeNull();``` throws an error because user has been found. What should I do?