import { CreateProjectUseCase } from '@app/application/projects/create-project.usecase';
import { CreateProjectDto } from '@app/domain/projects/dto/create-project.dto';
import { FakeProjectRepository } from '@app/testing/domain/projects/fake-project.repository';

describe('CreateProjectUseCase', () => {
  let useCase: CreateProjectUseCase;
  let repo: FakeProjectRepository;

  beforeEach(() => {
    repo = new FakeProjectRepository();
    useCase = new CreateProjectUseCase(repo);
  });

  it('doit creer un nouveau projet', (done) => {
    const dto: CreateProjectDto = {
      nom: 'New Project',
      lien: 'https://example.com',
      description: 'Un nouveau projet de test',
      utilisateur: 'user_005',
    };

    useCase.execute(dto).subscribe((project) => {
      expect(project.id).toBeDefined();
      expect(project.nom).toBe(dto.nom);
      expect(project.utilisateur).toBe(dto.utilisateur);
      done();
    });
  });
});
