feat(est): apply all quantity sheets
This commit is contained in:
@@ -1,6 +1,26 @@
|
||||
from test_est_rea_parity import run
|
||||
|
||||
|
||||
def test_apply_all_quantities_sums_sheets_and_rejects_errors_atomically():
|
||||
result = run(
|
||||
"math",
|
||||
"""(()=>{
|
||||
const p=EstNative.empty();p.tables.EstMainDat=[{PkID:1,Code:'A',GN:1},{PkID:2,Code:'B',GN:2}];
|
||||
p.quantities=[{Code:'Q1',formula:'2',TargetKey:'id:1'}];
|
||||
p.quantitySheets=[{Code:'S1',Name:'sheet',options:{},rows:[{LineData:'3 = \\x120\\x12',markers:['a']}],
|
||||
items:[{Code:'a',TargetKey:'id:1'}]},
|
||||
{Code:'S2',Name:'sheet2',options:{},rows:[{LineData:'4 = \\x120\\x12',markers:['b']}],
|
||||
items:[{Code:'b',TargetKey:'id:2'}]}];
|
||||
const values=EstQuantity.allTotals(p);EstQuantity.applyTotals(p,values);
|
||||
const updated=p.tables.EstMainDat.map(row=>row.GN),before=JSON.stringify(p.tables.EstMainDat);
|
||||
p.quantitySheets[1].rows[0].LineData='bad';let rejected=false;
|
||||
try{EstQuantity.applyTotals(p,EstQuantity.allTotals(p))}catch{rejected=true}
|
||||
return {updated,rejected,unchanged:before===JSON.stringify(p.tables.EstMainDat)};
|
||||
})()""",
|
||||
)
|
||||
assert result == {"updated": [5, 4], "rejected": True, "unchanged": True}
|
||||
|
||||
|
||||
def test_quantity_apply_requires_one_detail_row_per_code():
|
||||
result = run(
|
||||
"math",
|
||||
|
||||
Reference in New Issue
Block a user