25 lines
1.2 KiB
Python
25 lines
1.2 KiB
Python
from test_est_rea_parity import run
|
|
|
|
|
|
def test_standard_usage_reports_applied_and_source_prices_without_mutation():
|
|
result = run(
|
|
"math",
|
|
"""(()=>{
|
|
const p=EstNative.empty();p.tables.SilJukDat=[{Code:'A',Name:'source',ValueIndex:4,InputTC:120},
|
|
{Code:'B',ValueIndex:4,InputTC:50},{Code:'B',ValueIndex:4,InputTC:60}];
|
|
p.tables.EstMainDat=[{Code:'A',Name:'work',LinkIndex:21,GN:2,TU:100,TC:200},
|
|
{Code:'B',Name:'duplicate',LinkIndex:21,GN:1,TU:45,TC:45},
|
|
{Code:'C',Name:'missing',LinkIndex:21,GN:1,TU:20,TC:20},
|
|
{Code:'A',Name:'material',LinkIndex:5,GN:1,TU:10}];
|
|
const before=JSON.stringify(p), rows=EstStandard.usage(p), print=EstForms.data('standard-usage',p);
|
|
return {rows,print,same:before===JSON.stringify(p)};
|
|
})()""",
|
|
)
|
|
assert result["same"]
|
|
assert [row["status"] for row in result["rows"]] == ["연결됨", "코드 중복", "연결 없음"]
|
|
assert result["rows"][0]["sourcePrice"] == 120
|
|
assert result["rows"][0]["appliedPrice"] == 100
|
|
assert result["rows"][0]["difference"] == -20
|
|
assert result["rows"][1]["sourcePrice"] is None
|
|
assert result["print"]["rows"] == result["rows"]
|