test(est): cover combined quantity edits

This commit is contained in:
2026-11-07 15:41:32 +09:00
parent d02fa37723
commit f6e7095e3e
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -182,18 +182,20 @@ def test_estx_quantity_edit_preserves_other_documents_and_indexes_when_sample_ex
pytest.skip("installed EST main sample unavailable")
script = """const fs=require('fs'),m=require('./tools/est-test/import-estx.cjs'),e=require('./tools/est-test/export-estx.cjs');
const bytes=fs.readFileSync(process.argv[1]),p=m.importEstx(bytes),first=p.quantitySheets[0];
first.items[0].Name='changed name';first.items[0].Size='changed size';
first.rows[0].LineData=first.rows[0].LineData.replace('표준','시험 표준');
const index=first.rows.findIndex(r=>r.LineData.includes('B = 9.00'));
if(index<0)throw Error('기준 폭 행 없음');
first.rows[index].LineData=first.rows[index].LineData.replace('9.00','10.00');
const out=e.exportEstx(p),q=m.importEstx(out),a=m.unzip(bytes),b=m.unzip(out);
const unchanged=[...a].filter(([k])=>k.endsWith('.idx')||k.startsWith('cad')).every(([k,v])=>v.equals(b.get(k)));
process.stdout.write(JSON.stringify({line:q.quantitySheets[0].rows[0].LineData,quantity:q.quantitySheets[0].items[0].GN,result:q.quantitySheets[0].rows.find(r=>r.markers.includes('r000000')).LineData,others:JSON.stringify(q.quantitySheets.slice(1))===JSON.stringify(p.quantitySheets.slice(1)),unchanged}));"""
process.stdout.write(JSON.stringify({line:q.quantitySheets[0].rows[0].LineData,quantity:q.quantitySheets[0].items[0].GN,name:q.quantitySheets[0].items[0].Name,size:q.quantitySheets[0].items[0].Size,result:q.quantitySheets[0].rows.find(r=>r.markers.includes('r000000')).LineData,others:JSON.stringify(q.quantitySheets.slice(1))===JSON.stringify(p.quantitySheets.slice(1)),unchanged}));"""
result = json.loads(
subprocess.check_output(["node", "-e", script, str(sample)], cwd=ROOT).decode("utf-8")
)
assert "시험 표준" in result["line"]
assert result["quantity"] == 116
assert result["name"] == "changed name" and result["size"] == "changed size"
assert "\x12116\x12" in result["result"]
assert result["others"] and result["unchanged"]