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

import { MyProfileUpdateProjectFormComponent } from './my-profile-update-project-form.component';
import { ToastrService } from 'ngx-toastr';
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 { AUTH_REPOSITORY_TOKEN } from '@app/infrastructure/authentification/auth-repository.token';
import { PROFILE_REPOSITORY_TOKEN } from '@app/infrastructure/profiles/profile-repository.token';
import { AuthRepository } from '@app/domain/authentification/auth.repository';
import { ProfileRepository } from '@app/domain/profiles/profile.repository';
import { mockAuthRepo } from '@app/testing/auth.mock';
import { mockProfileRepo } from '@app/testing/profile.mock';
import { mockProjectRepo } from '@app/testing/project.mock';
import { mockToastR } from '@app/testing/toastr.mock';

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

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

  let mockAuthRepository: jest.Mocked<Partial<AuthRepository>> = mockAuthRepo;
  let mockProfileRepository: jest.Mocked<Partial<ProfileRepository>> = mockProfileRepo;

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      imports: [MyProfileUpdateProjectFormComponent],
      providers: [
        provideRouter([]),
        { provide: ToastrService, useValue: mockToastrService },
        { provide: PROJECT_REPOSITORY_TOKEN, useValue: mockProjectRepository },
        { provide: AUTH_REPOSITORY_TOKEN, useValue: mockAuthRepository },
        { provide: PROFILE_REPOSITORY_TOKEN, useValue: mockProfileRepository },
      ],
    }).compileComponents();

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

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

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