From 300d916fad93b3a06ef552f6c8e319b02a9c47d6 Mon Sep 17 00:00:00 2001 From: Lars Date: Thu, 14 May 2026 12:48:33 +0200 Subject: [PATCH] chore(version): update version and changelog for release 0.8.125 - Bumped APP_VERSION to 0.8.125 and updated the changelog to reflect recent changes. - Added new tests for the dashboard API to ensure proper HTTP 200 responses when inner lists are mocked. - Enhanced the ExerciseListBulkToolbar component with a data-testid for improved testing capabilities. - Refactored the TrainingPlanningPage by extracting utility functions to trainingPlanningPageHelpers for better code organization. --- backend/tests/test_dashboard_kpis.py | 40 +++++ backend/version.py | 10 +- .../exercises/ExerciseListBulkToolbar.jsx | 2 +- frontend/src/pages/TrainingPlanningPage.jsx | 120 ++------------- .../src/utils/trainingPlanningPageHelpers.js | 106 ++++++++++++++ test-results/.last-run.json | 8 +- .../error-context.md | 137 ++++++++++++++++++ .../test-failed-1.png | Bin 0 -> 2740 bytes .../error-context.md | 137 ++++++++++++++++++ .../test-failed-1.png | Bin 0 -> 2740 bytes .../error-context.md | 137 ++++++++++++++++++ .../test-failed-1.png | Bin 0 -> 2740 bytes tests/dev-smoke-test.spec.js | 48 +++++- 13 files changed, 635 insertions(+), 110 deletions(-) create mode 100644 frontend/src/utils/trainingPlanningPageHelpers.js create mode 100644 test-results/dev-smoke-test-11-Übungsli-01330-nauswahl-zeigt-Bulk-Toolbar/error-context.md create mode 100644 test-results/dev-smoke-test-11-Übungsli-01330-nauswahl-zeigt-Bulk-Toolbar/test-failed-1.png create mode 100644 test-results/dev-smoke-test-12-Training-ae8bb--Seite-lädt-mit-Überschrift/error-context.md create mode 100644 test-results/dev-smoke-test-12-Training-ae8bb--Seite-lädt-mit-Überschrift/test-failed-1.png create mode 100644 test-results/dev-smoke-test-8-Dashboard-8c7cc-profiles-me-dashboard-kpis-/error-context.md create mode 100644 test-results/dev-smoke-test-8-Dashboard-8c7cc-profiles-me-dashboard-kpis-/test-failed-1.png diff --git a/backend/tests/test_dashboard_kpis.py b/backend/tests/test_dashboard_kpis.py index c9ea3dc..313b45b 100644 --- a/backend/tests/test_dashboard_kpis.py +++ b/backend/tests/test_dashboard_kpis.py @@ -2,6 +2,7 @@ from __future__ import annotations import os +from unittest.mock import patch import pytest from fastapi import Query @@ -11,6 +12,7 @@ os.environ.setdefault("SKIP_DB_MIGRATE", "1") from fastapi_param_unwrap import unwrap_query_default from main import app +from tenant_context import TenantContext, get_tenant_context @pytest.fixture @@ -27,3 +29,41 @@ def test_unwrap_query_default_for_direct_route_calls() -> None: def test_dashboard_kpis_unauthenticated_401(client: TestClient) -> None: r = client.get("/api/dashboard/kpis") assert r.status_code == 401 + + +def _fake_tenant_for_kpis() -> TenantContext: + return TenantContext( + profile_id=42, + global_role="trainer", + effective_club_id=7, + club_ids=frozenset({7}), + memberships=[], + ) + + +@patch("routers.dashboard.list_training_units") +@patch("routers.dashboard.list_exercises_like_get") +def test_dashboard_kpis_200_when_inner_lists_mocked( + mock_list_ex: object, + mock_list_tu: object, + client: TestClient, +) -> None: + mock_list_ex.return_value = [] + mock_list_tu.return_value = [] + app.dependency_overrides[get_tenant_context] = _fake_tenant_for_kpis + try: + r = client.get("/api/dashboard/kpis") + assert r.status_code == 200, r.text + data = r.json() + assert "year" in data + assert data["draft_count"] == 0 + assert data["mine_count"] == 0 + assert data["ytd_completed_count"] == 0 + th = data["training_home"] + assert th["upcoming"] == [] + assert th["planned_with_notes"] == [] + assert th["review_pending"] == [] + assert mock_list_ex.call_count == 2 + assert mock_list_tu.call_count == 3 + finally: + app.dependency_overrides.clear() diff --git a/backend/version.py b/backend/version.py index 35133a5..6fdba72 100644 --- a/backend/version.py +++ b/backend/version.py @@ -1,6 +1,6 @@ # Shinkan Jinkendo Version Information -APP_VERSION = "0.8.124" +APP_VERSION = "0.8.125" BUILD_DATE = "2026-05-12" DB_SCHEMA_VERSION = "20260514062" @@ -36,6 +36,14 @@ MODULE_VERSIONS = { } CHANGELOG = [ + { + "version": "0.8.125", + "date": "2026-05-13", + "changes": [ + "Tests: Playwright 11 (Übungsliste Bulk-Toolbar), 12 (Trainingsplanung); Dashboard-Test 8 prüft HTTP 200 auf /api/dashboard/kpis; pytest test_dashboard_kpis_200_when_inner_lists_mocked.", + "Frontend Phase 3: trainingPlanningPageHelpers.js aus TrainingPlanningPage; ExerciseListBulkToolbar data-testid.", + ], + }, { "version": "0.8.124", "date": "2026-05-13", diff --git a/frontend/src/components/exercises/ExerciseListBulkToolbar.jsx b/frontend/src/components/exercises/ExerciseListBulkToolbar.jsx index 1e1ea18..084dcd3 100644 --- a/frontend/src/components/exercises/ExerciseListBulkToolbar.jsx +++ b/frontend/src/components/exercises/ExerciseListBulkToolbar.jsx @@ -9,7 +9,7 @@ export default function ExerciseListBulkToolbar({ if (selectedCount < 1) return null return ( -
+
{selectedCount} ausgewählt