import { TestBed } from "@angular/core/testing";
import { ActivatedRoute } from "@angular/router";
import { AppComponent } from "./app.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 { of } from "rxjs";
import { HomeComponent } from "src/app/components/home/home.component";
import { FooterComponent } from "src/app/components/footer/footer.component";
import { HeaderComponent } from "src/app/components/header/header.component";
import { NotFoundComponent } from "src/app/components/error/not-found/not-found.component";
import { SpinnerComponent } from "src/app/components/spinner/spinner.component";
import { SidebarComponent } from "src/app/components/sidebar/sidebar.component";

describe("AppComponent", () => {
  beforeEach(async () => {
    await TestBed.configureTestingModule({
      declarations: [
        AppComponent,
        HomeComponent,
        FooterComponent,
        HeaderComponent,
        NotFoundComponent,
        SpinnerComponent,
        SidebarComponent,
      ],
      imports: [SharedModule, TranslateModule.forRoot()],
      providers: [
        AuthService,
        KeycloakService,
        ErrorHandlingService,
        ToastService,
        MessageService,
        ConfirmationService,
        {
          provide: ActivatedRoute,
          useValue: {
            snapshot: { params: of({}) },
          },
        },
      ],
    }).compileComponents();
  });

  it("should create the app", () => {
    const fixture = TestBed.createComponent(AppComponent);
    const app = fixture.componentInstance;
    expect(app).toBeTruthy();
  });
});
