import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HttpClientModule } from '@angular/common/http'; 
import { PXEimagesComponent } from './pxe-images.component';
import { ToastrService } from 'ngx-toastr';
import { of } from 'rxjs'; 
import { MatAccordion, MatExpansionPanel, MatExpansionPanelHeader, MatExpansionPanelTitle, MatExpansionPanelDescription } from '@angular/material/expansion';
import { MatIcon } from '@angular/material/icon';
import { MatDivider } from '@angular/material/divider';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatSelectModule } from '@angular/material/select'; 
import { MatPaginatorModule } from '@angular/material/paginator';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule } from '@angular/forms';
import { MatInputModule } from '@angular/material/input';
import { MatTableModule } from '@angular/material/table'; 
import { TranslateModule } from '@ngx-translate/core';
import { JoyrideModule } from 'ngx-joyride';
import { LoadingComponent } from '../../../shared/loading/loading.component';
import { ConfigService } from '@services/config.service';

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

  let mockToastrService: jasmine.SpyObj<ToastrService>;

  beforeEach(async () => {

  const mockConfigService = {
    apiUrl: 'http://mock-api-url',
    mercureUrl: 'http://mock-mercure-url'
  };

  mockToastrService = jasmine.createSpyObj('ToastrService', ['success', 'error']);
    await TestBed.configureTestingModule({
      declarations: [PXEimagesComponent, LoadingComponent],
      imports: [HttpClientModule,
        MatAccordion,
        MatExpansionPanel,
        MatExpansionPanelHeader,
        MatExpansionPanelTitle,
        MatExpansionPanelDescription,
        MatIcon,
        MatDivider,
        MatFormFieldModule, 
        MatSelectModule,  
        MatPaginatorModule,  
        BrowserAnimationsModule,
        FormsModule,
        MatInputModule,
        MatTableModule, 
        TranslateModule.forRoot(),
        JoyrideModule.forRoot(),
       ],
        providers: [
          { provide: ToastrService, useValue: mockToastrService },
          { provide: ConfigService, useValue: mockConfigService }
        ]

    })
    .compileComponents();

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

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