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

import { UpdateUserComponent } from './update-user.component';
import { provideRouter } from '@angular/router';
import { UserRepository } from '@app/domain/users/user.repository';
import { USER_REPOSITORY_TOKEN } from '@app/infrastructure/users/user-repository.token';
import { ToastrService } from 'ngx-toastr';
import { mockUserRepo } from '@app/testing/user.mock';
import { mockToastR } from '@app/testing/toastr.mock';

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

  let mockUserRepository: jest.Mocked<Partial<UserRepository>> = mockUserRepo;
  let mockToastrService: jest.Mocked<Partial<ToastrService>> = mockToastR;

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      imports: [UpdateUserComponent],
      providers: [
        provideRouter([]),
        { provide: USER_REPOSITORY_TOKEN, useValue: mockUserRepository },
        { provide: ToastrService, useValue: mockToastrService },
      ],
    }).compileComponents();

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

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