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

33 lines
990 B
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,
/function\s+orderPendingProductSummary\s*\(/,
"sales order dropdown should build a pending product summary"
);
assert.match(
source,
/orderPendingProductSummary\(order\.order_id\)/,
"sales order dropdown should show pending product names next to the pending quantity"
);
assert.doesNotMatch(
source,
/:disabled="[^"]*totalAllocatedQty\s*<\s*Number\(deliveryForm\.delivery_qty\s*\|\|\s*0\)[^"]*"/,
"sales out submit button should not be disabled by insufficient stock, otherwise the error message cannot show"
);
assert.match(
source,
/本次要发[\s\S]*可发[\s\S]*缺/,
"sales out validation should explain requested quantity, available quantity, and shortage"
);
console.log("sales out drawer feedback checks passed");