Extend IFlightLeg with optional estimatedDuration/scheduledDuration
This commit is contained in:
@@ -22,6 +22,7 @@ import type {
|
||||
IAircraftInfo,
|
||||
IEquipmentFull,
|
||||
IDaysOfWeek,
|
||||
IDuration,
|
||||
} from "./types.js";
|
||||
|
||||
/**
|
||||
@@ -301,4 +302,21 @@ describe("online-board types extension", () => {
|
||||
};
|
||||
expect(leg.daysOfWeek?.flight).toBe("1111111");
|
||||
});
|
||||
|
||||
it("IDuration has days/hours/minutes and optional isNegative", () => {
|
||||
const d: IDuration = { days: 0, hours: 1, minutes: 30, isNegative: true };
|
||||
expect(d.days).toBe(0);
|
||||
expect(d.hours).toBe(1);
|
||||
expect(d.minutes).toBe(30);
|
||||
expect(d.isNegative).toBe(true);
|
||||
});
|
||||
|
||||
it("IFlightLeg accepts optional estimatedDuration and scheduledDuration", () => {
|
||||
const leg: Partial<IFlightLeg> = {
|
||||
estimatedDuration: { days: 0, hours: 1, minutes: 30 },
|
||||
scheduledDuration: { days: 0, hours: 1, minutes: 45 },
|
||||
};
|
||||
expect(leg.estimatedDuration?.hours).toBe(1);
|
||||
expect(leg.scheduledDuration?.minutes).toBe(45);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -113,6 +113,21 @@ export interface IDaysOfWeek {
|
||||
flight: string;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Duration
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Structured duration for flight timings. `isNegative` flags an uncertain
|
||||
* or "specifying" state (estimated arrival is earlier than departure).
|
||||
*/
|
||||
export interface IDuration {
|
||||
days: number;
|
||||
hours: number;
|
||||
minutes: number;
|
||||
isNegative?: boolean;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Transition (registration/boarding/deboarding)
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -180,6 +195,8 @@ export interface IFlightLeg {
|
||||
updated: string;
|
||||
transition?: IFlightTransitions;
|
||||
daysOfWeek?: IDaysOfWeek;
|
||||
estimatedDuration?: IDuration;
|
||||
scheduledDuration?: IDuration;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user