feat: enhance body_history_viz widget configuration and validation
Deploy Development / deploy (push) Successful in 55s
Build Test / pytest-backend (push) Failing after 4s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 17s

- Added new configuration options for the `body_history_viz` widget, including visibility settings for various charts and KPIs.
- Implemented default values for the widget's configuration to streamline user experience.
- Enhanced validation logic to ensure proper handling of configuration inputs, including error handling for unknown keys and visibility requirements.
- Updated tests to cover new configuration scenarios and validation rules for the `body_history_viz` widget.
- Bumped application version to reflect these changes.
This commit is contained in:
Lars committed 2026-04-22 08:51:06 +02:00
1 parent 01c0d1745f
commit 20f195aca1
11 files changed
+400 -50

No files matched your search

+26 -3
View File
@@ -14,13 +14,36 @@ def test_body_chart_days_bounds():
validate_widget_entry_config("body_overview", {"chart_days": 91})
def test_body_history_viz_chart_days():
assert validate_widget_entry_config("body_history_viz", {}) == {}
assert validate_widget_entry_config("body_history_viz", {"chart_days": 60}) == {"chart_days": 60}
def test_body_history_viz_empty_expands_defaults():
d = validate_widget_entry_config("body_history_viz", {})
assert d["chart_days"] == 30
assert d["show_kpis"] is True
assert d["show_weight_chart"] is True
assert d["kpi_detail"] == "compact"
assert d["show_body_fat_chart"] is False
def test_body_history_viz_chart_days_and_merge():
d = validate_widget_entry_config("body_history_viz", {"chart_days": 60})
assert d["chart_days"] == 60
assert d["show_goals_strip"] is False
with pytest.raises(ValueError):
validate_widget_entry_config("body_history_viz", {"chart_days": 5})
def test_body_history_viz_requires_visible_block():
with pytest.raises(ValueError):
validate_widget_entry_config(
"body_history_viz",
{"show_kpis": False, "show_weight_chart": False},
)
def test_body_history_viz_unknown_key():
with pytest.raises(ValueError):
validate_widget_entry_config("body_history_viz", {"evil": True})
def test_welcome_config_rejected_unknown_key():
with pytest.raises(ValueError):
validate_widget_entry_config("welcome", {"x": 1})