You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
2.1 KiB
Python

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# backend/tests/test_api_journey.py
def test_journey_shape(client):
j = client.get("/api/journey").json()
assert [st["id"] for st in j["stages"]] == ["s1", "s2", "s3", "s4"]
assert [st["tone"] for st in j["stages"]] == ["blue", "coral", "violet", "ink"]
assert j["stages"][0]["time"] == "06:40 09:00"
assert all(j["cards"][k] for k in ("s1", "s2", "s3", "s4"))
def test_journey_links_seed(client):
j = client.get("/api/journey").json()
assert len(j["links"]) == 8
by = {(link["from_node"], link["to_node"]): link for link in j["links"]}
assert (
by[("m-brief", "t-report")]["tone"] == "blue"
and by[("m-brief", "t-report")]["dash"] is False
)
assert (
by[("t-interview", "k-11")]["tone"] == "green"
and by[("t-interview", "k-11")]["dash"] is True
)
def test_journey_cards_live_task(client):
j = client.get("/api/journey").json()
report = next(c for c in j["cards"]["s2"] if c["node"] == "t-report")
assert report["title"] == "분기 리포트 초안 마무리" and report["who"] == "jiwoo"
welcome = next(c for c in j["cards"]["s2"] if c["node"] == "t-welcome")
assert welcome["done"] is True # k3 status=done
def test_journey_status_reflects_task_update(client):
client.patch("/api/tasks/k1", json={"status": "done"})
j = client.get("/api/journey").json()
report = next(c for c in j["cards"]["s2"] if c["node"] == "t-report")
assert report["done"] is True
row = next(r for r in j["rows"] if r["node"] == "t-report")
assert row["statusKey"] == "done"
def test_journey_people(client):
j = client.get("/api/journey").json()
assert len(j["people"]) == 5
jiwoo = next(p for p in j["people"] if p["id"] == "jiwoo")
assert jiwoo["me"] is True and jiwoo["tasks"] == 4
sua = next(p for p in j["people"] if p["id"] == "sua")
assert sua["color"] == "oklch(0.66 0.13 200)" and sua["role"] == "리서치"
def test_journey_table_subtitle(client):
j = client.get("/api/journey").json()
assert j["table"]["subtitle"].startswith("5건 · 진행중")