Files
Aislo/resources/tester/test_317_kind_change_station.py
T
eomsangdonandClaude Opus 5.5 d9fec937aa fix(B05·B06 한 페이지): 시설 옮김 = 횡단 편집 열쇠째 · [저장] 중 먹이기 멈춤 · 새 시설 측점 미리보기 걷음 · 되돌리기 뒤 다시 견줌 (415-1 · 415-2)
- H1: 관 · 구조물 밖 측점이 움직인 때만 「노선 바뀜」 넘김 규칙 · 시설만 옮기면 열쇠째 옮김
  (사면 쉬프트 · 소단 깊이 · 단면 유형 · 관 측점 고침 그대로)
- H1 덧: 초안 없을 때도 저장분 계획으로 열쇠 주인(관 = 저장 id · 계산 묶음 열쇠와 같음 · 첫 옮김도 열쇠째)
  · 묶음이 세운 열쇠 목록을 같은 측점이면 주인 규칙으로 다시 세지 않음 · 갈아끼운 옛 상세 맞춤 끝냄
- H2: [저장] 도중 관 · 구조물 먹이기 · 맞춤 고리 쉼 · 끝나면 저장 목록 다시 읽고 맞춤(design_pipeline_facilities)
- M4: 새 시설 측점 서버 미리보기(preview-stations) 걷음 · 새 자리 = 계산 묶음 갈아끼움 · 카드 이름만 얹음
  · 종류 바뀐 자리 = 구조물 없는 사본
- 415-2: 되돌리기 · 다시하기(세션만 되씀) 뒤 관 · 구조물을 묶음 입력과 견줘 다시 넣음
- 시험: test_415_page_split 새로 · 미리보기 전제 시험(273-2 · 298 · 317 · 318 · 322-0 · 322-3)을 새 규칙으로

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

57 lines
2.0 KiB
Python

"""PLAN 317 — 구조물 측점에서 종류를 바꾸면 횡단을 「구조물 없는 상태」부터 새로(요구 213).
- 저장분과 같은 종류 = 저장분 횡단 그대로
- 다른 종류로 바꿈 = 저장분 횡단은 빼 두고 구조물 없는 사본(옛 구조물 흔적 없음 · 415 M4 = 서버 미리보기 안 물음)
- 저장분 종류로 되돌림 = 빼 둔 저장분 횡단이 돌아옴
실제 TS(`withDraftStations`)를 `helper_317_kind_change_station.cjs` 가 Node 로 돌린다(서버 부르는 곳 흉내).
"""
from __future__ import annotations
import json
import os
import subprocess
import pytest
HERE = os.path.dirname(__file__)
ROOT = os.path.join(HERE, "..", "..")
pytestmark = pytest.mark.skipif(
not os.path.isdir(os.path.join(ROOT, "config", "node_modules")),
reason="프론트엔드 의존성 미설치",
)
@pytest.fixture(scope="module")
def result() -> dict:
out = subprocess.run(
["node", os.path.join(HERE, "helper_317_kind_change_station.cjs")],
capture_output=True,
text=True,
encoding="utf-8",
timeout=120,
check=True,
)
return json.loads(out.stdout)
def test_same_kind_keeps_saved_section(result: dict) -> None:
assert result["same_kind"] == {"count": 2, "fresh": False, "old": True, "preview": False}
def test_changed_kind_starts_from_fresh_section(result: dict) -> None:
# 415 M4 — 서버 미리보기(fresh) 대신 구조물 없는 사본 · 설계는 브라우저 다시 셈이 맡음
assert result["changed_kind"] == {"count": 2, "fresh": False, "old": True, "preview": True}
def test_back_to_saved_kind_restores_saved_section(result: dict) -> None:
assert result["back_to_saved"] == {"count": 2, "fresh": False, "old": True, "preview": False}
def test_repeated_switch_leaves_no_old_kind(result: dict) -> None:
# 박스 → 세월교 — 앞 종류(박스) 제원이 남아 겹치지 않음(317-3)
assert result["first_switch"] == ["box"]
assert result["second_switch"] == ["ford"]