This commit is contained in:
2025-12-31 19:55:43 +01:00
parent 8260bf7baf
commit 167e82a52b
66 changed files with 5124 additions and 228 deletions

View File

@@ -57,20 +57,18 @@ describe('LoginWithEmailUseCase', () => {
password: 'password123',
};
// Import PasswordHash to create a proper hash
const { PasswordHash } = await import('@core/identity/domain/value-objects/PasswordHash');
const passwordHash = await PasswordHash.create('password123');
const storedUser: StoredUser = {
id: 'user-1',
email: 'test@example.com',
displayName: 'Test User',
passwordHash: '',
salt: 'salt',
passwordHash: passwordHash.value,
createdAt: new Date(),
};
storedUser.passwordHash = await (useCase as unknown as { hashPassword: (p: string, s: string) => Promise<string> }).hashPassword(
input.password,
storedUser.salt,
);
const session = {
user: {
id: storedUser.id,
@@ -141,12 +139,15 @@ describe('LoginWithEmailUseCase', () => {
password: 'wrong',
};
// Create a hash for a different password
const { PasswordHash } = await import('@core/identity/domain/value-objects/PasswordHash');
const passwordHash = await PasswordHash.create('correct-password');
const storedUser: StoredUser = {
id: 'user-1',
email: 'test@example.com',
displayName: 'Test User',
passwordHash: 'different-hash',
salt: 'salt',
passwordHash: passwordHash.value,
createdAt: new Date(),
};