1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-14 12:00:55 +02:00
immich/server/test/repositories/crypto.repository.mock.ts
2023-07-08 23:37:40 -05:00

13 lines
593 B
TypeScript

import { ICryptoRepository } from '@app/domain';
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)`),
hashFile: jest.fn().mockImplementation((input) => `${input} (file-hashed)`),
};
};