Skip to content

Migrating away from bad-entities tests#529

Merged
irees merged 9 commits intomainfrom
direct-entity-tests
Dec 5, 2025
Merged

Migrating away from bad-entities tests#529
irees merged 9 commits intomainfrom
direct-entity-tests

Conversation

@irees
Copy link
Copy Markdown
Contributor

@irees irees commented Dec 4, 2025

No description provided.

@irees irees marked this pull request as ready for review December 5, 2025 13:34
Copilot AI review requested due to automatic review settings December 5, 2025 13:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request migrates entity validation tests from a CSV-based approach to direct Go unit tests. The old approach used CSV files with test data in testdata/gtfs-examples/bad-entities/ and a generic TestEntityErrors function to iterate over them. The new approach creates individual *_test.go files for each GTFS entity type with table-driven tests that construct entities programmatically and validate their error conditions.

Key Changes:

  • Removed the old CSV-based test infrastructure (TestEntityErrors function and entire bad-entities directory)
  • Added 25+ new test files covering entity validation (trips, stops, routes, fares, calendars, etc.)
  • Enhanced entity implementations with proper field validation (added required tags, ConditionalErrors methods)

Reviewed changes

Copilot reviewed 67 out of 67 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
validator/validator_test.go Removed TestEntityErrors function and unused imports (fmt, testreader)
testdata/gtfs-examples/bad-entities/* Deleted entire directory containing CSV-based test data files
gtfs/trip_test.go Added unit tests for Trip entity error validation
gtfs/translation_test.go Added unit tests for Translation entity error validation
gtfs/transfer_test.go Added unit tests for Transfer entity error validation
gtfs/timeframe_test.go Added unit tests for Timeframe entity error validation
gtfs/timeframe.go Added required field tags and ConditionalErrors method
gtfs/stop_time_test.go Added additional test cases for StopTime validation
gtfs/stop_test.go Added comprehensive unit tests for Stop entity validation
gtfs/stop_area_test.go Added unit tests for StopArea entity validation
gtfs/shape_test.go Added unit tests for Shape entity error validation
gtfs/shape.go Enhanced with explicit required field checks
gtfs/route_test.go Added unit tests for Route entity error validation
gtfs/route_network_test.go Added unit tests for RouteNetwork entity validation
gtfs/route_network.go Added required field tags
gtfs/rider_category_test.go Added unit tests for RiderCategory entity validation
gtfs/pathway_test.go Added unit tests for Pathway entity error validation
gtfs/network_test.go Added unit tests for Network entity validation
gtfs/network.go Added required field tag for NetworkID
gtfs/location_test.go Added unit tests for Location entity validation
gtfs/level_test.go Added unit tests for Level entity validation
gtfs/gtfs_flex_test.go Removed old flex tests (replaced by new specific tests)
gtfs/frequency_test.go Added unit tests for Frequency entity error validation
gtfs/feed_info_test.go Added unit tests for FeedInfo entity error validation
gtfs/fare_transfer_rule_test.go Added unit tests for FareTransferRule validation
gtfs/fare_rule_test.go Added unit tests for FareRule entity validation
gtfs/fare_product_test.go Added unit tests for FareProduct entity validation
gtfs/fare_media_test.go Added unit tests for FareMedia entity validation
gtfs/fare_leg_rule_test.go Added unit tests for FareLegRule entity validation
gtfs/fare_attribute_test.go Added unit tests for FareAttribute entity validation
gtfs/calendar_test.go Added unit tests for Calendar entity error validation
gtfs/calendar_date_test.go Added unit tests for CalendarDate entity validation
gtfs/booking_rule_test.go Added bidirectional validation tests for BookingRule
gtfs/booking_rule.go Enhanced with bidirectional field validation logic
gtfs/attribution_test.go Added unit tests for Attribution entity error validation
gtfs/area_test.go Added unit tests for Area entity validation
gtfs/agency_test.go Added unit tests for Agency entity error validation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 67 out of 67 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@irees irees changed the title Start migrating away from bad-entities tests Migrating away from bad-entities tests Dec 5, 2025
@irees irees merged commit d406a20 into main Dec 5, 2025
12 checks passed
@irees irees deleted the direct-entity-tests branch December 5, 2025 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants