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

import { ProfileListComponent } from './profile-list.component';
import { provideRouter } from '@angular/router';
import { of } from 'rxjs';
import { ProfileRepository } from '@app/domain/profiles/profile.repository';
import { PROFILE_REPOSITORY_TOKEN } from '@app/infrastructure/profiles/profile-repository.token';
import { Profile } from '@app/domain/profiles/profile.model';

describe('ProfileListComponent', () => {
  let component: ProfileListComponent;
  let fixture: ComponentFixture<ProfileListComponent>;
  let mockProfileRepository: jest.Mocked<ProfileRepository>;

  beforeEach(async () => {
    mockProfileRepository = {
      create: jest.fn().mockReturnValue(of({} as Profile)),
      list: jest.fn().mockReturnValue(of([])),
      getByUserId: jest.fn().mockReturnValue(of({} as Profile)),
      update: jest.fn().mockReturnValue(of({} as Profile)),
    };

    await TestBed.configureTestingModule({
      imports: [ProfileListComponent],
      providers: [
        provideRouter([]),
        { provide: PROFILE_REPOSITORY_TOKEN, useValue: mockProfileRepository },
      ],
    }).compileComponents();

    fixture = TestBed.createComponent(ProfileListComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

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