import { NO_ERRORS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { IFlightTime } from '../../../shared/models-legacy';

import { TimeGroupLegacyComponent } from './time-group-legacy.component';

describe('TimeGroupComponent', () => {
    let component: TimeGroupLegacyComponent;
    let fixture: ComponentFixture<TimeGroupLegacyComponent>;
    const sdate = new Date(2021, 11, 7, 10, 30);
    const scheduled: IFlightTime = { utc: sdate } as any;
    beforeEach(async () => {
        await TestBed.configureTestingModule({
            declarations: [TimeGroupLegacyComponent],
            schemas: [NO_ERRORS_SCHEMA],
        }).compileComponents();
    });

    beforeEach(() => {
        fixture = TestBed.createComponent(TimeGroupLegacyComponent);
        component = fixture.componentInstance;
        fixture.detectChanges();
    });

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

    it('should use baseline if not times provided', () => {
        component.baseline = scheduled;
        component.times = null;
        fixture.detectChanges();
        expect(component.times).toBe(component.times);
    });
});
