# -*- coding: utf-8 -*- """472-5 5-C — 종단 편집 · 페이지 설정 값 주인 = 설계 가게 칸 하나. 옛 흠: 종단 편집은 모듈 사본(EditState)이 지금 값을 쥐어 ↶ 뒤 다른 창구가 옛 값 · [저장] 뒤 ↶ 가 저장 전 서버 값으로 돌아감 · 페이지 설정 ↶ 는 세션 칸만 돌아오고 폼 · 기울기 한도는 안 들음(N6) · 최소고 강제는 결과 통 사본 칸(N7). """ from __future__ import annotations import json import subprocess from pathlib import Path import pytest ROOT = Path(__file__).resolve().parents[2] HELPER = ROOT / "resources" / "tester" / "helper_472_5_value_owner.cjs" pytestmark = pytest.mark.skipif( not (ROOT / "config" / "node_modules" / "typescript").is_dir(), reason="프론트엔드 의존성 미설치", ) @pytest.fixture(scope="module") def got() -> dict: run = subprocess.run( ["node", str(HELPER)], capture_output=True, text=True, encoding="utf-8", timeout=120 ) assert run.returncode == 0, run.stderr return json.loads(run.stdout) Y = {"station_offsets": {"20.000": 0.2}, "curve_radii": {"40.000": 30}} X = {"station_offsets": {"20.000": 0.5}, "curve_radii": {"40.000": 30}} def test_되돌리면_두_창구가_같은_값(got): assert got["undo"]["a"] == Y assert got["undo"]["b"] == Y assert got["undo"]["aDirty"] is True assert got["undo"]["resync"] is True # 다시 셈 assert got["undo"]["again"] is False # 같은 값 = 다시 셈 예약 없음 def test_저장_뒤_되돌려도_저장한_값(got): assert got["afterSave"] == {"edits": X, "dirty": False, "canRestore": False} def test_페이지_설정_되돌리면_가게가_알림(got): assert got["settingsHeard"][-1] is None # ↶ 로 초안이 빔 → 듣는 쪽이 저장 설정으로 다시 얹음 def test_최소고_강제는_페이지_설정_한_칸(got): assert got["enforceSaved"] is True assert got["enforceDraft"] is False assert got["copyKey"] == "none"