import { UpdateUserUseCase } from '@app/application/users/update-user.usecase';
import { FakeUserRepository } from '@app/testing/domain/users/fake-user.repository';

describe('UpdateUserUsecase', () => {
  let useCase: UpdateUserUseCase;
  let repo: FakeUserRepository;

  beforeEach(() => {
    repo = new FakeUserRepository();
    useCase = new UpdateUserUseCase(repo);
  });

  it("devrait modifier un user en fonction de l'id ", () => {
    const userId = 'user_001';
    const newData = { email: 'bar@foo.com' };

    useCase.execute(userId, newData).subscribe((updated) => {
      expect(updated.email).toBe(newData.email);
      expect(updated.updated).toBeDefined();
    });
  });
});
