test:added route_search and spatial_index tests#711
Open
Chamikajaya wants to merge 1 commit intoOneBusAway:mainfrom
Open
test:added route_search and spatial_index tests#711Chamikajaya wants to merge 1 commit intoOneBusAway:mainfrom
Chamikajaya wants to merge 1 commit intoOneBusAway:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds test coverage for GTFS route full-text search and stop spatial indexing utilities in internal/gtfs/, addressing previously untested logic and edge cases (per #697).
Changes:
- Adds table-driven unit tests for
buildRouteSearchQueryand integration tests forManager.SearchRoutesusing RABA fixtures. - Adds table-driven unit tests for
queryStopsInBounds(including normalization and edge cases) plus an integration test validating the built stop spatial index. - Adds direct tests for
min/maxhelpers used by the spatial query normalization.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/gtfs/route_search_test.go | New tests for FTS5 query building and route search behavior (match/no-match/empty/limit). |
| internal/gtfs/spatial_index_test.go | New tests for R-tree bounds queries, nil/empty tree behavior, and spatial index population using fixtures. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name string | ||
| bounds utils.CoordinateBounds | ||
| expectedCount int | ||
| expectedIDs []string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds unit tests for two previously untested modules: route_search.go and spatial_index.go in
internal/gtfs/.Closes #697
Changes
internal/gtfs/route_search_test.go(new)TestBuildRouteSearchQuery— 12-case table-driven test for the FTS5 query builder covering: single/multi-word input, empty/whitespace, special characters (!,@,/), unicode (café,日本), embedded double-quotes, and extra whitespace.TestSearchRoutes_MatchingResults— integration test using RABA fixture data, verifies matching routes are returned.TestSearchRoutes_NoMatch— verifies empty result for non-matching input.TestSearchRoutes_EmptyInput— verifies empty string short-circuits to empty slice.TestSearchRoutes_WhitespaceOnlyInput— verifies whitespace-only input short-circuits.TestSearchRoutes_DefaultLimit— verifiesmaxCount=0falls back to the default limit.internal/gtfs/spatial_index_test.go(new)TestQueryStopsInBounds— 6-case table-driven test: normal bounding box, no stops, all stops, zero-size (point query), extremely large bounds, and swapped min/max bounds.TestQueryStopsInBounds_NilTree— verifies nil tree returns empty slice.TestQueryStopsInBounds_EmptyTree— verifies empty tree returns no results.TestBuildStopSpatialIndex_WithRABA— integration test using RABA fixture data, verifies the spatial index is populated with real stops.TestMinMaxHelpers— 5-case table-driven test for themin/maxhelper functions.Testing
package gtfs, testify assertions, table-driven tests witht.Run, and the sharedgetSharedTestComponentssingleton pattern.