Fixed SD RPG

This commit is contained in:
2026-06-04 08:05:06 +03:00
parent d4cd8f02f4
commit 6189a5fb74
62 changed files with 6969 additions and 552 deletions
+29
View File
@@ -0,0 +1,29 @@
from services.rpg_plot import choices_from_beat, choices_from_narrator, normalize_choice
def test_choices_from_beat_tags_source():
beat = {
"id": "b_new_1",
"title": "Rest Stop Confession",
"injection": "GPS alerts you to a rest stop.",
"choices": [
{"id": "a", "label": "Tease her about snores"},
{"id": "b", "label": "Ask about snacks"},
],
}
out = choices_from_beat(beat)
assert len(out) == 2
assert out[0]["source"] == "plot_beat"
assert out[0]["beat_title"] == "Rest Stop Confession"
assert out[0]["beat_id"] == "b_new_1"
assert "beat_injection" in out[0]
def test_choices_from_narrator_tags_source():
out = choices_from_narrator([{"id": "a", "label": "Look around"}])
assert out[0]["source"] == "narrator"
assert "beat_title" not in out[0]
def test_normalize_choice_skips_empty_label():
assert normalize_choice({"id": "a", "label": " "}, source="narrator") is None