"""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: init = _read("B05_Profile_UI_RouteEdit_Initial.ts") # 626-1 — 추천 창 요청 · [적용] 걷음 · [저장]은 지금 추천의 종단 반영 그대로 assert "withProfileOf(" not in init assert "with_profile: choiceWithProfile(now)" in init # [저장]에도 실음 api = _read("B05_Profile_Api_RouteInitial.ts") assert "recompute?: boolean;" in api