UNPKG

random-flight-generator

Version:
37 lines (36 loc) 1.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var AirportUtils_1 = require("../AirportUtils"); var FlightGenerator_1 = require("../FlightGenerator"); describe('totalAirports', function () { it('returns a number', function () { expect(AirportUtils_1.AirportUtils.totalAirports()).toBeGreaterThan(0); }); }); describe('randomAirport', function () { it('returns an Airport with a valid latitude', function () { var airport = AirportUtils_1.AirportUtils.randomAirport(); expect(typeof airport.lat).toEqual('number'); }); it('returns an Airport with a valid longitude', function () { var airport = AirportUtils_1.AirportUtils.randomAirport(); expect(typeof airport.lon).toEqual('number'); }); it('should not return an airport in the country that is excluded', function () { var flightGenerator = new FlightGenerator_1.FlightGenerator({ excludeCountries: ['US'], }); var airport = AirportUtils_1.AirportUtils.randomAirport(flightGenerator); expect(airport.country).not.toEqual('US'); }); }); describe('getAirport', function () { it('returns the correct airport given an ICAO code', function () { var airport = AirportUtils_1.AirportUtils.getAirport('SDYM'); expect(airport.name).toBe('Limeira Airport'); }); it('returns the correct airport given an IATA code', function () { var airport = AirportUtils_1.AirportUtils.getAirport('MIA'); expect(airport.name).toBe('Miami International Airport'); }); });