Files
Aislo/resources/tester/test_476_2_recommend_initial_line.py
T
eomsangdonandClaude Opus 5.5 d2bf68b598 feat(492-2 노선 바뀜 확인): 모양 바뀐 노선 초안 띠 · [저장] · 추천 [적용] 확인 창(지워질 수) · 저장 뒤 초기화 알림
- 판정 = 저장 노선 대 초안이 그릴 선 정점 1 mm(`routeShapeChanged` · 파이썬 `route_shape_changed` 짝) · 스냅 · 간격 · 지형만 = 아님
- 띠 = 평면(노선 편집) 위 한 줄 · B06 평면 패널로 같이 옮겨짐 · 저장 노선 = 페이지 자료 줄 `pageRoutePlan`(조작마다 안 물음)
- [저장] 확인 창 = 잠금 막 · 서버 요청 앞 · 구조물 · 관 · 추가 측점 · 종단 편집 수 · [취소] = 요청 0 · 추천 [적용] 같은 글 · 수
- 저장 뒤 = 응답 `steps.route.route_reset` 지운 수 한 줄 · 초기화면 세션 초안 통째 비움 → 서버 정본으로 다시 세움 · 옛 서버(칸 없음) = 알림 건너뜀
- 시험: 새 test_283_route_reset_confirm(띠 · 확인 창 수 · [취소] · 스냅만 · 거울) · 저장 헬퍼 셋 확인 창 가짜 · 476-2 확인 글 기대 고침

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 07:20:10 +09:00

70 lines
3.1 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(await params.confirmText(), "적용")' in apply
) # 492-2 — [저장]과 같은 글 · 수
assert apply.index("showConfirmDialog") < apply.index("params.onApply(picked);")
reset = (B05 / "logic" / "B05_Profile_Route_Reset.ts").read_text(encoding="utf-8")
assert (
"횡단 손 입력이 지워지고 " in reset and "새 노선으로 다시 셉니다" in reset
) # 요구 277 · 284
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