Fix flightStatusVisibility test to use timezone-stable dates

This commit is contained in:
2026-04-17 01:23:30 +03:00
parent 51bc2f6acc
commit 07541aa279
@@ -44,10 +44,11 @@ describe("canViewFlightStatus", () => {
).toBe(false);
});
it("returns false when departure is not same day as now (UTC)", () => {
const now = new Date("2026-04-17T23:59:59Z");
it("returns false when departure is not same day as now", () => {
const now = new Date("2026-04-17T12:00:00Z");
// Departure 2 days later — definitively different calendar day in any timezone
expect(
canViewFlightStatus(makeFlight("SU", "2026-04-18T00:30:00Z"), now, 24, AIRLINES_WITH_STATUS),
canViewFlightStatus(makeFlight("SU", "2026-04-19T12:00:00Z"), now, 24, AIRLINES_WITH_STATUS),
).toBe(false);
});