import { ComponentFixture, TestBed } from '@angular/core/testing';

import { VerticalProfileItemComponent } from './vertical-profile-item.component';
import { UserRepository } from '@app/domain/users/user.repository';
import { provideRouter } from '@angular/router';
import { USER_REPOSITORY_TOKEN } from '@app/infrastructure/users/user-repository.token';
import { SECTOR_REPOSITORY_TOKEN } from '@app/infrastructure/sectors/sector-repository.token';
import { SectorRepository } from '@app/domain/sectors/sector.repository';
import { mockUserRepo } from '@app/testing/user.mock';
import { mockSectorRepo } from '@app/testing/sector.mock';
import { ProfileViewModel } from '../../../adapters/profiles/profile.presenter.model';
import { ToastrService } from 'ngx-toastr';
import { mockToastR } from '@app/testing/toastr.mock';

describe('VerticalProfileItemComponent', () => {
  let component: VerticalProfileItemComponent;
  let fixture: ComponentFixture<VerticalProfileItemComponent>;

  let mockUserRepository: jest.Mocked<Partial<UserRepository>> = mockUserRepo;
  let mockSectorRepository: jest.Mocked<Partial<SectorRepository>> = mockSectorRepo;

  const mockProfile: Partial<ProfileViewModel> = {
    id: 'fakeId',
    utilisateur: 'fakeUtilisateur',
  };

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      imports: [VerticalProfileItemComponent],
      providers: [
        provideRouter([]),
        { provide: USER_REPOSITORY_TOKEN, useValue: mockUserRepository },
        { provide: SECTOR_REPOSITORY_TOKEN, useValue: mockSectorRepository },
        { provide: ToastrService, useValue: mockToastR },
      ],
    }).compileComponents();

    fixture = TestBed.createComponent(VerticalProfileItemComponent);
    component = fixture.componentInstance;

    fixture.componentRef.setInput('profile', mockProfile);

    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});
