import { ComponentFixture, TestBed } from '@angular/core/testing';
import { EnvVarsComponent } from './env-vars.component';
import { provideHttpClient } from '@angular/common/http';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { ReactiveFormsModule, FormsModule, FormBuilder } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { TranslateModule } from '@ngx-translate/core';
import { ToastrModule, ToastrService } from 'ngx-toastr';
import { DataService } from '../users/users/data.service';
import { MatTableModule } from '@angular/material/table';
import { ConfigService } from '@services/config.service';

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

  beforeEach(async () => {
    const mockConfigService = {
      apiUrl: 'http://mock-api-url'
    };

    await TestBed.configureTestingModule({
      declarations: [EnvVarsComponent],
      imports: [
        ReactiveFormsModule,
        FormsModule,
        MatDialogModule,
        MatFormFieldModule,
        MatInputModule,
        MatCheckboxModule,
        MatButtonModule,
        BrowserAnimationsModule,
        MatTableModule,
        ToastrModule.forRoot(),
        TranslateModule.forRoot()
      ],
      providers: [
        FormBuilder,
        ToastrService,
        DataService,
        provideHttpClient(),
        provideHttpClientTesting(),
        {
          provide: MatDialogRef,
          useValue: {}
        },
        {
          provide: MAT_DIALOG_DATA,
          useValue: {}
        },
        {
          provide: ConfigService,
          useValue: mockConfigService
        }
      ]
    }).compileComponents();

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

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