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

import { SettingsComponent } from './settings.component';
import { provideRouter } from '@angular/router';
import { ToastrService } from 'ngx-toastr';
import { SETTING_REPOSITORY_TOKEN } from '@app/infrastructure/settings/setting-repository.token';
import { mockToastR } from '@app/testing/toastr.mock';
import { SettingRepository } from '@app/domain/settings/setting.repository';
import { mockSettingRepo } from '@app/testing/setting.mock';
import { PROFILE_REPOSITORY_TOKEN } from '@app/infrastructure/profiles/profile-repository.token';
import { ProfileRepository } from '@app/domain/profiles/profile.repository';
import { mockProfileRepo } from '@app/testing/profile.mock';
import { ProfileViewModel } from '../../../adapters/profiles/profile.presenter.model';

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

  let mockToastrService: jest.Mocked<Partial<ToastrService>> = mockToastR;
  let mockSettingRepository: jest.Mocked<Partial<SettingRepository>> = mockSettingRepo;
  let mockProfileRepository: jest.Mocked<Partial<ProfileRepository>> = mockProfileRepo;

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

    fixture = TestBed.createComponent(SettingsComponent);
    component = fixture.componentInstance;
    fixture.componentRef.setInput('profile', {} as ProfileViewModel);
    fixture.detectChanges();
  });

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