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

import { HistoryComponent } from './history.component';
import { SharedModule } from 'src/app/modules/shared/shared.module';
import { TranslateModule } from '@ngx-translate/core';
import { AuthService } from 'src/app/service/auth.service';
import { KeycloakService } from 'keycloak-angular';
import { ErrorHandlingService } from 'src/app/service/error-handling.service';
import { ToastService } from 'src/app/service/toast.service';
import { ConfirmationService, MessageService } from 'primeng/api';
import { ActivatedRoute } from '@angular/router';
import { of } from 'rxjs';
import { PageDataService } from 'src/app/core/base/page.data.service';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ApiKeysDataService } from 'src/app/modules/admin/administration/api-keys/api-keys.data.service';
import { PageColumns } from 'src/app/core/base/page.columns';
import { MockPageColumns } from 'src/app/modules/shared/test/page.columns.mock';

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

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      declarations: [HistoryComponent],
      imports: [
        BrowserAnimationsModule,
        SharedModule,
        TranslateModule.forRoot(),
      ],
      providers: [
        AuthService,
        KeycloakService,
        ErrorHandlingService,
        ToastService,
        MessageService,
        ConfirmationService,
        {
          provide: ActivatedRoute,
          useValue: {
            snapshot: { params: { historyId: '3' } },
          },
        },
        {
          provide: PageDataService,
          useClass: ApiKeysDataService,
        },
        {
          provide: PageColumns,
          useClass: MockPageColumns,
        },
      ],
    }).compileComponents();

    fixture = TestBed.createComponent(HistoryComponent);
    component = fixture.componentInstance;
    //eslint-disable-next-line @typescript-eslint/no-unused-vars
    component.loadHistory = (id: number) => of([]);
    fixture.detectChanges();
  });

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