feat(pwa): optimize Mila app icons with safe-zone padding to prevent Android/iOS zoom crop
This commit is contained in:
@@ -737,5 +737,51 @@ def test_feeding_logging(temp_datastore: DatastoreEngine):
|
||||
assert daily[0]["total_consumed_ml"] == 160.0
|
||||
|
||||
|
||||
def test_growth_logging(temp_datastore: DatastoreEngine):
|
||||
"""Verifies baby growth measurements, WHO percentile feedback, and DuckDB views."""
|
||||
# Ensure Mila is in people table with birthdate
|
||||
temp_datastore.put_entity(
|
||||
collection="people",
|
||||
record={"id": "mila", "name": "Mila Graf", "birthdate": "2026-03-14", "role": "child"},
|
||||
)
|
||||
|
||||
# Log measurement at approx 6.9 months (2026-10-12)
|
||||
res = temp_datastore.add_event(
|
||||
kind="growth.measurement",
|
||||
subject="mila",
|
||||
actor="agent:hebamme",
|
||||
start="2026-10-12T10:00:00+02:00",
|
||||
payload={"weight_kg": 7.4, "height_cm": 67.5},
|
||||
note="U-Untersuchung Vorbereitung",
|
||||
)
|
||||
assert res["status"] == "success"
|
||||
fb = res["feedback"]
|
||||
assert "weight_kg" in fb
|
||||
assert fb["weight_kg"] == 7.4
|
||||
assert fb["height_cm"] == 67.5
|
||||
assert "weight_percentile" in fb
|
||||
assert 30 <= fb["weight_percentile"] <= 60 # around P41
|
||||
assert 45 <= fb["height_percentile"] <= 70 # around P56
|
||||
assert "Normbereich" in fb["day_total_formatted"]
|
||||
|
||||
# Verify DuckDB views
|
||||
growth_rows = temp_datastore.query("SELECT * FROM v_growth WHERE subject = 'mila'")
|
||||
assert len(growth_rows) == 1
|
||||
assert growth_rows[0]["weight_kg"] == 7.4
|
||||
assert growth_rows[0]["height_cm"] == 67.5
|
||||
assert growth_rows[0]["note"] == "U-Untersuchung Vorbereitung"
|
||||
|
||||
daily_rows = temp_datastore.query("SELECT * FROM v_growth_daily WHERE subject = 'mila'")
|
||||
assert len(daily_rows) == 1
|
||||
assert daily_rows[0]["measurement_count"] == 1
|
||||
|
||||
# Verify get_summary returns growth_latest
|
||||
summary = temp_datastore.get_summary(subject="mila", date_str="2026-10-12")
|
||||
assert "growth_latest" in summary
|
||||
assert summary["growth_latest"]["weight_kg"] == 7.4
|
||||
assert summary["growth_latest"]["height_cm"] == 67.5
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user