c67686463a
Registers schedule URL serializer in parity harness with 18-entry fixture corpus and fast-check fuzz. 10 URL round-trip integration tests, 6 SEO/ JSON-LD integration tests. Updates barrel and MF expose from stub to real.
137 lines
3.6 KiB
TypeScript
137 lines
3.6 KiB
TypeScript
/**
|
|
* Shared test fixtures for Schedule integration tests.
|
|
*
|
|
* Provides realistic mock data matching the API response shapes
|
|
* for schedule endpoints.
|
|
*/
|
|
|
|
import type {
|
|
ISimpleFlight,
|
|
IDirectFlight,
|
|
IFlightLeg,
|
|
IBoardResponse,
|
|
} from "@/features/online-board/types.js";
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Flight leg builder
|
|
// ---------------------------------------------------------------------------
|
|
|
|
function makeLeg(overrides: Partial<IFlightLeg> & { index: number }): IFlightLeg {
|
|
return {
|
|
index: overrides.index,
|
|
status: overrides.status ?? "Scheduled",
|
|
flyingTime: overrides.flyingTime ?? "01:30",
|
|
dayChange: overrides.dayChange ?? 0,
|
|
updated: overrides.updated ?? "2022-05-27T10:00:00Z",
|
|
equipment: overrides.equipment ?? { name: "Airbus A320", code: "320" },
|
|
flags: overrides.flags ?? {
|
|
checkinAvailable: false,
|
|
returnToAirport: false,
|
|
routeChanged: false,
|
|
},
|
|
operatingBy: overrides.operatingBy ?? { carrier: "SU", flightNumber: "0012" },
|
|
departure: overrides.departure ?? {
|
|
scheduled: {
|
|
airport: "Sheremetyevo",
|
|
airportCode: "SVO",
|
|
city: "Moscow",
|
|
cityCode: "MOW",
|
|
countryCode: "RU",
|
|
},
|
|
checkingStatus: "closed",
|
|
times: {
|
|
scheduledDeparture: {
|
|
dayChange: { value: 0, title: "" },
|
|
local: "2022-05-27T10:00:00",
|
|
localTime: "10:00",
|
|
tzOffset: 3,
|
|
utc: "2022-05-27T07:00:00Z",
|
|
},
|
|
},
|
|
},
|
|
arrival: overrides.arrival ?? {
|
|
scheduled: {
|
|
airport: "Pulkovo",
|
|
airportCode: "LED",
|
|
city: "Saint Petersburg",
|
|
cityCode: "LED",
|
|
countryCode: "RU",
|
|
},
|
|
times: {
|
|
scheduledArrival: {
|
|
dayChange: { value: 0, title: "" },
|
|
local: "2022-05-27T11:30:00",
|
|
localTime: "11:30",
|
|
tzOffset: 3,
|
|
utc: "2022-05-27T08:30:00Z",
|
|
},
|
|
},
|
|
},
|
|
};
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Flight fixtures
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export const SCHEDULE_FLIGHT_1: IDirectFlight = {
|
|
id: "SU0012-20220527",
|
|
flightId: {
|
|
carrier: "SU",
|
|
flightNumber: "0012",
|
|
suffix: "",
|
|
date: "20220527",
|
|
},
|
|
routeType: "Direct",
|
|
status: "Scheduled",
|
|
flyingTime: "1h 30m",
|
|
operatingBy: { carrier: "SU", flightNumber: "0012" },
|
|
leg: makeLeg({ index: 0 }),
|
|
};
|
|
|
|
export const SCHEDULE_FLIGHT_2: IDirectFlight = {
|
|
id: "SU0013-20220527",
|
|
flightId: {
|
|
carrier: "SU",
|
|
flightNumber: "0013",
|
|
suffix: "",
|
|
date: "20220527",
|
|
},
|
|
routeType: "Direct",
|
|
status: "Scheduled",
|
|
flyingTime: "1h 30m",
|
|
operatingBy: { carrier: "SU", flightNumber: "0013" },
|
|
leg: makeLeg({ index: 0 }),
|
|
};
|
|
|
|
export const ALL_SCHEDULE_FLIGHTS: ISimpleFlight[] = [
|
|
SCHEDULE_FLIGHT_1,
|
|
SCHEDULE_FLIGHT_2,
|
|
];
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// API response fixtures
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** Schedule search response -- IFlight[] */
|
|
export const SCHEDULE_SEARCH_RESPONSE: ISimpleFlight[] = ALL_SCHEDULE_FLIGHTS;
|
|
|
|
/** Schedule details response -- IBoardResponse */
|
|
export const SCHEDULE_DETAILS_RESPONSE: IBoardResponse = {
|
|
data: {
|
|
partners: ["SU"],
|
|
routes: ALL_SCHEDULE_FLIGHTS,
|
|
daysOfFlight: ["2022-05-27"],
|
|
},
|
|
};
|
|
|
|
export const EMPTY_DETAILS_RESPONSE: IBoardResponse = {
|
|
data: {
|
|
partners: [],
|
|
routes: [],
|
|
daysOfFlight: [],
|
|
},
|
|
};
|
|
|
|
export const CALENDAR_DAYS = ["2022-05-25", "2022-05-26", "2022-05-27", "2022-05-28"];
|