51 lines
2.0 KiB
JavaScript
51 lines
2.0 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
|
|
const source = fs.readFileSync(path.resolve("src/views/InventoryLedgerView.vue"), "utf8");
|
|
const backendInventorySource = fs.readFileSync(path.resolve("../backend/app/api/routes/inventory.py"), "utf8");
|
|
|
|
assert.match(
|
|
source,
|
|
/const isOutsourcingScrapInbound = computed\(\(\) =>[\s\S]*activeWarehouseType\.value === "SCRAP"[\s\S]*activeOperation\.value\?\.bizType === "OUTSOURCING_SCRAP_IN"/,
|
|
"outsourcing scrap inbound should have an explicit state flag"
|
|
);
|
|
|
|
assert.match(
|
|
source,
|
|
/isProductTraceOnlySourceLotInbound\.value \|\| isOutsourcingScrapInbound\.value/,
|
|
"outsourcing scrap inbound should use the product-to-raw-material source lot selector"
|
|
);
|
|
|
|
assert.match(
|
|
source,
|
|
/!isFinishedOutsourcingInbound && !isProductionScrapInbound && !isOutsourcingScrapInbound/,
|
|
"outsourcing scrap inbound should hide the manual lot number field"
|
|
);
|
|
|
|
assert.match(
|
|
source,
|
|
/:allow-unavailable="isSourceLotReturnInbound \|\| isSemiSourceLotTraceInbound \|\| isOutsourcingScrapInbound"/,
|
|
"outsourcing scrap inbound should show both available and unavailable raw-material source lots"
|
|
);
|
|
|
|
assert.match(
|
|
source,
|
|
/isProductTraceOnlySourceLotInbound\.value \|\| isOutsourcingScrapInbound\.value[\s\S]*\? selectedTraceSourceLotNos/,
|
|
"outsourcing scrap inbound should submit source lot numbers through source material trace fields"
|
|
);
|
|
|
|
assert.match(
|
|
backendInventorySource,
|
|
/is_outsourcing_scrap_source_lot_trace_inbound\s*=\s*warehouse_type == "SCRAP" and biz_type == "OUTSOURCING_SCRAP_IN"/,
|
|
"backend should classify outsourcing scrap inbound as product raw-material source lot trace inbound"
|
|
);
|
|
|
|
assert.match(
|
|
backendInventorySource,
|
|
/is_product_raw_source_lot_trace_inbound = \([\s\S]*is_outsourcing_scrap_source_lot_trace_inbound[\s\S]*\)/,
|
|
"backend should validate selected raw-material source lots for outsourcing scrap inbound"
|
|
);
|
|
|
|
console.log("outsourcing scrap inbound source lot checks passed");
|