- B08 줄 [?][<][>][저장][초기화] · POST quantity/reset · 초안 넷 비움 · 이정 저장본 다시 읽음 - B08 B09 쪽 이동 = 저장 뒤 POST quantity/complete · 실패면 머묾 - B09 줄 [?][<][>][초기화] · [내역 초기화] → [초기화] 하나(POST estimation/reset) - B09 [>] = 고친 값 저장 → POST estimation/complete → DRAFT.next(인쇄 미리보기) · 초안 없으면 흐림 - 시험: 새 test_298_2_b08_b09_buttons · test_184_3 · test_304 · test_481_2 고쳐 씀 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
82 lines
2.9 KiB
Python
82 lines
2.9 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", "req:complete", "go:b09"] # 298-2 단계 5 완료
|
|
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", "req:complete", "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
|