ForgeFlow-ERP/frontend/scripts/test-sales-out-packaging-remark.mjs
2026-06-12 16:00:56 +08:00

35 lines
1.1 KiB
JavaScript

import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
const viewPath = path.resolve("src/views/InventoryLedgerView.vue");
const source = fs.readFileSync(viewPath, "utf8");
assert.match(source, /<span>包装备注<\/span>/, "sales out drawer should show the packaging remark field");
assert.match(
source,
/placeholder="有无提供篮子等"/,
"packaging remark field should guide the user with the requested placeholder"
);
assert.match(
source,
/remark:\s*""/,
"delivery form state should include a remark field so the packaging remark is reset with the drawer"
);
assert.match(
source,
/remark:\s*deliveryForm\.remark\s*\|\|\s*null,[\s\S]*items:\s*allocationRows\.value\.map/,
"sales out payload should persist the packaging remark on the delivery header"
);
assert.match(
source,
/unit_price:\s*Number\(selectedSalesOrderItem\.value\?\.unit_price\s*\|\|\s*0\),\s*remark:\s*deliveryForm\.remark\s*\|\|\s*null/,
"sales out payload should copy the packaging remark onto generated delivery detail rows"
);
console.log("sales out packaging remark checks passed");