- 작업모드 값(CurrentWorkMode) ESTX 읽기·쓰기 - 일반↔표준 묶음 바꿀 때 원가계산서 보관·꺼내기, 없으면 설치 양식(일반·표준 각 30종)에서 고르기 - 저장한 작업 중 계약심사 작업 목록 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
58 lines
2.0 KiB
Python
58 lines
2.0 KiB
Python
"""작업모드: 일반↔표준 원가계산서 묶음 보관·꺼내기, 설치 양식목록 읽기."""
|
|
|
|
import json
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from test_est_rea_parity import run
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
INSTALL = Path("C:/Dasansoft/Est Plus 2/System/MainSys/SWongaFileList.dat")
|
|
|
|
|
|
def test_swap_keeps_each_group_wonga():
|
|
result = run(
|
|
"math",
|
|
"""(()=>{
|
|
const p=EstNative.empty();p.tables.Wonga=[{Name:'일반'}];
|
|
const a=EstWorkMode.swap(p,3);const std=p.tables.Wonga.length;
|
|
p.tables.Wonga=[{Name:'표준'}];
|
|
const b=EstWorkMode.swap(p,4);
|
|
const c=EstWorkMode.swap(p,1);const back=p.tables.Wonga.map(r=>r.Name);
|
|
const d=EstWorkMode.swap(p,3);
|
|
return {a,std,b,c,back,d,now:p.tables.Wonga.map(r=>r.Name),mode:p.options.WorkMode,
|
|
kept:Object.keys(p.wongaByGroup)};
|
|
})()""",
|
|
)
|
|
assert result["a"] == {"changed": True, "found": False}
|
|
assert result["std"] == 1
|
|
assert result["b"] == {"changed": False}
|
|
assert result["c"] == {"changed": True, "found": True}
|
|
assert result["back"] == ["일반"]
|
|
assert result["d"] == {"changed": True, "found": True}
|
|
assert result["now"] == ["표준"]
|
|
assert result["mode"] == 3
|
|
assert result["kept"] == ["general"]
|
|
|
|
|
|
@pytest.mark.skipif(not INSTALL.exists(), reason="원본 설치 폴더 없음")
|
|
def test_install_wonga_formats_read():
|
|
out = subprocess.check_output(
|
|
[
|
|
"node",
|
|
"-e",
|
|
"const w=require(process.argv[1]);const g=w.get(false),s=w.get(true);"
|
|
"const f=w.get(true,s[0].index);"
|
|
"console.log(JSON.stringify({g:g.length,s:s.length,rows:f.rows.length,"
|
|
"cost:f.rows.some(r=>'Cost' in r),first:f.rows[0].LinkIndex}))",
|
|
str(ROOT / "tools/est-test/wonga-formats.cjs"),
|
|
],
|
|
text=True,
|
|
encoding="utf-8",
|
|
)
|
|
result = json.loads(out)
|
|
assert result["g"] == 30 and result["s"] == 30
|
|
assert result["rows"] > 10 and result["cost"] is False and result["first"] == 54
|