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

import { MyProfileComponent } from './my-profile.component';
import { provideRouter } from '@angular/router';
import { ProfileRepository } from '@app/domain/profiles/profile.repository';
import { PROFILE_REPOSITORY_TOKEN } from '@app/infrastructure/profiles/profile-repository.token';
import { ToastrService } from 'ngx-toastr';
import { USER_REPOSITORY_TOKEN } from '@app/infrastructure/users/user-repository.token';
import { UserRepository } from '@app/domain/users/user.repository';
import { AuthRepository } from '@app/domain/authentification/auth.repository';
import { AUTH_REPOSITORY_TOKEN } from '@app/infrastructure/authentification/auth-repository.token';
import { mockProfileRepo } from '@app/testing/profile.mock';
import { mockToastR } from '@app/testing/toastr.mock';
import { mockUserRepo } from '@app/testing/user.mock';
import { mockAuthRepo } from '@app/testing/auth.mock';
import { SETTING_REPOSITORY_TOKEN } from '@app/infrastructure/settings/setting-repository.token';
import { SettingRepository } from '@app/domain/settings/setting.repository';
import { mockSettingRepo } from '@app/testing/setting.mock';

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

  let mockProfileRepository: jest.Mocked<Partial<ProfileRepository>> = mockProfileRepo;
  let mockToastrService: jest.Mocked<Partial<ToastrService>> = mockToastR;
  let mockUserRepository: jest.Mocked<Partial<UserRepository>> = mockUserRepo;
  let mockAuthRepository: jest.Mocked<Partial<AuthRepository>> = mockAuthRepo;
  let mockSettingRepository: jest.Mocked<Partial<SettingRepository>> = mockSettingRepo;

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      imports: [MyProfileComponent],
      providers: [
        provideRouter([]),
        { provide: PROFILE_REPOSITORY_TOKEN, useValue: mockProfileRepository },
        { provide: AUTH_REPOSITORY_TOKEN, useValue: mockAuthRepository },
        { provide: USER_REPOSITORY_TOKEN, useValue: mockUserRepository },
        { provide: SETTING_REPOSITORY_TOKEN, useValue: mockSettingRepository },
        { provide: ToastrService, useValue: mockToastrService },
      ],
    }).compileComponents();

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

    await fixture.whenStable();
  });

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