This commit is contained in:
2025-12-16 21:05:01 +01:00
parent f61e3a4e5a
commit 7532c7ed6d
207 changed files with 7861 additions and 2606 deletions

View File

@@ -1,6 +1,5 @@
import { describe, it, expect, beforeEach, vi, Mock } from 'vitest';
import { CreateSponsorUseCase } from './CreateSponsorUseCase';
import type { CreateSponsorCommand } from './CreateSponsorCommand';
import { CreateSponsorUseCase, type CreateSponsorCommand } from './CreateSponsorUseCase';
import type { ISponsorRepository } from '../../domain/repositories/ISponsorRepository';
import type { Logger } from '@core/shared/application';
@@ -80,7 +79,7 @@ describe('CreateSponsorUseCase', () => {
const result = await useCase.execute(command);
expect(result.isErr()).toBe(true);
expect(result.unwrapErr().message).toBe('Sponsor name is required');
expect(result.unwrapErr().details.message).toBe('Sponsor name is required');
});
it('should return error when contactEmail is empty', async () => {
@@ -92,7 +91,7 @@ describe('CreateSponsorUseCase', () => {
const result = await useCase.execute(command);
expect(result.isErr()).toBe(true);
expect(result.unwrapErr().message).toBe('Sponsor contact email is required');
expect(result.unwrapErr().details.message).toBe('Sponsor contact email is required');
});
it('should return error when contactEmail is invalid', async () => {
@@ -104,7 +103,7 @@ describe('CreateSponsorUseCase', () => {
const result = await useCase.execute(command);
expect(result.isErr()).toBe(true);
expect(result.unwrapErr().message).toBe('Invalid sponsor contact email format');
expect(result.unwrapErr().details.message).toBe('Invalid sponsor contact email format');
});
it('should return error when websiteUrl is invalid', async () => {
@@ -117,7 +116,7 @@ describe('CreateSponsorUseCase', () => {
const result = await useCase.execute(command);
expect(result.isErr()).toBe(true);
expect(result.unwrapErr().message).toBe('Invalid sponsor website URL');
expect(result.unwrapErr().details.message).toBe('Invalid sponsor website URL');
});
it('should return error when repository throws', async () => {
@@ -131,6 +130,6 @@ describe('CreateSponsorUseCase', () => {
const result = await useCase.execute(command);
expect(result.isErr()).toBe(true);
expect(result.unwrapErr().message).toBe('DB error');
expect(result.unwrapErr().details.message).toBe('DB error');
});
});