Files
Aislo/resources/tester/test_443_2_uphill_carry.py
T
eomsangdonandClaude Opus 5.5 b7af85fa98 fix(443-2 B05 저장): 노선 바꾼 저장의 상단측 = 측점 열쇠로 새 측점에 옮겨 횡단 패치 앞에 보냄 · 못 맞춘 것은 빼고 알림
- 옮김 목록(ROUTE_CARRY_STATES)에 uphill 줄 — 노선 저장 · 측점 갈아끼움 때 새 측점으로
- 노선을 저장했으면 상단측 차례 건너뜀 → carryAfterRouteSave 가 옮긴 뒤 보냄(옛 누가거리로 엉뚱한 측점에 안 얹힘)
- 새 노선에 같은 측점이 없으면 뺌 · 「상단측 N곳 … 뺐습니다」 알림 · 노선 밖 고침 수에도
- 시험 test_443_2_uphill_carry.py · 346-3 · 저장 차례 시험 기대값 맞춤

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014utrjfoW831Vc5wJUd13kL
2026-10-18 18:54:13 +09:00

78 lines
2.8 KiB
Python

"""PLAN 443-2 — 노선 바꾼 [저장]의 상단측(uphill).
- 옛 누가거리 열쇠 상단측 = 측점 열쇠(옮김 목록 `ROUTE_CARRY_STATES` · 415 · 417 규칙)로 새 노선 측점에.
- 새 노선에 같은 측점이 없으면 뺌 · 수를 돌려줌(「노선 밖 고침」 · 상단측 알림).
- 저장 한 줄기: 노선을 저장했으면 상단측 차례는 건너뛰고 `carryAfterRouteSave` 가 옮긴 뒤 · 횡단 패치 앞에 보냄.
Node 헬퍼 `helper_443_2_uphill_carry.mjs` 가 vite ssr 로 묶은 진짜 모듈(`helper_443_2_entry.ts`)을 부름.
./venv/Scripts/python.exe -m pytest resources/tester/test_443_2_uphill_carry.py -q
"""
import json
import subprocess
from pathlib import Path
import pytest
HERE = Path(__file__).resolve().parent
ROOT = HERE.parents[1]
@pytest.fixture(scope="module")
def out(tmp_path_factory):
work = tmp_path_factory.mktemp("b443_2")
build = subprocess.run(
[
"node",
str(ROOT / "config" / "node_modules" / "vite" / "bin" / "vite.js"),
"build",
"--configLoader",
"runner",
"--ssr",
"../resources/tester/helper_443_2_entry.ts",
"--outDir",
str(work),
"--logLevel",
"error",
],
cwd=ROOT,
capture_output=True,
text=True,
encoding="utf-8",
timeout=300,
)
assert build.returncode == 0, build.stderr
bundle = next(work.glob("*.js"), None) or next(work.glob("*.mjs"))
proc = subprocess.run(
["node", str(HERE / "helper_443_2_uphill_carry.mjs"), str(bundle)],
capture_output=True,
text=True,
encoding="utf-8",
timeout=60,
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)
def test_상단측이_새_노선_같은_측점으로(out):
assert out["moved"] == {"21.50": "right", "43.00": "left"}
def test_못_맞춘_상단측은_빼고_수를_돌려줌(out):
assert out["outside"] == 1
def test_세션_없으면_그대로(out):
assert out["outsideEmpty"] == 0 and out["empty"] is None
def test_노선_저장이면_상단측_차례는_옮긴_뒤():
save = (ROOT / "A00_Common" / "design" / "design_save.ts").read_text("utf-8")
assert 'if (step === "uphill" && routeSaved) continue;' in save
apply = (ROOT / "B05_Profile" / "B05_Profile_UI_RouteEdit_Apply.ts").read_text("utf-8")
body = apply.split("export async function carryAfterRouteSave(")[1].split("\n}\n")[0]
carry = body.index("carryChainageStates(")
flush = body.index("await flushUphillOverrides(projectId)")
assert carry < flush < body.index("saveCachedCrossPatches(") # 옮긴 뒤 · 횡단 패치 앞
assert "상단측 ${uphillDropped}곳" in body # 못 맞춤 알림