import {
    IFlightArrivalStationTimes,
    IFlightDepartureStationTimes,
} from '@typings/flight/flight-station';
import {
    arrivalBlockOnCaption,
    arrivalBlockOnTimes,
    departureBlockOffCaption,
    departureBlockOffTimes,
} from '@utils/times';

describe('Block off times helpers', () => {
    const scheduled: IFlightDepartureStationTimes = {
        scheduledDeparture: {
            local: '1',
        } as any,
        estimatedBlockOff: {
            local: '2',
        } as any,
    };

    const actual: IFlightDepartureStationTimes = {
        scheduledDeparture: {
            local: '1',
        } as any,
        estimatedBlockOff: {
            local: '2',
        } as any,
        actualBlockOff: {
            local: '3',
        } as any,
    };

    it('departureBlockOffTimes should return appropriate times', () => {
        expect(departureBlockOffTimes(scheduled).local).toBe('2');
        expect(departureBlockOffTimes(actual).local).toBe('3');
    });

    it('departureBlockOffCaption should return appropriate caption', () => {
        expect(departureBlockOffCaption(scheduled)).toBe('SHARED.EXPECTED');
        expect(departureBlockOffCaption(actual)).toBe('SHARED.ACTUAL');
    });
});

describe('Block on times helpers', () => {
    const scheduled: IFlightArrivalStationTimes = {
        scheduledArrival: {
            local: '1',
        } as any,
        estimatedBlockOn: {
            local: '2',
        } as any,
    };

    const actual: IFlightArrivalStationTimes = {
        scheduledArrival: {
            local: '1',
        } as any,
        estimatedBlockOn: {
            local: '2',
        } as any,
        actualBlockOn: {
            local: '3',
        } as any,
    };

    it('arrivalBlockOnTimes should return appropriate times', () => {
        expect(arrivalBlockOnTimes(scheduled).local).toBe('2');
        expect(arrivalBlockOnTimes(actual).local).toBe('3');
    });

    it('arrivalBlockOnCaption should return appropriate caption', () => {
        expect(arrivalBlockOnCaption(scheduled)).toBe('SHARED.EXPECTED');
        expect(arrivalBlockOnCaption(actual)).toBe('SHARED.ACTUAL');
    });
});
