import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";

const inventorySource = readFileSync(
  fileURLToPath(new URL("../src/views/InventoryLedgerView.vue", import.meta.url)),
  "utf8"
);

assert.match(
  inventorySource,
  /function shouldDisplaySourceMaterialLotNo\(warehouseType\) \{[\s\S]*\["SEMI", "FINISHED", "SCRAP", "RETURN"\]\.includes/,
  "return warehouse should display raw-material source stock lot numbers in lot and transaction tables"
);

assert.match(
  inventorySource,
  /formatSelectedDetailLotNo\(row\)[\s\S]*formatLotSourceLots\(row\)/,
  "return warehouse detail drawer should use the shared source-lot formatter once RETURN is enabled"
);

assert.match(
  inventorySource,
  /formatWarehouseLedgerLotNo\(row\)[\s\S]*formatLotSourceLots\(row\)/,
  "return warehouse ledger should use the shared source-lot formatter once RETURN is enabled"
);

console.log("return warehouse source lot display checks passed");
