test: add E2E coverage for status sub-object fields - #1300
Conversation
- Extract buildTripsForRouteFixtureZip to reuse the static GTFS fixture. - Add createTestApiWithScheduledRealtimePosition to inject a SCHEDULED vehicle with valid GPS coordinates. - Add TestTripsForRouteHandler_StatusFields to strictly assert blockTripSequence, lat/lon conversion, occupancyCount sentinel, and non-nil situationIds/vehicleFeatures.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe test suite adds reusable GTFS and GTFS-RT fixtures for ChangesTrips-for-route status coverage
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|



Description
This PR addresses Issue 16 by adding strict end-to-end test coverage for the
statussub-object fields in thetrips-for-routeAPI response. It ensures that the schema adheres to the defined specifications and prevents potential frontend crashes caused by unexpected null values or missing fields.Changes Made
buildTripsForRouteFixtureZipto reuse the synthetic GTFS static dataset across multiple API test builders.createTestApiWithScheduledRealtimePositionhelper to inject aSCHEDULEDvehicle tracking the fixture trip with valid GPS coordinates. (Named uniquely to prevent merge conflicts with other real-time test setups).TestTripsForRouteHandler_StatusFieldsto verify:blockTripSequenceis a non-negative integer.position.latandposition.lonare accurately populated (handling the GTFS-RTfloat32to Gofloat64conversion).occupancyCountcorrectly returns the-1sentinel value when the feed omits occupancy data.situationIdsandvehicleFeaturesare strictly non-nil empty slices ([]).Closes: #1299
Summary by CodeRabbit