- 초안 시작 hold = 측점 열쇠 · 횡단 초안 칸 · 가게 관 · 구조물 · 세션 한 칸(route-draft-hold)에도 - 초안 둔 채 새로고침 = 그 한 벌(초안이 옮겨 쓴 세션 칸 · 초안 자리 관을 처음 값으로 안 뜸) - 묶음 초안 전 가게(beforeDraft) = hold 관 · 구조물 — 버리면 초안 전 관 자리로 되씀 - 되돌림 = 초안 얹기 다시(되쓴 관) 뒤 초안 전 열쇠 · 세션 한 벌 지움 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
78 lines
3.0 KiB
Python
78 lines
3.0 KiB
Python
"""451 노선 초안 둔 채 새로고침 hold(440-4).
|
|
|
|
① 초안 시작 hold = 세션 한 벌(측점 열쇠 · 횡단 초안 칸 · 가게 관 · 구조물)
|
|
② 새로고침(모듈 다시 세움 · 세션 그대로) 뒤 hold = 그 한 벌 — 초안이 옮겨 쓴 세션 칸 · 초안 자리 관이 아님
|
|
③ 초안 버림 = 초안 전 칸 · 초안 얹기 다시(되쓴 관 · 저장 자리 351) 뒤 초안 전 열쇠 · 세션 한 벌 지움
|
|
④ 새 초안(노선 초안 없음) = 지금 값을 다시 뜸 · 다른 노선 한 벌은 안 씀
|
|
⑤ 묶음 = hold 가 돌려준 관 · 구조물로 초안 전 가게(`beforeDraft`)를 채움(버릴 때 되씀)
|
|
TS 셈은 `helper_451_refresh_hold.cjs`.
|
|
|
|
./venv/Scripts/python.exe -m pytest resources/tester/test_451_refresh_hold.py -q
|
|
"""
|
|
|
|
import json
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
HELPER = Path(__file__).with_name("helper_451_refresh_hold.cjs")
|
|
|
|
pytestmark = pytest.mark.skipif(
|
|
not (ROOT / "config" / "node_modules" / "typescript").is_dir(),
|
|
reason="프론트엔드 의존성 미설치",
|
|
)
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def got() -> dict:
|
|
run = subprocess.run( # noqa: S603 — 고정 실행 파일
|
|
["node", str(HELPER)],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=120,
|
|
)
|
|
assert run.returncode == 0, run.stderr
|
|
return json.loads(run.stdout)
|
|
|
|
|
|
def test_초안_시작_hold_는_세션에도(got) -> None:
|
|
start = got["start"]
|
|
assert start["kept"] is True
|
|
assert start["cells"] == '{"before":true}'
|
|
assert start["pipes"] == [351] and start["keys"] == [340, 351, 360]
|
|
|
|
|
|
def test_새로고침_hold_는_초안_전_한_벌(got) -> None:
|
|
refresh = got["refresh"]
|
|
assert refresh["cells"] == '{"before":true}' # 초안이 옮겨 쓴 {"draft":true} 아님
|
|
assert refresh["pipes"] == [351] # 초안 자리 361 아님
|
|
assert refresh["keys"] is True
|
|
|
|
|
|
def test_버리면_초안_전_칸_관_열쇠(got) -> None:
|
|
drop = got["drop"]
|
|
assert drop["same"] is True
|
|
assert drop["cells"] == '{"before":true}'
|
|
assert drop["kept"] is None
|
|
assert drop["calls"] == ["stations:351"] # 되쓴 관으로 초안 얹기 다시
|
|
assert drop["pipeShownAt"] == [351] # 관 제원 = 제 카드
|
|
assert drop["keys"] is True
|
|
|
|
|
|
def test_새_초안은_다시_뜸(got) -> None:
|
|
assert got["next"]["cells"] == '{"later":true}'
|
|
assert got["next"]["otherRoute"] == 4
|
|
|
|
|
|
def test_묶음이_초안_전_가게를_hold_로() -> None:
|
|
page = (ROOT / "A00_Common/design/design_pipeline_page.ts").read_text(encoding="utf-8")
|
|
hold = page[page.index("const holdNow") :]
|
|
hold = hold[: hold.index("};")]
|
|
assert "options.holdDraft?.(routeId, detail, (f) => (beforeDraft ??= f))" in hold
|
|
shared = (ROOT / "A00_Common/design/design_shared.ts").read_text(encoding="utf-8")
|
|
draft = shared[shared.index("holdDraft: (routeId, saved, seed) => {") :]
|
|
assert "if (hold) seed?.(hold.facilities);" in draft[: draft.index("return async")]
|