- POST /design/save 에 route(노선 초안) · carry(옛 노선 세션 칸) 칸 · 서버 = 노선 저장 → Node facility.rebase(rebasePipeDraft · rebaseStructureDraft) → 6-A 차례(새 노선) → Node stations.carry(routeCarryPatches) → 횡단 저장 - 되돌림 범위 = 노선 행 · 자식 표 · 단계 · 배수 폴더 · 노선 파일 · 지표면 확정(설계 지형 바꿈) - 손 상단측은 안 넘김(요구 274) · 노선 바뀐 [확정] = [저장](새 노선 본 뒤 다시) - 브라우저 = 노선 초안 + 사용자 칸만 한 본문 · 옛 차례 길(saveRouteDraft 뒤 flush · carryAfterRouteSave · keepDraftsOnNewRoute) · 부름 0 된 flush 창구 여섯 · saveCachedCrossPatches 걷음 - 등록부 R9 stations.carry · F10 facility.rebase · 옛 차례 단언 시험 한 본문 꼴로 · test_472_6_route_save(옛 길 = 새 길 · 실패 되돌림) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
82 lines
3.4 KiB
Python
82 lines
3.4 KiB
Python
"""PLAN 443-2 — 노선 바꾼 [저장]의 상단측(uphill).
|
|
|
|
- 옛 누가거리 열쇠 상단측 = 측점 열쇠(옮김 목록 `ROUTE_CARRY_STATES` · 415 · 417 규칙)로 새 노선 측점에.
|
|
- 새 노선에 같은 측점이 없으면 뺌 · 수를 돌려줌(「노선 밖 고침」 · 상단측 알림).
|
|
- 저장 한 줄기(472-6 6-B · 요구 274): 노선이 바뀐 [저장]은 손 상단측을 안 보냄 · 새 지형이 정함(옛 443-2 갈음).
|
|
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_노선_저장이면_상단측_차례는_옮긴_뒤():
|
|
"""요구 274(사용자 확정 · 472-6 6-B) — 노선이 바뀐 [저장]은 손 상단측을 안 들고 감 · 새 지형이 정함.
|
|
옛 443-2(옮긴 뒤 보냄)를 갈음 — 상단측 차례 안 보냄 · 서버도 노선 바뀜이면 그 칸을 안 받음 · 저장 뒤 세션
|
|
상단측 비우고 수만 알림. 같은 노선 안의 측점 열쇠 옮김(아래 헬퍼 시험)은 그대로."""
|
|
save = (ROOT / "A00_Common" / "design" / "design_save.ts").read_text("utf-8")
|
|
assert "if (moved) return null;" in save # 상단측 조각 없음
|
|
apply = (ROOT / "B05_Profile" / "B05_Profile_UI_RouteEdit_Apply.ts").read_text("utf-8")
|
|
body = apply.split("export function routeCarryPart(")[1].split("\n}\n")[0]
|
|
assert 'clearState("uphill", projectId);' in body and "상단측 손 고침 ${uphill}곳" in body
|
|
keys = (ROOT / "B06_Section" / "B06_Section_Station_Keys.ts").read_text("utf-8")
|
|
inputs = keys.split("export function routeCarryInputs(")[1].split("\n}\n")[0]
|
|
assert 'state === "uphill"' in inputs # 넘김 입력에서 뺌
|
|
server = (ROOT / "B06_Section" / "B06_Section_Router_DesignSave.py").read_text("utf-8")
|
|
assert "if request.uphill is not None and not moved:" in server |