shinkan-jinkendo/backend/tests/test_progression_graph_planning_artifact.py
Lars 7265cd5a01
All checks were successful
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Successful in 45s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m34s
Add findings_stale field to GraphPlanningRoadmapArtifact and update ProgressionGraphEditor for state management
- Introduced `findings_stale` field in `GraphPlanningRoadmapArtifact` to track the freshness of findings.
- Updated `ProgressionGraphEditor` to manage `findingsStale` state across various functions, ensuring accurate representation of evaluation status.
- Modified related utility functions and tests to accommodate the new state, enhancing overall functionality and user feedback in the progression graph management process.
2026-06-13 16:29:17 +02:00

72 lines
2.2 KiB
Python

"""Tests Planungs-Artefakt am Progressionsgraph."""
import pytest
from progression_graph_planning_artifact import (
ARTIFACT_SCHEMA_VERSION,
normalize_planning_roadmap_payload,
)
def test_normalize_planning_roadmap_minimal():
out = normalize_planning_roadmap_payload(
{
"schema_version": ARTIFACT_SCHEMA_VERSION,
"goal_query": "Mae Geri Perfektion",
"max_steps": 5,
}
)
assert out["goal_query"] == "Mae Geri Perfektion"
assert out["max_steps"] == 5
def test_normalize_planning_roadmap_with_progression_roadmap():
out = normalize_planning_roadmap_payload(
{
"goal_query": "Kumite Beinarbeit",
"progression_roadmap": {
"stage_specs": [{"major_step_index": 0, "learning_goal": "Grundstellung"}],
},
}
)
assert out["progression_roadmap"]["stage_specs"][0]["learning_goal"] == "Grundstellung"
def test_normalize_rejects_invalid_type():
with pytest.raises(ValueError, match="JSON-Objekt"):
normalize_planning_roadmap_payload("not-json")
def test_normalize_slot_contents():
out = normalize_planning_roadmap_payload(
{
"goal_query": "Gerade-Tritt",
"max_steps": 3,
"slot_contents": [
{
"major_step_index": 0,
"primary": {"kind": "library", "exercise_id": 12, "title": "Grundstellung"},
"siblings": [],
},
{
"major_step_index": 1,
"primary": {"kind": "proposal", "title": "KI-Entwurf", "proposal_key": "p1"},
"siblings": [],
},
],
}
)
assert len(out["slot_contents"]) == 2
assert out["slot_contents"][1]["primary"]["kind"] == "proposal"
def test_normalize_planning_roadmap_with_findings_stale():
out = normalize_planning_roadmap_payload(
{
"goal_query": "Mae Geri",
"last_findings": {"overall_ok": False},
"findings_stale": True,
}
)
assert out["findings_stale"] is True
assert out["last_findings"]["overall_ok"] is False