- 704-2 Labor_Sheet 줄 · 소계 · 계 = calcSheetRows(표본 셋 DOM 전후 같음) - 새 M01_MasterData_UI_LogicLab_Est.ts — /text 묶음 그대로 · 묶음이 쓰는 시험 입력(714-3 usedInputs) = 머리 변수 칸 · 「준비 중」 자리 걷음 - 낡은 시험 test_704_logic_standard 고침 — 계산서가 계산 줄 부품을 공용 계산서 안에서 씀(import 자리만 바뀜) - 새 지킴 시험 test_714_2_calc_sheet Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
48 lines
1.9 KiB
Python
48 lines
1.9 KiB
Python
"""714-2 공용 단가산출 계산서 지킴 시험 — 글 · 순수 함수(화면 · 서버 없음).
|
||
|
||
- 704-2 M02 계산서 보기 · M01 「인력·재료·경비」 보기가 한 벌(`A00_Common/calc_sheet.ts`)을 씀
|
||
- 계산서는 부품 상자만(날 단추 · 입력 · 표 없음) · 화면에서 다시 셈 안 함(값 = 서버)
|
||
"""
|
||
|
||
import json
|
||
import shutil
|
||
import subprocess
|
||
from pathlib import Path
|
||
|
||
import pytest
|
||
|
||
ROOT = Path(__file__).resolve().parents[2]
|
||
SHEET = ROOT / "A00_Common" / "calc_sheet.ts"
|
||
|
||
|
||
def _text(p: Path) -> str:
|
||
return p.read_text(encoding="utf-8")
|
||
|
||
|
||
def test_한_벌을_씀():
|
||
m02 = _text(ROOT / "M02_MasterTemplete" / "M02_MasterTemplete_Labor_Sheet.ts")
|
||
est = _text(ROOT / "M01_MasterData" / "M01_MasterData_UI_LogicLab_Est.ts")
|
||
detail = _text(ROOT / "M01_MasterData" / "M01_MasterData_UI_LogicLab_Detail.ts")
|
||
assert "calcSheetRows(" in m02 and "createCalcFormulaRow" not in m02
|
||
assert "calcSheetRows(" in est and "buildEst(" in detail
|
||
|
||
|
||
def test_부품_상자만():
|
||
s = _text(SHEET)
|
||
assert "<button" not in s and "document.createElement" not in s and "<table" not in s
|
||
assert "@ui/ui_template_calc_row" in s and "@ui/ui_template_input" in s
|
||
|
||
|
||
@pytest.mark.skipif(shutil.which("node") is None, reason="node 가 없음")
|
||
def test_식_글():
|
||
s = _text(SHEET)
|
||
pure = s[s.index("export const sheetFormula") : s.index("/** 변수 칸 하나")]
|
||
body = 'console.log(JSON.stringify([sheetFormula("268,908 * 0.12 = 32,269"), sheetFormula("59,020 * 1 * 8 / 165 = 2,862"), sheetFormula("")]))'
|
||
out = subprocess.run(
|
||
["node", "--experimental-strip-types", "--no-warnings",
|
||
"--input-type=module-typescript", "-e", pure + "\n" + body],
|
||
capture_output=True, text=True, encoding="utf-8", timeout=60,
|
||
) # fmt: skip
|
||
assert out.returncode == 0, out.stderr
|
||
assert json.loads(out.stdout) == ["268,908 × 0.12", "59,020 × 1 × 8 / 165", ""]
|