ForgeFlow-ERP/frontend/scripts/test-delivery-overview-rename.mjs
2026-06-12 16:00:56 +08:00

26 lines
1.4 KiB
JavaScript

import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
const appSource = fs.readFileSync(path.resolve("src/App.vue"), "utf8");
const routerSource = fs.readFileSync(path.resolve("src/router/index.js"), "utf8");
const deliveryWorkspaceSource = fs.readFileSync(path.resolve("src/views/DeliveryWorkspaceView.vue"), "utf8");
const scrapReworkSource = fs.readFileSync(path.resolve("src/views/ScrapReworkView.vue"), "utf8");
assert.match(appSource, /label:\s*"发货概览"/, "left menu module label should be renamed to 发货概览");
assert.match(routerSource, /title:\s*"发货概览"/, "route title should be renamed to 发货概览");
assert.match(deliveryWorkspaceSource, /eyebrow="发货概览"/, "delivery workspace eyebrow should use 发货概览");
assert.match(deliveryWorkspaceSource, /发货概览模块/, "delivery workspace description should use 发货概览");
assert.match(scrapReworkSource, /发货概览模块/, "scrap/rework guidance should use the renamed module");
for (const [file, source] of [
["src/App.vue", appSource],
["src/router/index.js", routerSource],
["src/views/DeliveryWorkspaceView.vue", deliveryWorkspaceSource],
["src/views/ScrapReworkView.vue", scrapReworkSource]
]) {
assert.doesNotMatch(source, /发货与售后/, `${file} should not keep the old delivery module name`);
}
console.log("delivery overview rename checks passed");