import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef, MatDialog } from '@angular/material/dialog';
import { OperationResultDialogComponent } from './operation-result-dialog.component';
import { MatExpansionModule } from "@angular/material/expansion";
import { MatIconModule } from "@angular/material/icon";
import { MatDividerModule } 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 { HttpClient } from "@angular/common/http";
import { ToastrService } from "ngx-toastr";
import { LoadingComponent } from "../../../shared/loading/loading.component";

describe('OperationResultDialogComponent', () => {
  let component: OperationResultDialogComponent;
  let fixture: ComponentFixture<OperationResultDialogComponent>;
  let mockDialog: jasmine.SpyObj<MatDialog>;
  let mockHttpClient: jasmine.SpyObj<HttpClient>;
  let mockToastrService: jasmine.SpyObj<ToastrService>;

  beforeEach(async () => {
    mockDialog = jasmine.createSpyObj('MatDialog', ['open']);
    mockHttpClient = jasmine.createSpyObj('HttpClient', ['get', 'post']);
    mockToastrService = jasmine.createSpyObj('ToastrService', ['success', 'error']);

    await TestBed.configureTestingModule({
      declarations: [OperationResultDialogComponent, LoadingComponent],
      imports: [
        MatDialogModule,
        MatExpansionModule,
        MatIconModule,
        MatDividerModule,
        MatFormFieldModule,
        MatSelectModule,
        MatPaginatorModule,
        BrowserAnimationsModule,
        FormsModule,
        MatInputModule,
        MatTableModule,
        TranslateModule.forRoot(),
        JoyrideModule.forRoot(),
      ],
      providers: [
        { provide: MatDialogRef, useValue: {} },
        { provide: MAT_DIALOG_DATA, useValue: { success: [], errors: [] } },
        { provide: MatDialog, useValue: mockDialog },
        { provide: HttpClient, useValue: mockHttpClient },
        { provide: ToastrService, useValue: mockToastrService },
      ],
    })
      .compileComponents();

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

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