Skip to content

feat: flight time estimates with range slider, bug fixes, and test infrastructure - #7

Merged
GeekTrainer merged 9 commits into
mainfrom
feature/flight-time-estimates
Mar 2, 2026
Merged

feat: flight time estimates with range slider, bug fixes, and test infrastructure#7
GeekTrainer merged 9 commits into
mainfrom
feature/flight-time-estimates

Conversation

@GeekTrainer

@GeekTrainer GeekTrainer commented Mar 1, 2026

Copy link
Copy Markdown
Owner

Summary

Adds estimated flight times to all routes with a dual-thumb range slider filter, fixes two bugs found during code review, and overhauls the test infrastructure for better DRY compliance and maintainability.

Background

Flight time estimates were the last missing data point for route selection. This branch adds flight time data to all routes and provides a slider UI for filtering by duration. During review, we identified and fixed bugs in the slider boundary logic and route filter null handling, then productionized the entire test suite.

Changes

Feature: Flight Time Estimates

  • Added flight_time_minutes to all routes in routes.json
  • Created FlightTimeRangeSlider.svelte dual-thumb range slider component
  • Created FlightTimeDisplay.svelte for showing formatted flight times
  • Integrated slider into RouteFilterPanel.svelte with bounds < 1h 30m to > 6h
  • Updated route-filter.ts to filter by min/max flight time

Bug Fixes

  • Slider clamping: handleMinChange/handleMaxChange now clamp to [min, max] to prevent out-of-bounds values
  • Null guard: route-filter.ts now handles undefined flight_time_minutes instead of silently passing the filter

Test Infrastructure (DRY refactoring)

  • New shared E2E fixtures: faa-datis.ts, test-constants.ts
  • New shared E2E helpers: mobile.ts, setupWithFlightPageMocks() in setup.ts
  • New shared unit test factories: src/lib/test-utils/mock-factories.ts
  • Refactored 10 test files to eliminate duplicated mock data, setup functions, and magic strings

New Tests

  • 14 E2E tests: flight time slider (desktop + mobile)
  • 14 unit tests: enroute.ts center detection
  • 3 E2E tests: atis.info failure, invalid routes (404)

Testing

  • Unit tests: 139 passed
  • E2E tests: 106 passed
  • TypeScript: 0 errors
GeekTrainer and others added 8 commits March 1, 2026 18:13
- Add lat/lon coordinates to all 111 airports from OpenFlights database
- Pre-compute distance_nm and flight_time_minutes for all 1251 routes
- Optimized block time formula: (distance_nm / 6.6) + 38, ~2.7% avg error
- Add PSP (Palm Springs) and EUG (Eugene) airports with 32 new routes
- Create FlightTimeDisplay component showing formatted flight duration
- Create FlightTimeRangeSlider dual-handle range slider filter
- Integrate flight time display in route list, departure groups, and flight detail page
- Add minFlightTime/maxFlightTime to FilterState with clear filters support
- Strip lat/lon from client-sent airport data in flight page server loader
- Update unit tests for new Route shape and filter fields (125 tests pass)
- All 89 E2E tests pass

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Edge labels show '< 50m' and '> 7h' for clearer bounds
- Active filter shows contextual text: 'Under X', 'X+', or 'X – Y'

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Center header (label + range text) above slider
- Constrain slider width and center within filter panel

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- FlightTimeRangeSlider: clamp handleMinChange/handleMaxChange to [min, max]
  to prevent out-of-bounds values when sliders are near edges
- route-filter: add null check for undefined flight_time_minutes
- Add data-testid attributes to DepartureGroupedList and EmptyState

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Desktop slider tests: visibility, range labels, filtering, reset, combined filters
- Mobile slider tests: touch targets, overflow, collapse/expand, filter summary
- Flight page: atis.info failure handling, invalid route 404 tests
- Enroute: 14 unit tests for center detection, ARTCC lookup, controller counts

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Create shared E2E fixtures: faa-datis.ts, test-constants.ts
- Create shared E2E helpers: mobile.ts, setupWithFlightPageMocks()
- Create shared unit test factories: mock-factories.ts
- Refactor 10 test files to use shared infrastructure
- Eliminate duplicated mock data, setup functions, and magic strings

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@GeekTrainer GeekTrainer changed the title Add estimated flight times with range slider filter Mar 2, 2026
…ests

- Remove spread operator in mock factories that caused 'specified more than once' errors
- Add createMockFix helper with all required SimBriefNavlogFix fields
- Replace inline fix objects with typed factory calls in enroute tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@GeekTrainer
GeekTrainer merged commit 6381c0f into main Mar 2, 2026
1 check passed
@GeekTrainer
GeekTrainer deleted the feature/flight-time-estimates branch March 2, 2026 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant