refactor: move auth persistence into repository (WealthLedger/backend#171)

This commit is contained in:
2026-11-04 22:29:01 +03:00
parent cea77f6d56
commit 61c55256e7
4 changed files with 105 additions and 67 deletions
@@ -2,6 +2,8 @@ import { ConflictException, UnauthorizedException } from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';
import { createHash } from 'crypto';
import { AuthRepository } from '../infrastructure/auth.repository';
jest.mock('bcrypt', () => ({
hash: jest.fn(() => Promise.resolve('password-hash')),
compare: jest.fn(() => Promise.resolve(true)),
@@ -51,7 +53,7 @@ describe('AuthService', () => {
delete: jest.fn(),
},
};
const service = new AuthService(prisma as never, jwt);
const service = new AuthService(new AuthRepository(prisma as never), jwt);
beforeEach(() => {
jest.clearAllMocks();