30 lines
2.2 KiB
JavaScript
30 lines
2.2 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import path from "node:path";
|
|
|
|
const root = process.cwd();
|
|
const read = (relativePath) => readFileSync(path.join(root, relativePath), "utf8");
|
|
|
|
const router = read("src/router/index.js");
|
|
const app = read("src/App.vue");
|
|
const productionLedger = read("src/views/ProductionLedgerView.vue");
|
|
const inventory = read("src/views/InventoryLedgerView.vue");
|
|
|
|
assert.match(router, /ProductionLedgerView/, "router should import ProductionLedgerView");
|
|
assert.match(router, /name:\s*"production-ledger"/, "router should expose production-ledger route");
|
|
assert.match(router, /path:\s*"\/work-order-ledger"[\s\S]*redirect:\s*\{\s*name:\s*"production-ledger"\s*\}/, "old work-order-ledger route should redirect to production-ledger");
|
|
assert.match(app, /生产台账/, "sidebar should show 生产台账");
|
|
assert.doesNotMatch(app, /工单台账/, "sidebar should no longer show 工单台账");
|
|
assert.match(productionLedger, /材料库存批次号/, "production ledger page should use material stock lot number");
|
|
assert.match(productionLedger, /产品/, "production ledger page should show product");
|
|
assert.match(productionLedger, /库外未闭环重量/, "production ledger page should show outside weight");
|
|
assert.match(productionLedger, /该批材料结单/, "production ledger page should expose material batch lock action");
|
|
assert.match(inventory, /生产台账入库/, "inventory unified inbound should be renamed to production ledger inbound");
|
|
assert.match(inventory, /该批材料结单/, "inventory close action should use material batch close wording");
|
|
assert.match(inventory, /production-ledger-inbounds\/preview/, "inventory preview should use production ledger inbound endpoint");
|
|
assert.match(inventory, /production-ledger-inbounds/, "inventory submit should use production ledger inbound endpoint");
|
|
assert.match(inventory, /source_doc_type:\s*isProductionSurplusInbound\.value\s*\?\s*"PRODUCTION_LEDGER"/, "production surplus should link production ledger source");
|
|
assert.match(inventory, /source_doc_type:\s*isProductionScrapInbound\.value\s*\?\s*"PRODUCTION_LEDGER"/, "production scrap should link production ledger source");
|
|
|
|
console.log("production batch ledger UI static checks passed");
|