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

import { ProfileDetailComponent } from './profile-detail.component';
import { provideRouter } from '@angular/router';
import { PROJECT_REPOSITORY_TOKEN } from '@app/infrastructure/projects/project-repository.token';
import { ProjectRepository } from '@app/domain/projects/project.repository';
import { of } from 'rxjs';
import { Project } from '@app/domain/projects/project.model';
import { Sector } from '@app/domain/sectors/sector.model';
import { SectorRepository } from '@app/domain/sectors/sector.repository';
import { SECTOR_REPOSITORY_TOKEN } from '@app/infrastructure/sectors/sector-repository.token';

describe('ProfileDetailComponent', () => {
  let component: ProfileDetailComponent;
  let fixture: ComponentFixture<ProfileDetailComponent>;
  let mockProjectRepository: jest.Mocked<ProjectRepository>;
  let mockSectorRepo: SectorRepository;

  beforeEach(async () => {
    mockProjectRepository = {
      create: jest.fn().mockReturnValue(of({} as Project)),
      list: jest.fn().mockReturnValue(of([])),
      get: jest.fn().mockReturnValue(of({} as Project)),
      update: jest.fn().mockReturnValue(of({} as Project)),
    };

    mockSectorRepo = {
      list: jest.fn(),
      getOne: jest.fn().mockReturnValue(of({} as Sector)),
    };

    await TestBed.configureTestingModule({
      imports: [ProfileDetailComponent],
      providers: [
        provideRouter([]),
        { provide: PROJECT_REPOSITORY_TOKEN, useValue: mockProjectRepository },
        { provide: SECTOR_REPOSITORY_TOKEN, useValue: mockSectorRepo },
      ],
    }).compileComponents();

    fixture = TestBed.createComponent(ProfileDetailComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();

    await fixture.whenStable();
  });

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