Files
Aislo/resources/tester/test_416_page_cache.py
T
eomsangdonandClaude Opus 5.5 35758ac6ea fix(428 관 옮김 횡단 한 값): 옮긴 시설 측점 기본 설계 · 다시 셈 미교차 넓힘 · 관 PUT 끝 측점 세움 · 따라가기만 한 관 서버 누가거리
- 측점 갈아끼움 — 상단측 새 지반으로 · 0.5 m 넘게 옮긴 관 · 구조물 측점 = 기본 설계 + 사용자가 만진 칸
- 노선 초안 동안 관 길이 = 계산 줄 새 노선 상세
- 저장 노선 다시 셈 창구에 미교차 넓힘(서버 extend_unclosed 짝 · 격자 유무 지문)
- 관 PUT 끝 서버가 측점 다시 세움 · GET 관 지점에 x · y
- rebasePipeDraft — 땅 위 자리 = 정본인 관은 서버 누가거리
- 「측점이 없는 구조물」 알림 — 관 · 구조물 초안이 비면 저장 끝난 뒤 다시 봄
- 시험 test_428_pipe_move_mirror(옮긴 관 관 길이 브라우저 대 서버) · 416 출처 글 맞춤

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VmC34fsxxbweEG3RUjs3Mn
2026-10-18 15:53:03 +09:00

102 lines
3.8 KiB
Python

"""PLAN 416 sub5 — 한 페이지 끊김 ② : 저장 뒤 새 자료(M1) · 관 길이 출처(M5) · 오른쪽 판 노선 id(L2) · 암선 기본 config.
짝: `helper_416_page_cache.cjs`(진짜 상세 가게 · 평면 횡단 판 자료 · 관 길이 · 페이지 노선 칸 · 서버 · 그림 가짜).
"""
from __future__ import annotations
import json
import subprocess
from pathlib import Path
import pytest
HERE = Path(__file__).resolve().parent
ROOT = HERE.parents[1]
def _read(rel: str) -> str:
return (ROOT / rel).read_text(encoding="utf-8")
@pytest.fixture(scope="module")
def r() -> dict:
proc = subprocess.run( # noqa: S603, S607 — 고정 실행 파일
["node", str(HERE / "helper_416_page_cache.cjs")],
capture_output=True,
text=True,
encoding="utf-8",
timeout=60,
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)
def test_L2_판은_페이지_노선_상세(r):
assert r["l2"]["station"] == "b05-cur-r3-40" # 캐시에 더 큰 노선 9 가 있어도
assert r["l2"]["noRoute"] is None and r["l2"]["exact"] is True
assert r["l2"]["draftNoSaved"] is None # 노선 초안 중 = 저장 상세 안 씀
def test_암선_기본은_config(r):
assert r["rock"] == {"pending": -0.5, "config": -0.8}
src = _read("B05_Profile/B05_Profile_UI_RouteEdit_Cross_Card.ts")
assert "readRockBoundaryDefault(projectId)" in src
assert "?? -0.5" not in src
def test_M5_관_길이는_공용_캐시(r):
assert r["m5"] == {"before": 8, "cleared": None, "after": 11}
page = _read("A00_Common/design/design_page.ts")
# 노선 초안 동안 = 계산 줄 새 노선 상세 · 그 밖 = 공용 캐시(428)
assert (
"(pipelineDetail(projectId) ?? peekSectionDetail(projectId, pageRouteId(projectId)))"
in page
)
found = subprocess.run( # noqa: S603, S607 — 고정 실행 파일
["git", "grep", "-l", "setPipeSectionsSource(", "--", "*.ts"],
cwd=ROOT,
capture_output=True,
text=True,
encoding="utf-8",
).stdout.split()
# 거는 곳 = 페이지 하나(보기마다 걸면 마지막 연 보기 사본)
assert sorted(found) == [
"A00_Common/design/design_page.ts",
"A00_Common/design/design_structure_pipe_calc.ts",
]
def test_M5_횡단_다시_셈_뒤_좌측_폼_다시_그림():
shared = _read("A00_Common/design/design_shared.ts")
body = shared[shared.index("function crossDesignsUpdated(") :]
body = body[: body.index("\n}\n")]
assert "shared.structures?.facility.recount()" in body
# 종단도 알림 · 저장 노선 다시 셈 두 길 다 이 함수로
assert "onCrossDesignsUpdated: (updated) => crossDesignsUpdated(shared, updated)" in shared
assert "if (updated.length) crossDesignsUpdated(shared, updated);" in shared
assert 'toAll(shared, "onCrossDesignsUpdated")' in body
def test_M1_비운_뒤_두_보기는_새_객체_하나(r):
assert r["m1"] == {
"sameObject": True,
"fetched": 1,
"fresh": True,
"panelSeesFresh": "b05-cur-r3-40",
}
def test_M1_저장_끝_한_번_비우고_종단_다시_읽음():
shared = _read("A00_Common/design/design_shared.ts")
done = shared[shared.index("done: async (isConfirm)") :]
assert done.index("invalidateSectionDetail(shared.projectId)") < done.index("profileSave?.done")
actions = _read("B05_Profile/B05_Profile_UI_Page_Actions.ts")
tail = actions[actions.index("done: async") :]
assert tail.index("ctx.loadLatest(true)") < tail.index("ctx.restoreSections(routeId)")
assert "invalidateSectionDetail" not in actions
persist = _read("B06_Section/B06_Section_UI_Page_Persist.ts")
assert (
"invalidateSectionDetail" not in persist
) # 보기마다 비우면 앞 보기가 받은 새 상세를 또 버림