Skip to content

Add tests for route_search.go and spatial_index.go #697

@aaronbrethorst

Description

@aaronbrethorst

Summary

Two small but important modules in internal/gtfs/ currently have no test coverage:

  • route_search.go (57 lines) — builds search queries and searches routes by name
  • spatial_index.go (73 lines) — performs bounding-box spatial queries on stops

Both have clear inputs/outputs and are self-contained, making them good candidates for focused unit tests.

Acceptance criteria

  • Create tests for route_search.go covering:
    • Building search queries from user input
    • Searching routes with matching results
    • Searching routes with no results (empty case)
    • Edge cases (special characters, empty strings)
  • Create tests for spatial_index.go covering:
    • Building the spatial index from stop data
    • Querying stops within a bounding box
    • Boundary conditions (no stops in range, all stops in range)
    • Edge cases (zero-size bounds, very large bounds)
  • Follow existing test patterns — see internal/gtfs/*_test.go for setup helpers and conventions
  • make test passes
  • make lint passes

Context

The test infrastructure for GTFS data is well-established. Look at existing test files in internal/gtfs/ for how to set up test data using the RABA fixtures in testdata/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomers to the codebase

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions