Add unit tests for station service and enhance documentation
Some checks failed
Backend CI / lint-and-test (push) Failing after 37s
Some checks failed
Backend CI / lint-and-test (push) Failing after 37s
- Introduced unit tests for the station service, covering creation, updating, and archiving of stations. - Added detailed building block view documentation outlining the architecture of the Rail Game system. - Created runtime view documentation illustrating key user interactions and system behavior. - Developed concepts documentation detailing domain models, architectural patterns, and security considerations. - Updated architecture documentation to reference new detailed sections for building block and runtime views.
This commit is contained in:
28
backend/tests/test_osm_config.py
Normal file
28
backend/tests/test_osm_config.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from backend.app.core.osm_config import (
|
||||
DEFAULT_REGIONS,
|
||||
STATION_TAG_FILTERS,
|
||||
BoundingBox,
|
||||
compile_overpass_filters,
|
||||
)
|
||||
|
||||
|
||||
def test_default_regions_are_valid() -> None:
|
||||
assert DEFAULT_REGIONS, "Expected at least one region definition"
|
||||
for bbox in DEFAULT_REGIONS:
|
||||
assert isinstance(bbox, BoundingBox)
|
||||
assert bbox.north > bbox.south
|
||||
assert bbox.east > bbox.west
|
||||
# Berlin coordinates should fall inside Berlin bounding box for sanity
|
||||
if bbox.name == "berlin_metropolitan":
|
||||
assert bbox.contains(52.5200, 13.4050)
|
||||
|
||||
|
||||
def test_station_tag_filters_compile_to_overpass_snippet() -> None:
|
||||
compiled = compile_overpass_filters(STATION_TAG_FILTERS)
|
||||
# Ensure each key is present with its values
|
||||
for key, values in STATION_TAG_FILTERS.items():
|
||||
assert key in compiled
|
||||
for value in values:
|
||||
assert value in compiled
|
||||
# The snippet should be multi-line to preserve readability
|
||||
assert "\n" in compiled
|
||||
Reference in New Issue
Block a user