Files
Aislo/resources/tester/test_253_3_haul_preview.py
T
eomsangdonandClaude Opus 5.5 dddef2131c refactor(859-2 ㉮-1): B09 내역 점검 [단가 갱신] · 미리 보기 창 · [재생성] 걷음 — 프로젝트 단가는 지정한 때 그대로
- 화면: 「내역 점검」 카드 [단가 갱신] 단추 · 점 배지 · 호버 · 미리 보기 창([재생성] · [적용]) 걷음 · 연결 점검 목록 그대로
- 서버: POST …/estimation/prices · …/prices/preview 걷음(openapi 469 → 467) · GET 답 `book` · `stale` 칸(매 GET 단가 책 견줌) 걷음
- B09_Estimation_Refresh · B09_Estimation_Copy_Prices 지움(사본 단가 읽기 = 단가.json 바로) · Bill_Library 서고 다시 굳힘(changed · refresh_copy) 걷음
- 단가 책: 첫 굳힘 `make_book`(옛 refresh_book 의 단가 갱신 몫 · book_stale · book_diff · labor_editions 걷음)
- 시험: 죽은 길만 보던 test_296 · test_703_3 지움 · 203_1 배지 · 795_4 ⑤ ⑥ · 719_2 서고 업데이트 지움 · 144 길 = 없음 확인
- test_253_3: B9-4 화면 꼴 뒤 낡은 단언(엑셀 꼴 식 글)을 작업량 값 줄로 고침

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 21:54:15 +09:00

63 lines
2.8 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.
"""253-3 미리보기 길 `POST …/estimation/logic-preview` + 「운반 단가」 모달 — 거리이정표 우클릭 ·
설계내역서 운반공 줄에서 엶."""
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT))
from B08_Quantity.B08_Quantity_Haul_Cycle import cycle_time # noqa: E402
from B09_Estimation.B09_Estimation_Bill_Items import haul_items # noqa: E402
from B09_Estimation.B09_Estimation_Router import PreviewBody, logic_preview, router # noqa: E402
def _src(name: str) -> str:
return (ROOT / name).read_text(encoding="utf-8")
def test_미리보기_계산_절차(tmp_path):
cm = cycle_time({"L1": 25.1, "L2": 0.8})["cm"]
given = {"qt": 15, "f": 1, "E": 0.9, "Cm": cm, "지역": "전국평균"}
got = logic_preview(tmp_path, PreviewBody(code="GF000134", given=given))
assert got["unit"] == "㎥" and got["price"] and got["price"] > 0
assert "Cm : 109.78 분" in got["lines"]
assert "작업량 = 7.378 ㎥/hr" in got["lines"] # 60 × 15 × 1 × 0.9 ÷ 109.78(B9-4 화면 꼴)
assert got["lines"][-1].startswith("계 :")
# 거리 늘면 단가도 늘음
far = logic_preview(tmp_path, PreviewBody(code="GF000134", given={**given, "Cm": 200}))
assert far["price"] > got["price"]
def test_미리보기_길():
paths = {(r.path, tuple(r.methods)) for r in router.routes}
assert ("/api/projects/{project_id}/estimation/logic-preview", ("POST",)) in paths
def test_내역_줄_거리():
one = {"ref": None}
routes = [
{**one, "key": "haul:3", "name": "모래운반", "user": False, "L1": 25.1, "L2": 0.8},
{**one, "key": "haul:r-u1", "name": "깬돌운반", "user": True, "L1": 3, "L2": 1},
]
items = {i["key"]: i for i in haul_items(None, {}, routes)}
assert items["haul:3"]["dist"] == {"L1": 25.1, "L2": 0.8}
assert items["haul:r-u1"]["dist"] == {"L1": 3, "L2": 1}
assert items["haul:1"]["dist"] is None
def test_모달_여는_곳():
modal = _src("B09_Estimation/B09_Estimation_UI_Haul_Modal.ts")
for want in ("/estimation/logic-preview", "openPriceLink", "fetchLogicInputs", "fillGiven",
"cycleInputs", "my !== seq", "자동계산", "[고르기]"): # fmt: skip
assert want in modal, want
milestone = _src("B08_Quantity/B08_Quantity_UI_Milestone.ts")
assert "openHaulModal({" in milestone and "L1: paved" in milestone
link = _src("B09_Estimation/B09_Estimation_UI_Tabs_Bill_Link.ts")
assert '[["단가연결", haul && ref ? haulModal : priceLink]]' in link # 276 연결 있는 줄만
edit = _src("B09_Estimation/B09_Estimation_UI_Tabs_Bill_Edit.ts")
assert (
'key.startsWith("haul:")' in edit
and "linkItems(ctx, ref, applyRef(ctx, rows, i), haul)" in edit
)