Files
Aislo/resources/tester/test_481_2_save_move.py
T
eomsangdonandClaude Opus 5.5 197f5b589f feat(481-2 B08 · B09 저장 후 이동): 단계 이동 = 보이는 화면 저장 성공 뒤 · 실패면 머묾
- B08 = 왼쪽 옵션(옵션 · 이정 캐시) → 지금 탭(자재 · 수리 · 떠난 탭 host.isConnected 거짓이면 안 부름) · 캐시 없으면 요청 없이
- 저장 함수(옵션 · 자재 · 수리 · B09 run) 성공 여부 돌려줌 · B09 = 불러오기 전 · 고침 없음이면 요청 없이 이동
- 시험 test_481_2_save_move 새로 · 121 · 122 원본 줄 기대 갱신

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 22:14:21 +09:00

82 lines
2.8 KiB
Python

# -*- coding: utf-8 -*-
"""481-2 B08 · B09 단계 이동(☰ · 진행 단계 · [<] [>]) = 보이는 화면 저장 성공 뒤 · 실패면 머묾.
`helper_481_2_save_move.cjs` 가 진짜 `B08_Quantity_UI_Page.ts` · `B08_Quantity_UI_Options.ts` ·
`B09_Estimation_UI_Shell.ts` 를 가짜 DOM · 가짜 의존 위에서 돌림.
"""
import json
import os
import re
import subprocess
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[2]
HERE = os.path.dirname(os.path.abspath(__file__))
@pytest.fixture(scope="module")
def r():
proc = subprocess.run(
["node", os.path.join(HERE, "helper_481_2_save_move.cjs")],
capture_output=True,
text=True,
encoding="utf-8",
timeout=60,
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)
def test_B08_저장_성공_뒤_이동_왼쪽_다음_지금_탭(r):
b = r["b08"]
assert b["summaryOk"] == ["save:options", "go:b09"]
assert b["materialOk"] == ["save:options", "save:material", "go:b07"]
def test_B08_저장_실패면_머묾(r):
b = r["b08"]
assert b["optionsFail"] == ["save:options"]
assert b["materialFail"] == ["save:options", "save:material"]
assert b["optionsFailSkipsTab"] == ["save:options"]
assert b["hydroFail"] == ["save:options", "save:hydro"]
def test_B08_떠난_탭은_저장_안_부름(r):
assert r["b08"]["leftTab"] == ["save:options", "go:b09"]
def test_B08_좌측_옵션_save(r):
o = r["options"]
assert o["clean"] == [True, []] # 고침 없음 = 요청 없이 참
assert o["changed"] == [True, ["req:PUT", "req:milestone", "redraw"]]
assert o["after"] is False
assert o["milestoneOnly"][0] is True and "req:PUT" in o["milestoneOnly"][1]
assert o["blankPipe"] == [False, []] # 1본 빈칸 = 머묾
assert o["fail"] == [False, ["req:PUT"]]
assert o["keptOnFail"] is True
def test_B09_고친_값_저장_성공_뒤_이동(r):
b = r["b09"]
assert b["beforeLoad"] == ["go:b08"] # 불러오기 전 = 저장 없이(캐시 남음)
assert b["clean"] == ["go:b08"] # 고침 없음 = 요청 없이
assert b["fail"] == ["fetch:PUT:/api/projects/P1/estimation"] # 실패 = 머묾
assert b["ok"] == ["fetch:PUT:/api/projects/P1/estimation", "go:b08"]
def test_자재_수리_탭_저장_등록():
material = (ROOT / "B08_Quantity/B08_Quantity_UI_Material.ts").read_text(encoding="utf-8")
hydro = (ROOT / "B08_Quantity/B08_Quantity_UI_Hydro.ts").read_text(encoding="utf-8")
assert re.search(
r'onSave\?\.\(async \(\) => !readState\("b08-materials", projectId\) \|\| saveAll\(\)\)',
material,
)
assert re.search(
r"onSave\?\.\(async \(\) => !Object\.keys\(drafts\)\.length \|\| saveAll\(\)\)", hydro
)
for src in (material, hydro):
assert "const saveAll = async (): Promise<boolean>" in src