import { FakeProjectRepository } from '@app/testing/domain/projects/fake-project.repository';
import { UpdateProjectUseCase } from '@app/application/projects/update-project.usecase';

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

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

  it("doit modifier un projet en fonction de l'id projet", (done) => {
    const projectId = '1';
    const newData = { nom: 'Projet modifié' };

    useCase.execute(projectId, newData).subscribe((updated) => {
      expect(updated.nom).toBe('Projet modifié');
      expect(updated.updated).toBeDefined();
      done();
    });
  });
});
