Extract duration helper + add distance/duration tests (audit H5) #4
Loading…
Reference in a new issue
No description provided.
Delete branch "test/duration-distance-coverage"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Stacks on #3. Starts working through
docs/audit-2026-06.mdat H5 (test coverage).Refactor
src/lib/duration.ts(durationMinutesBetween) extracts thefromZonedTimeduration math that was duplicated inflights.tsandimport-fr24.ts; both call sites now share it with their existing null/fallback behavior preserved.NaNand could be stored as the duration — now returnsnull.Tests (suite 23 → 40)
duration.test.ts: same-tz, cross-tz westbound, overnight with/withoutarrDate, DST spring-forward (Oslo 01:30→03:30 = 60 real min), and missing/invalid-tz/invalid-date null cases.distance.test.ts: degree distances, symmetry, JFK→LHR ≈ 5540 km, antipodal,kmToMiles.Still open under H5: dashboard aggregation and the ICAO-over-IATA path (need pure-reducer extraction or a test-DB harness).
Verified:
pnpm typecheck,pnpm lint,pnpm test(40/40) all pass.