Skip to content

fix: assert ParentStation in TestSearchStopsByName#385

Merged
aaronbrethorst merged 1 commit intoOneBusAway:mainfrom
Bhup-GitHUB:fix/parent-station-assertion
Feb 18, 2026
Merged

fix: assert ParentStation in TestSearchStopsByName#385
aaronbrethorst merged 1 commit intoOneBusAway:mainfrom
Bhup-GitHUB:fix/parent-station-assertion

Conversation

@Bhup-GitHUB
Copy link
Contributor

Closes #377

Summary

The "returns all fields correctly" subtest of TestSearchStopsByName in
gtfsdb/fts_queries_test.go asserted 8 of 9 fields returned by
SearchStopsByNameRow, silently skipping ParentStation. Because
fts_queries.go is hand-maintained SQL (not sqlc-generated), column
scan order can drift without detection.

  • Added assert.False(t, r.ParentStation.Valid) to the existing
    "returns all fields correctly" subtest, covering the NULL case for
    stop s1 (which has no parent_station set).
  • Added a new subtest "reads non-null parent_station correctly" that
    sets parent_station = 'hub1' via a raw SQL UPDATE, verifies the
    scan reads it correctly, then resets it to NULL so other subtests
    are unaffected.

Test plan

  • make test passes
  • make lint passes

Copy link
Member

@aaronbrethorst aaronbrethorst left a comment

Choose a reason for hiding this comment

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

Sharp catch, Bhupesh — a silently skipped field in a hand-maintained SQL scan is exactly the kind of gap that leads to subtle regressions. Good defensive testing.

What Changed

  • Added assert.False(t, r.ParentStation.Valid) to the existing "returns all fields correctly" subtest, covering the NULL case and completing coverage of all 9 SearchStopsByNameRow fields.
  • Added a new "reads non-null parent_station correctly" subtest that sets parent_station via raw SQL UPDATE, asserts the scan reads it, and defers cleanup to reset to NULL for test isolation.

Review

No issues found. The test is well-structured: the defer cleanup maintains isolation for subsequent subtests, the NULL and non-NULL cases are both covered, and the approach of using a raw SQL UPDATE to test the scan without modifying shared fixture setup is pragmatic.

@aaronbrethorst aaronbrethorst merged commit 901524f into OneBusAway:main Feb 18, 2026
4 checks passed
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.

test: add ParentStation field assertion in FTS stop search test

2 participants