27 lines
2.5 KiB
JavaScript
27 lines
2.5 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
|
|
const viewPath = path.resolve("src/views/PurchaseReceiptView.vue");
|
|
const source = fs.readFileSync(viewPath, "utf8");
|
|
|
|
assert.doesNotMatch(source, /合并到已有批次|入库批次处理|merge_to_lot_id|merge_mode/, "purchase receipt UI must not expose legacy lot merge controls");
|
|
assert.doesNotMatch(source, /YL-NB|buildDefaultLotNo/, "purchase receipt UI must not generate legacy YL-NB lot numbers");
|
|
assert.doesNotMatch(source, /送货单号|supplier_delivery_no/, "purchase receipt UI should not keep the duplicate supplier delivery number field");
|
|
assert.match(source, /后端自动生成库存批次号|系统自动生成库存批次号/, "purchase receipt UI should explain that inventory lot numbers are generated by the backend");
|
|
assert.match(source, /uploadResource/, "purchase receipt UI should upload logistics auxiliary photos");
|
|
assert.match(
|
|
source,
|
|
/if\s*\(\s*selectedPurchaseTargetType\.value\s*===\s*["']RAW["']\s*\)\s*\{[\s\S]*key:\s*["']waybill_no["'][\s\S]*label:\s*["']运单号["'][\s\S]*key:\s*["']order_photo["'][\s\S]*label:\s*["']辅助照片["']/,
|
|
"raw purchase receipt UI should show waybill and auxiliary photo fields"
|
|
);
|
|
assert.match(source, /validateLogisticsForm\s*\(\s*\)/, "raw purchase receipt submit should validate logistics information before posting");
|
|
assert.match(source, /waybill_no:\s*selectedPurchaseTargetType\.value\s*===\s*["']RAW["']\s*\?\s*form\.waybill_no/, "purchase receipt payload should include raw waybill number");
|
|
assert.match(source, /order_photo_url:\s*selectedPurchaseTargetType\.value\s*===\s*["']RAW["']\s*\?\s*form\.order_photo_url/, "purchase receipt payload should include raw auxiliary photo URL");
|
|
assert.match(source, /freight_amount:\s*selectedPurchaseTargetType\.value\s*===\s*["']RAW["']\s*\?\s*Number\(form\.freight_amount\)/, "purchase receipt payload should include raw freight amount");
|
|
assert.match(source, /function\s+formatReceiptOrderOption\s*\(order\)/, "purchase receipt order dropdown should use a formatter");
|
|
assert.match(source, /formatReceiptOrderMaterialNames\s*\(order\.purchase_order_id\)/, "purchase receipt order option should append material names from purchase order items");
|
|
assert.match(source, /<option v-for="order in receivableOrders"[\s\S]*{{ formatReceiptOrderOption\(order\) }}/, "purchase receipt order dropdown should render formatted options with material names");
|
|
|
|
console.log("purchase receipt inventory lot UI checks passed");
|