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

import { SearchComponent } from './search.component';
import { provideRouter } from '@angular/router';
import { PROFILE_REPOSITORY_TOKEN } from '@app/infrastructure/profiles/profile-repository.token';
import { SECTOR_REPOSITORY_TOKEN } from '@app/infrastructure/sectors/sector-repository.token';
import { ProfileRepository } from '@app/domain/profiles/profile.repository';
import { SectorRepository } from '@app/domain/sectors/sector.repository';
import { mockProfileRepo } from '@app/testing/profile.mock';
import { mockSectorRepo } from '@app/testing/sector.mock';

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

  let mockProfileRepository: jest.Mocked<Partial<ProfileRepository>> = mockProfileRepo;
  let mockSectorRepository: jest.Mocked<Partial<SectorRepository>> = mockSectorRepo;

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      imports: [SearchComponent],
      providers: [
        provideRouter([]),
        { provide: PROFILE_REPOSITORY_TOKEN, useValue: mockProfileRepository },
        { provide: SECTOR_REPOSITORY_TOKEN, useValue: mockSectorRepository },
      ],
    }).compileComponents();

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

    await fixture.whenStable();
  });

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