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

import { MyProfileProjectListComponent } from './my-profile-project-list.component';
import { ProjectRepository } from '@app/domain/projects/project.repository';
import { of } from 'rxjs';
import { provideRouter } from '@angular/router';
import { PROJECT_REPOSITORY_TOKEN } from '@app/infrastructure/projects/project-repository.token';
import { Project } from '@app/domain/projects/project.model';

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

  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)),
    };

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

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

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