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

import { MyProfileProjectItemComponent } from './my-profile-project-item.component';
import { ProjectRepository } from '@app/domain/projects/project.repository';
import { provideRouter } from '@angular/router';
import { PROJECT_REPOSITORY_TOKEN } from '@app/infrastructure/projects/project-repository.token';
import { mockProjectRepo } from '@app/testing/project.mock';
import { ToastrService } from 'ngx-toastr';
import { mockToastR } from '@app/testing/toastr.mock';

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

  let mockProjectRepository: jest.Mocked<Partial<ProjectRepository>> = mockProjectRepo;

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      imports: [MyProfileProjectItemComponent],
      providers: [
        provideRouter([]),
        { provide: PROJECT_REPOSITORY_TOKEN, useValue: mockProjectRepository },
        { provide: ToastrService, useValue: mockToastR },
      ],
    }).compileComponents();

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

    fixture.componentRef.setInput('projectId', 'fakeId');

    fixture.detectChanges();

    await fixture.whenStable();
  });

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