test(est): cover Korean quantity labels
This commit is contained in:
@@ -96,13 +96,13 @@ def test_estx_quantity_item_labels_round_trip_when_sample_exists():
|
||||
pytest.skip("installed EST sample unavailable")
|
||||
script = """const fs=require('fs'),m=require('./tools/est-test/import-estx.cjs'),e=require('./tools/est-test/export-estx.cjs');
|
||||
const p=m.importEstx(fs.readFileSync(process.argv[1])),before=structuredClone(p.quantitySheets),sheet=p.quantitySheets[0];
|
||||
sheet.items[0].Name='changed name';sheet.items[0].Size='changed size';
|
||||
const mismatch=p.quantitySheets.find(s=>s.Code==='N0000000083');mismatch.items[4].Name='preserved mismatch';
|
||||
sheet.items[0].Name='수정된 품명';sheet.items[0].Size='수정 규격';
|
||||
const mismatch=p.quantitySheets.find(s=>s.Code==='N0000000083');mismatch.items[4].Name='수량 보존';
|
||||
const q=m.importEstx(e.exportEstx(p)),item=q.quantitySheets[0].items[0];
|
||||
const restored=q.quantitySheets.find(s=>s.Code==='N0000000083');
|
||||
const other=JSON.stringify(q.quantitySheets[0].items.slice(1))===JSON.stringify(before[0].items.slice(1));
|
||||
const rest=JSON.stringify(q.quantitySheets.filter(s=>s.Code!==sheet.Code && s.Code!==mismatch.Code))===JSON.stringify(before.filter(s=>s.Code!==sheet.Code && s.Code!==mismatch.Code));
|
||||
const preserved=restored.items[4].Name==='preserved mismatch' && restored.items[4].GN===286 && JSON.stringify(restored.rows)===JSON.stringify(before.find(s=>s.Code===mismatch.Code).rows);
|
||||
const preserved=restored.items[4].Name==='수량 보존' && restored.items[4].GN===286 && JSON.stringify(restored.rows)===JSON.stringify(before.find(s=>s.Code===mismatch.Code).rows);
|
||||
p.quantitySheets[0].items[0].TargetCode='new target';let rejected=false;try{e.exportEstx(p)}catch{rejected=true}
|
||||
console.log(JSON.stringify({name:item.Name,size:item.Size,other,rest,preserved,rejected}));"""
|
||||
result = json.loads(
|
||||
@@ -111,8 +111,8 @@ def test_estx_quantity_item_labels_round_trip_when_sample_exists():
|
||||
)
|
||||
)
|
||||
assert result == {
|
||||
"name": "changed name",
|
||||
"size": "changed size",
|
||||
"name": "수정된 품명",
|
||||
"size": "수정 규격",
|
||||
"other": True,
|
||||
"rest": True,
|
||||
"preserved": True,
|
||||
|
||||
Reference in New Issue
Block a user