import { ComponentFixture, TestBed } from '@angular/core/testing';
import { VulnerabilityFilterComponent } from './vulnerability-filter.component';
import { OptionType } from '../security-hub.interface';
import { SharedTestingModule } from '../../../../../shared/shared.module';
import { NO_ERRORS_SCHEMA } from '@angular/core';

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

    beforeEach(async () => {
        await TestBed.configureTestingModule({
            schemas: [NO_ERRORS_SCHEMA],
            imports: [SharedTestingModule],
            declarations: [VulnerabilityFilterComponent],
        }).compileComponents();

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

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

    it('"All" is selected by default', () => {
        fixture.detectChanges();
        const select: HTMLSelectElement =
            fixture.nativeElement.querySelector('select');
        expect(select.value).toEqual(OptionType.ALL);
    });
});
