import { ICryptoRepository } from 'src/interfaces/crypto.interface';

export const newCryptoRepositoryMock = (): jest.Mocked<ICryptoRepository> => {
  return {
    randomUUID: jest.fn().mockReturnValue('random-uuid'),
    randomBytes: jest.fn().mockReturnValue(Buffer.from('random-bytes', 'utf8')),
    compareBcrypt: jest.fn().mockReturnValue(true),
    hashBcrypt: jest.fn().mockImplementation((input) => Promise.resolve(`${input} (hashed)`)),
    hashSha256: jest.fn().mockImplementation((input) => `${input} (hashed)`),
    hashSha1: jest.fn().mockImplementation((input) => Buffer.from(`${input.toString()} (hashed)`)),
    hashFile: jest.fn().mockImplementation((input) => `${input} (file-hashed)`),
    newPassword: jest.fn().mockReturnValue(Buffer.from('random-bytes').toString('base64')),
  };
};
