import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FormPageComponent } from 'src/app/modules/shared/components/slidein/form-page.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 { FormGroup } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

describe('FormpageComponent', () => {
  let component: FormPageComponent<string>;
  let fixture: ComponentFixture<FormPageComponent<string>>;

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      declarations: [FormPageComponent],
      imports: [
        BrowserAnimationsModule,
        SharedModule,
        TranslateModule.forRoot(),
      ],
      providers: [
        AuthService,
        KeycloakService,
        ErrorHandlingService,
        ToastService,
        MessageService,
        ConfirmationService,
        {
          provide: ActivatedRoute,
          useValue: {
            snapshot: { params: of({}) },
          },
        },
      ],
    }).compileComponents();

    fixture = TestBed.createComponent(FormPageComponent<string>);
    component = fixture.componentInstance;
    component.formGroup = new FormGroup({});
    fixture.detectChanges();
  });

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