fix: align drainage frontend configuration

This commit is contained in:
2026-07-22 15:01:35 +08:00
parent 72850761ce
commit 0995172828
45 changed files with 853 additions and 339 deletions
+39
View File
@@ -0,0 +1,39 @@
import { readdirSync, readFileSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
const workbenchRoot = join(process.cwd(), "src/features/workbench");
const forbiddenSupplyTerms = [
"给水管线",
"供水管网",
"阀门",
"保供",
"需水量",
"东直门",
"DN600",
"爆管",
"消防栓",
"低压片区"
] as const;
function listRuntimeFiles(directory: string): string[] {
return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
const target = join(directory, entry.name);
if (entry.isDirectory()) return listRuntimeFiles(target);
if (!/\.(ts|tsx)$/.test(entry.name) || /\.(test|e2e)\.(ts|tsx)$/.test(entry.name)) return [];
return [target];
});
}
describe("drainage domain boundary", () => {
it("does not reintroduce supply-only operating language", () => {
const violations = listRuntimeFiles(workbenchRoot).flatMap((file) => {
const source = readFileSync(file, "utf8");
return forbiddenSupplyTerms
.filter((term) => source.includes(term))
.map((term) => `${file.replace(`${workbenchRoot}/`, "")}: ${term}`);
});
expect(violations).toEqual([]);
});
});