- 계산 환경을 기본값으로 저장해 새 내역서에 적용 - 저장 작업을 data/removed 로 옮겨 목록에서만 뺌 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 lines
1.1 KiB
Python
25 lines
1.1 KiB
Python
"""EST 테스트 앱 기본환경 설정·목록에서 삭제(원본 TfrmOption btnSave·TfrmWorkFileList btnDelete)."""
|
|
|
|
import json
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def test_pick_keeps_only_environment_keys_and_store_kind(tmp_path):
|
|
script = """
|
|
const fs = require('fs'), vm = require('vm');
|
|
const ctx = vm.createContext({});
|
|
vm.runInContext(fs.readFileSync('tools/est-test/native-defaults.js', 'utf8'), ctx);
|
|
const picked = vm.runInContext("EstDefaults.pick({ HeadDigits: 2, TotalFix: true, Mode: '설계변경', AutoCalc: false })", ctx);
|
|
const f = require(process.cwd() + '/tools/est-test/forms-store.cjs');
|
|
f.save(process.argv[1], { kind: 'options', name: '기본환경', data: picked });
|
|
process.stdout.write(JSON.stringify({ picked, stored: f.read(process.argv[1]).map((x) => [x.kind, x.name]) }));
|
|
"""
|
|
out = json.loads(
|
|
subprocess.check_output(["node", "-e", script, str(tmp_path)], cwd=ROOT).decode("utf-8")
|
|
)
|
|
assert out["picked"] == {"HeadDigits": 2, "TotalFix": True}
|
|
assert out["stored"] == [["options", "기본환경"]]
|