Files
Aislo/resources/tester/test_416_page_cache.py
T
eomsangdonandClaude Opus 5.5 4046178a5d fix(498-3 저장 모양): 노선 그대로 [저장] = 잠금 없이 뒤에서 · 저장 중 [저장] 막음 · 저장 중 [>] = 앞 저장 끝 뒤 확정 · 결과 한 줄 토스트 걷음 — 요구 298-3 · 302 D1
- 잠금 = 확정 · 노선 모양 바뀐 [저장]만 · 그 밖 [저장]은 뒤에서 · 끝나면 「저장했습니다」
- 줄 세움 queueDesignSave — 저장 중 [저장] = 「이전 수정을 저장 중입니다…」 + 막음 · 저장 중 확정 = 잠그고 기다린 뒤 지금 화면 · 서버 저장 도중 안 끊음
- 저장 도중 고침 = 조각 정리 · 깨끗한 표 건너뜀(초안 남아 다음 저장에서 다시 나감)
- 노선 바뀐 [저장] = 옛 페이지 두 보기 헛 다시 읽기 걷음 · 떠남 표 · 알림만 뒤 다시 세움
- B06 [>] = 고친 것 없음 + 단계 2 · 3 COMPLETE 면 저장 없이 이동 · 그 밖 496 확정 그대로
- 노선 저장 알림 = 따라감 실패 · 새 교차 관 한 줄만(routeSaveSummary · 노선 밖 되풀이 지움)
- 시험 test_298_3_save_shape 새로 · 옛 요약 · 잠금 단언 고쳐 씀

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 00:08:12 +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, reload = true)") :]
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
) # 보기마다 비우면 앞 보기가 받은 새 상세를 또 버림