import { FakeProfileRepository } from '@app/testing/domain/profiles/fake-profile.repository';
import { mockProfiles } from '@app/testing/profile.mock';
import { CreateProfileUseCase } from '@app/application/profiles/create-profile.usecase';
import { ProfileDTO } from '@app/domain/profiles/dto/create-profile.dto';

describe('CreateProfileUseCase', () => {
  it('doit creer nouveau un profile', () => {
    const repo = new FakeProfileRepository();
    const useCase = new CreateProfileUseCase(repo);

    const profile: ProfileDTO = {
      utilisateur: 'john doe',
      profession: 'Designer',
      reseaux: {},
    };

    useCase.execute(profile).subscribe({
      next: (profile) => {
        expect(mockProfiles).toContain(profile);
        expect(mockProfiles.find((current_profile) => profile.id === current_profile.id)).toBe(
          profile.id
        );
      },
    });
  });
});
