Files
Aislo/resources/tester/test_347_2_drainage_live_ui.py
T
eomsangdonandClaude Opus 5.5 e5dc007b40 feat(B05 배수유역): 369-2 [자동 제안] 두 방식 · [배관 배치 초기화] = 세류선만 초안 · 제안 [적용] = 관경 · 시설만
- 배수유역 머리 [자동 제안] → 고름 창(⚙ 창 틀) ① 전체 자동(all) ② 지정 포함 추가(add) · 낡은 동안 끔
- [배관 배치 초기화] — 저장분 즉시 지움 없앰 · 관 목록 없이 셈(세류선 교차만) · 초안
- 셋 다 답이 오면 세션 초안 + 사진첩 한 걸음(400 ms 넘은 답도 제 걸음)
- 제안 목록 [적용] — 관 자리 후보는 안 더함(점선 원 · 목록 그대로) · 관경 · 시설 제안 없으면 꺼짐
- computeDetailBasins(points | null, auto) · 글 = 툴팁 두 값 고침 · 새 글 끝에 새 키
- 시험 — 349 흐름에 자동 제안 · 347_2 · 298 · 312 고쳐 씀

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VmC34fsxxbweEG3RUjs3Mn
2026-10-17 12:00:43 +09:00

58 lines
2.0 KiB
Python

"""347-2 · 347-3 배수유역 자동/수동 · 제안 — 화면 쪽 순수 규칙(logic/ 두 파일).
- 기본 수동 · 자동 = 3 초 조용한 뒤 · 노선 초안이 있을 때만 낡음.
- 늦은 답 버림: 옛 차례 · 서버가 그만둔 답 · 답 차례가 다른 것은 안 올림.
- 제안: 관경(배관 · 추천 ≠ 지금) · 시설(BOX암거 · 세월교) · 관 자리(기존 관 근처 뺌) ·
[적용] = 한 번에 얹음 · 입력 목록은 안 고침(자동 바꿈 없음).
Node 헬퍼(`helper_347_2_drainage_live.cjs`)가 TS 를 그 자리에서 돌린다.
"""
import json
import os
import subprocess
import pytest
HERE = os.path.dirname(os.path.abspath(__file__))
@pytest.fixture(scope="module")
def r():
proc = subprocess.run(
["node", os.path.join(HERE, "helper_347_2_drainage_live.cjs")],
capture_output=True,
text=True,
timeout=60,
encoding="utf-8",
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)
def test_mode_and_stale(r):
assert r["quietMs"] == 3000
assert r["modes"] == ["manual", "auto", "manual"]
assert r["stale"] == [False, True]
def test_late_answers_dropped(r):
assert r["accept"] == [True, False, False, False]
assert r["body"] == {"generation": 5, "route": None, "points": [{"chainage_m": 1}]}
def test_suggestions_collected(r):
assert r["suggestions"] == [
{"kind": "diameter", "chainageM": 100, "from": 1000, "to": 1200},
{"kind": "position", "chainageM": 200},
{"kind": "facility", "chainageM": 300, "from": "pipe", "to": "ford_bridge"},
]
def test_apply_once_without_touching_input(r):
assert r["untouched"]
applied = {pipe["chainage_m"]: pipe for pipe in r["applied"]}
assert sorted(applied) == [100, 300, 500] # 관 자리 후보(200)는 안 더함 — [자동 제안](369)
assert applied[100]["options"]["pipe_diameter_mm"] == 1200
assert applied[300]["facility"] == "ford_bridge"
assert applied[500]["facility"] == "box_culvert" # 이미 그 종류 — 그대로