Files
Aislo/resources/tester/test_421_recommend_profile.py
T
eomsangdonandClaude Opus 5.5 67de77c48c feat(B05 노선 추천 창): 측점 맞춤 → 종단 반영 단추 · [재계산] 늘 켜짐 + recompute · [적용] 균형 종단 = 단추 값 (421)
- 「종단 반영」 단추(기본 켬 · 다섯 갈래 · 누르면 바로 셈) · 요청에 with_profile 늘 실음 · 답 with_profile 먼저
- [재계산] = 입력 오류 · 셈 중 빼고 늘 켜짐 · recompute: true 보냄(서버 420 짝)
- [적용] · [저장] 의 initial 에 with_profile · 다시 열 때 단추 되살림 · 옛 기록은 갈래로
- 맞추기 전 선(unsnapped) 화면에서 걷음 · 도움말 글(측점 맞춤 늘 · 종단 반영 · 재계산)
- 시험 test_421_recommend_profile · 383_3 · 383_1 · 351_2 고쳐 씀

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ji4nuyLVHcxrXWHTdb5nRD
2026-10-18 12:32:41 +09:00

68 lines
3.1 KiB
Python

"""421 추천 창 — 「측점 맞춤」 → 「종단 반영」 · [재계산] 늘 켜짐 + `recompute`.
./venv/Scripts/python.exe -m pytest resources/tester/test_421_recommend_profile.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_421_profile_toggle.cjs")
def _read(name: str) -> str:
return (B05 / name).read_text(encoding="utf-8")
def test_종단_반영_값_정하기() -> None:
out = json.loads(
subprocess.run(
["node", str(HELPER)], capture_output=True, text=True, encoding="utf-8", check=True
).stdout
)
assert out["sent"] is False # 옛 서버 = 보낸 값
assert out["server"] is True # 서버 답 `with_profile` 이 먼저
assert out["serverHasUnsnapped"] is False # 맞추기 전 선은 화면이 안 씀
assert out["oldFollow"] is False and out["oldEarth"] is True # 옛 캐시 = 갈래로
assert out["base"] is False and out["baseProfile"] is False
assert out["oldBase"] is None and out["oldBaseProfile"] is True
assert out["sameOff"] is True and out["sameOn"] is False and out["sameOld"] is True
assert out["readBack"] is False # 캐시에 남아 다시 열 때 되살림
def test_창_단추와_재계산() -> None:
rec = _read("B05_Profile_UI_RouteEdit_Recommend.ts")
assert "측점 맞춤" not in rec and "snapOn" not in rec and "unsnapped" not in rec
assert 'toggleButton("종단 반영", profileOn,' in rec
assert "let profileOn = params.withProfile;" in rec
toggle = rec[rec.index('toggleButton("종단 반영"') :][:200]
assert "profileOn = active;" in toggle and "void run();" in toggle # 누르면 바로
assert "rerun.before(profileToggle);" in rec
assert "rerun.disabled = busy || invalid.size > 0;" in rec # 늘 켜짐
assert 'rerun.addEventListener("click", () => void run(true));' in rec
assert "const withProfile = profileOn;" in rec
assert "params.onApply(preview);" in rec
def test_요청과_적용에_종단_반영() -> None:
init = _read("B05_Profile_UI_RouteEdit_Initial.ts")
assert "with_profile: withProfile," in init
assert "...(recompute ? { recompute: true } : {})," in init
assert "withProfile: choice?.withProfile ?? base.withProfile ?? true," in init
on_apply = init[init.index("onApply: (picked) => {") :][:900]
assert "with_profile: choiceWithProfile(picked)," in on_apply
assert on_apply.count("choiceWithProfile(picked)") == 2 # 저장 칸 · 균형 종단
assert "withProfileOf(" not in init
assert "with_profile: choiceWithProfile(now)" in init # [저장]에도 실음
api = _read("B05_Profile_Api_RouteInitial.ts")
assert "recompute?: boolean;" in api
def test_도움말_글() -> None:
help_ts = _read("B05_Profile_UI_RouteEdit_Recommend_Help.ts")
assert "「측점 맞춤」을 끄면" not in help_ts and "끔 = 옮기기 전 선" not in help_ts
assert 'name: "재계산",' in help_ts and 'name: "측점 맞춤(늘)",' in help_ts
assert "단추로 켬 · 끔(기본 켬 · 다섯 갈래 모두)" in help_ts