Skip to content

Update unit tests - #3

Merged
colemancda merged 2 commits into
masterfrom
feature/unit-tests
Jul 17, 2026
Merged

colemancda merged 2 commits into
masterfrom
feature/unit-tests

Conversation

@colemancda

Copy link
Copy Markdown
Member

Summary

  • Flesh out the previously-empty DataFile test helper with entity models — Location, Amenity, Amenity.Site, Restaurant, State, Interstate, Prompt, and Configuration — each backed by raw SQL through this package's Connection/PreparedStatement API.
  • Add fetch-all and filtering methods: location search by text/state/site, location filtering by interstate and amenity, plus filterSiteAmenities and filterInterstates.
  • Add DataFileTests covering data-content assertions against the bundled data.sqlite fixture: row counts, first-row values, and filter results (search/state/site, amenity, and interstate cases).

Notes

  • Uses only this package's SQLite API (no query-builder DSL or separate model/persistence layer), so the tests exercise prepare/failableNext/rowDictionaries, parameter binding, and IN (...) filtering end-to-end.

Test plan

  • swift build / swift test on macOS — all 35 tests pass (12 new + 23 existing).

Implements locations, amenities, site amenities, restaurants, states,
interstates, prompts, and configuration lookups against data.sqlite using
raw SQL through this package's Connection/PreparedStatement API, plus
search/state/site/interstate/amenity filtering for locations. Tests port
the data-content assertions (counts, first-row values, filter results)
onto this API, dropping the parts that depended on a query-builder DSL
or a separate model/persistence layer this package doesn't have.
Demonstrates combining an R*Tree virtual table for a fast bounding-box
prefilter with a registered `distance` scalar function (haversine) to
filter and sort sites by great-circle distance from a query point.
Loads real coordinates from the bundled fixture; verified on macOS and
Linux (R*Tree is enabled in swift-sqlcipher's default traits). Adds
latitude/longitude to DataFile.Location so coordinates read through the
existing API.
@colemancda colemancda changed the title Adapt data fixture tests to package API Update unit tests Jul 17, 2026
@colemancda
colemancda merged commit bc0f7a4 into master Jul 17, 2026
8 checks passed
@colemancda
colemancda deleted the feature/unit-tests branch July 17, 2026 00:40
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.

1 participant