Files
Aislo/resources/tester/test_416_page_cache.py
T
eomsangdonandClaude Opus 5.5 1db2f8f448 fix(B05·B06 한 페이지): 횡단 다시 셈 뒤 좌측 시설 폼 자동 칸 다시 그림 — 관 옮긴 뒤 관 길이 = B06 카드 (416-1)
- design_shared crossDesignsUpdated 한 곳 — 두 보기 알림 + 좌측 시설 폼 recount(관 길이 · 흙막이 수)
- 관을 옮긴 순간 셈한 옛 길이(6.9)가 횡단이 늦게 선 뒤에도 남던 것(캐시 6.6 · B06 카드 L=7 m (6.6))
- 시험 test_416_page_cache.py 한 칸 더

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

98 lines
3.7 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")
assert "peekSectionDetail(projectId, pageRouteId(projectId))?.cross_sections" 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
) # 보기마다 비우면 앞 보기가 받은 새 상세를 또 버림