1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-06 03:46:47 +01:00
immich/server/test/repositories/crypto.repository.mock.ts
Daniel Dietzler 84f7ca855a
chore(server): move domain interfaces (#8124)
move domain interfaces
2024-03-20 16:42:58 -04:00

13 lines
714 B
TypeScript

import { ICryptoRepository } from 'src/interfaces/crypto.repository';
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)`),
};
};