fix: align drainage frontend configuration
This commit is contained in:
@@ -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([]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user