Files
Aislo/resources/tester/test_476_2_recommend_initial_line.py
T
eomsangdonandClaude Opus 5.5 b916397141 fix(476-2 추천 초기 종단): 초기 종단 한 줄 = 알림 N건 · 알림 글은 마우스 올림
화면 확인(검증_sub1) 알림 37~94건이 한 줄에 다 붙어 줄이 넘침.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 17:02:56 +09:00

65 lines
3.0 KiB
Python

"""476-2 추천 모달 — 「적용될 초기 종단」 선 · 한 줄 · [적용] 확인 글(요구 276).
./venv/Scripts/python.exe -m pytest resources/tester/test_476_2_recommend_initial_line.py -q
"""
import json
import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
B05 = ROOT / "B05_Profile"
HELPER = Path(__file__).with_name("helper_476_2_initial_profile.cjs")
def _out() -> dict:
return json.loads(
subprocess.run(
["node", str(HELPER)], capture_output=True, text=True, encoding="utf-8", check=True
).stdout
)
def test_펴기와_캐시_빼기() -> None:
out = _out()
p = out["parsed"]
assert p["withProfile"] is False and p["curveLengthM"] == 20
assert p["pviCount"] == 3 and p["curveCount"] == 1 and p["straightened"] == 2
assert p["line"][3] == [30, 101.5] and p["planM"] == [100, 102, 101]
assert "initialProfile" not in out["cached"] # 세션에 안 적음
assert out["missing"] is None # 옛 서버 답
assert out["shortLine"] is None # 선 점 하나 = 꼴 틀림
def test_한_줄과_실패_글() -> None:
out = _out()
assert out["line"] == "초기 종단: 꼭짓점 3 · 종단곡선 1 · 직선화 2 · 최대 종단경사 10.0%(L 20)"
assert out["warnLine"].endswith("(L 20) · 알림 2건") # 알림 글은 title
assert out["failed"] == {"error": "지반고 종단 — 측점이 모자랍니다"}
assert out["failedLine"].startswith("초기 종단을 셈하지 못했습니다 — 지반고 종단")
def test_그림_선() -> None:
out = _out()
# 끔 = 지반선 + 초기 종단(계획선 빔)
assert 'class="is-ground" d="M6.0 90.0L300.0 6.0L594.0 62.0"' in out["svgOff"]
assert 'class="is-plan" d=""' in out["svgOff"]
initial = 'class="is-initial" d="M6.0 90.0L153.0 62.0L300.0 34.0L447.0 48.0L594.0 62.0"'
assert initial in out["svgOff"] and initial in out["svgOn"]
assert 'class="is-plan" d="M6.0 90.0L300.0 62.0L594.0 62.0"' in out["svgOn"]
assert "is-initial" not in out["svgOld"] # 옛 답 = 지반 · 균형만
assert "is-plan" not in out["legendOff"] and "적용될 초기 종단" in out["legendOff"]
def test_모달_배선과_확인_글() -> None:
rec = (B05 / "B05_Profile_UI_RouteEdit_Recommend.ts").read_text(encoding="utf-8")
assert '<div data-line="initial" hidden></div>' in rec
assert "profileSvg(balance, initialShape)" in rec
assert 'line("profile").hidden = !balance && !initialShape;' in rec
apply = rec[rec.index('applyButton.addEventListener("click"') :][:400]
assert 'showConfirmDialog(APPLY_CONFIRM, "적용")' in apply
assert apply.index("showConfirmDialog") < apply.index("params.onApply(picked);")
assert "종단 · 횡단 손 입력이 모두 지워지고 이 노선 기준으로 새로 시작" in rec # 요구 277
css = (B05 / "B05_Profile_UI_Style_RouteRecommend.css").read_text(encoding="utf-8")
assert ".b05-routerec__profile .is-initial" in css and "var(--map-route" in css