feat: add local auth billing and usage management
This commit is contained in:
1 parent
f642b5e71f
commit
196fdde83f
119 files changed
+15695
-2650
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import { readdir, readFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const forbiddenCopy = [
|
||||
"本地",
|
||||
"开发环境",
|
||||
"Mock",
|
||||
".runtime/",
|
||||
"演示用户"
|
||||
];
|
||||
|
||||
describe("production-facing copy", () => {
|
||||
it("does not expose development or implementation labels in React UI", async () => {
|
||||
const files = [
|
||||
...await sourceFiles(join(process.cwd(), "app")),
|
||||
...await sourceFiles(join(process.cwd(), "components"))
|
||||
];
|
||||
const matches: string[] = [];
|
||||
|
||||
for (const file of files) {
|
||||
const source = await readFile(file, "utf8");
|
||||
for (const copy of forbiddenCopy) {
|
||||
if (source.includes(copy)) matches.push(`${file}: ${copy}`);
|
||||
}
|
||||
}
|
||||
|
||||
expect(matches).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
async function sourceFiles(directory: string): Promise<string[]> {
|
||||
const entries = await readdir(directory, { withFileTypes: true });
|
||||
const files = await Promise.all(entries.map(async (entry) => {
|
||||
const path = join(directory, entry.name);
|
||||
if (entry.isDirectory()) return sourceFiles(path);
|
||||
return entry.isFile() && path.endsWith(".tsx") ? [path] : [];
|
||||
}));
|
||||
return files.flat();
|
||||
}
|
||||
Reference in new issue
Block a user