import {
    getStationCity,
    getStationCityCode,
    IStationCityCodeExtractorInput,
    IStationCityExtractorInput,
} from '@utils/flight/station';

describe('getStationCity', () => {
    it('should extract city', () => {
        const scheduledInput: IStationCityExtractorInput = {
            scheduled: {
                city: 'Moscow',
            },
        };
        const latestInput: IStationCityExtractorInput = {
            scheduled: {
                city: 'Moscow',
            },
            latest: {
                city: 'London',
            },
        };

        expect(getStationCity(scheduledInput)).toBe('Moscow');
        expect(getStationCity(latestInput)).toBe('London');
    });
});

describe('getStationCityCode', () => {
    it('should extract city code', () => {
        const scheduledInput: IStationCityCodeExtractorInput = {
            scheduled: {
                cityCode: 'MOW',
            },
        };
        const latestInput: IStationCityCodeExtractorInput = {
            scheduled: {
                cityCode: 'MOW',
            },
            latest: {
                cityCode: 'BAX',
            },
        };

        expect(getStationCityCode(scheduledInput)).toBe('MOW');
        expect(getStationCityCode(latestInput)).toBe('BAX');
    });
});
