- 낡음 판정(B05 · B06 공용 isStaleSection)에 서버 _enforce_stored_designs 짝 셋: 포장 · 기울기(물넘이 · 맹암거) · 세월교 노면 하강 - 구조물 바뀐 뒤 횡단 다시 받으면 낡은 측점 다시 셈(refreshDetailForStructures) - 다시 셈의 세월교 노면 하강 = 그 측점에 얹힌 세월교 제원(옛 저장값 안 이음) - 물넘이포장: 옮기거나 지운 옛 자리 걷고 새 자리 · 걸친 기존 측점에 얹음(빈 관 목록도) - 월류 높이 기다림: 빈 글자도 빈칸(채우는 쪽과 같은 규칙) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C6BNBFXFndbqYxu6sZuknK
82 lines
3.0 KiB
Python
82 lines
3.0 KiB
Python
"""PLAN 314 — 물넘이포장 · 맹암거 후속(요구 210 · 211).
|
|
|
|
- 314-1 · 314-2 · 314-4 저장 전에 놓거나 · 옮기거나 · 종류를 바꾼 구조물 자리 = 저장분 횡단 값(포장 · 기울기 ·
|
|
세월교 노면 하강)과 얹힌 제원이 다르면 낡음 → 다시 셈(서버 `_enforce_stored_designs` 짝) ·
|
|
물넘이포장 옛 자리 걷고 새 자리(걸친 기존 측점까지) 얹음
|
|
- 314-3 월류 높이 기다림 = 빈 글자도 빈칸(채우는 쪽과 같은 규칙)
|
|
|
|
실제 TS 를 `helper_314_stale_structure.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="프론트엔드 의존성 미설치",
|
|
)
|
|
|
|
|
|
def _read(*parts: str) -> str:
|
|
with open(os.path.join(ROOT, *parts), encoding="utf-8") as handle:
|
|
return handle.read()
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def result() -> dict:
|
|
out = subprocess.run(
|
|
["node", os.path.join(HERE, "helper_314_stale_structure.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=120,
|
|
check=True,
|
|
)
|
|
return json.loads(out.stdout)
|
|
|
|
|
|
def test_tilt_mismatch_is_stale(result: dict) -> None:
|
|
# 물넘이포장 · 맹암거 자리인데 저장분이 안 기울었음(측구 있음) = 낡음 · 맞으면 그대로
|
|
assert result["ford_untilted"] is True
|
|
assert result["ford_tilted"] is False
|
|
assert result["underdrain_tilted"] is False
|
|
# 구조물이 떠났는데 저장분이 아직 기울었음(옮김 · 종류 바꿈) = 낡음
|
|
assert result["left_tilted"] is True
|
|
|
|
|
|
def test_paved_and_surface_drop_mismatch_is_stale(result: dict) -> None:
|
|
assert result["pavement_unpaved"] is True
|
|
assert result["ford_drop_missing"] is True
|
|
assert result["ford_drop_kept"] is False
|
|
assert result["plain"] is False
|
|
|
|
|
|
def test_ford_height_wait_treats_blank_as_empty(result: dict) -> None:
|
|
waits = result["waits"]
|
|
assert waits["pave_empty"] is True
|
|
assert waits["pave_blank"] is True
|
|
assert waits["pave_set"] is False
|
|
assert waits["bridge_none"] is True
|
|
assert waits["pipe"] is False
|
|
|
|
|
|
def test_structure_change_reconciles_and_ford_reattach() -> None:
|
|
view = _read("A00_Common", "design", "design_view_cross.ts")
|
|
body = view.split("async function refreshDetailForStructures", 1)[1].split("\n }\n", 1)[0]
|
|
assert "void reconcileStaleDesigns();" in body
|
|
refresh = _read("B06_Section", "B06_Section_Cross_Refresh.ts")
|
|
assert "Number(section.ford?.overflow_depth_m) > 0" in refresh
|
|
store = _read("B06_Section", "B06_Section_Section_Store.ts")
|
|
kinds = store.split("async function withDraftPipeKinds", 1)[1].split("\n}\n", 1)[0]
|
|
assert "if (!pipes) return;" in kinds
|
|
assert "delete section.ford_pavement" in kinds
|
|
assert 'if (!here.length) return pipe.facility === "ford_pavement";' in kinds
|