import { TestBed, ComponentFixture } from '@angular/core/testing';
import { RemissionClientModule } from '../../remission-client.module';
import { ModalService } from '@libs/ui';
import { RemissionScanConfirmationDialogComponent } from './remission-scan-confirmation-dialog.component';

describe('RemissionScanConfirmationDialog', () => {
  let fixture: ComponentFixture<RemissionScanConfirmationDialogComponent>;
  let component: RemissionScanConfirmationDialogComponent;
  let element: HTMLElement;

  beforeEach(() => {
    TestBed.configureTestingModule({
      imports: [RemissionClientModule],
      providers: [ModalService],
    });

    fixture = TestBed.createComponent(RemissionScanConfirmationDialogComponent);
    component = fixture.componentInstance;
    element = fixture.nativeElement;
  });

  it('should dispatch a retry event', () => {
    spyOn(component, 'retryScan').and.callThrough();
    spyOn(component.retry, 'emit').and.callThrough();

    component.retryScan();

    fixture.detectChanges();

    expect(component.retry.emit).toHaveBeenCalled();
  });

  it('should dispatch a close event', () => {
    spyOn(component, 'closeDialog').and.callThrough();
    spyOn(component.close, 'emit').and.callThrough();

    component.closeDialog();

    fixture.detectChanges();

    expect(component.close.emit).toHaveBeenCalled();
  });

  it('should dispatch a close event', () => {
    spyOn(component, 'confirmScan').and.callThrough();
    spyOn(component.confirm, 'emit').and.callThrough();

    component.confirmScan();

    fixture.detectChanges();

    expect(component.confirm.emit).toHaveBeenCalled();
  });
});
