Files
Aislo/resources/tester/test_472_d_b05_pipe_undo.py
T

82 lines
3.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""PLAN 472 덧 (요구 272) — B05 보기 관 지움 ↶ 가 반쪽만 돌아옴 · 배수유역도도 안 돌아옴.
까닭: ↶ 가 관 초안 없는 걸음(저장분)으로 가면 종단 사진첩이 「처음 본 관 목록」을 배수 판에
줬는데, 그 목록은 판이 저장분을 읽기 전에 잡혀 빈 목록 — 관 하나 프로젝트에서 지운 뒤 판 목록
(빈 목록)과 같아 판이 「같은 목록」으로 멈춤 → 배수 판 · 시설 줄 · 알약 · 목록은 관 없음 ·
묶음은 저장분 관(측점 57) · 누가토량 −17,385.4. B06 보기 ↶ 도 같은 길(배수유역도 관 · 세부유역
빠짐). 가게 구독은 빈 초안(null)을 안 받음. 또 종단 ↶ 단추는 다시 그릴 때만 켜짐을 맞춰 삭제
직후 꺼져 있었음.
고침: 초안 없는 걸음 = null(저장분) → 판이 마지막 저장분 답과 견줘 다르면 조용히 다시 읽음 ·
사진첩 쌓임 · 되돌림 알림에 ↶ ↷ 켜짐 맞춤. TS 는 `helper_472_d_b05_pipe_undo.cjs` 가 Node 로 돌림.
./venv/Scripts/python.exe -m pytest resources/tester/test_472_d_b05_pipe_undo.py -q
"""
from __future__ import annotations
import json
import subprocess
from pathlib import Path
import pytest
HERE = Path(__file__).resolve().parent
ROOT = HERE.parents[1]
pytestmark = pytest.mark.skipif(
not (ROOT / "config" / "node_modules" / "typescript").is_dir(),
reason="프론트엔드 의존성 미설치",
)
def _read(*parts: str) -> str:
return ROOT.joinpath(*parts).read_text(encoding="utf-8")
@pytest.fixture(scope="module")
def out() -> dict:
proc = subprocess.run( # noqa: S603 — 고정 실행 파일
["node", str(HERE / "helper_472_d_b05_pipe_undo.cjs")],
cwd=ROOT,
capture_output=True,
text=True,
encoding="utf-8",
timeout=120,
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)
def test_초안_없는_걸음은_저장분(out) -> None:
"""옛 코드 = 판이 읽기 전 빈 목록([])을 줘 지운 뒤 목록과 같아 멈춤(빨강)."""
assert out["undo"] == {"given": None, "draft": None}
assert out["undo2"]["given"] is None
def test_다시하기는_그_걸음_초안(out) -> None:
assert out["redo"] == {"given": [], "draft": []}
def test_삭제_직후_되돌리기_단추_켜짐(out) -> None:
"""옛 코드 = 종단 도구줄은 다시 그릴 때만 ↶ 켜짐을 맞춤(맞춤 0 번 · 빨강)."""
assert out["afterDelete"]["canUndo"] is True
assert out["afterDelete"]["synced"] >= 1
def test_배수_판_저장분_견줌() -> None:
panel = _read("B05_Profile", "B05_Profile_UI_Drainage_Panel.ts")
# 저장분 답을 받은 때만 견줄 몸통을 적음 · 초안 없는 걸음은 다르면 조용히 다시 읽음
assert "(response) => ((saved = { response, request: null }), response)" in panel
assert (
"if (saved?.response === response) saved.request = JSON.stringify(pipeRequest());" in panel
)
assert (
"return void (JSON.stringify(pipeRequest()) !== saved?.request && run(loadSaved, true));"
in panel
)
assert "if (projectId !== nextProjectId) saved = null;" in panel
tools = _read("B05_Profile", "B05_Profile_UI_Profile_Panel_Tools.ts")
assert "initialPipes" not in tools
profile = _read("A00_Common", "design", "design_profile.ts")
assert "disposeTools();" in profile