chore(ops): strip redundant force-dynamic and probe Redis in ops health
Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
3e584aadaf
commit
3ac5d6f4f6
60 files changed
+95
-114
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
describe("staff smoke contract", () => {
|
||||
@@ -50,10 +51,37 @@ describe("staff smoke contract", () => {
|
||||
|
||||
it("ships shared ops + ticket queue helpers", () => {
|
||||
expect(existsSync("src/lib/admin/ops-health.ts")).toBe(true);
|
||||
const ops = readFileSync("src/lib/admin/ops-health.ts", "utf8");
|
||||
expect(ops).toContain("redisOk");
|
||||
expect(ops).toContain("redis.ping");
|
||||
expect(existsSync("src/lib/admin/ticket-queue-counts.ts")).toBe(true);
|
||||
expect(existsSync("src/lib/admin/ops-online-users.ts")).toBe(true);
|
||||
});
|
||||
|
||||
it("keeps force-dynamic only on admin/mod layouts", () => {
|
||||
const hits: string[] = [];
|
||||
function walk(dir: string) {
|
||||
for (const name of readdirSync(dir)) {
|
||||
const p = join(dir, name);
|
||||
if (statSync(p).isDirectory()) walk(p);
|
||||
else if (/\.(tsx?|jsx?)$/.test(name)) {
|
||||
const src = readFileSync(p, "utf8");
|
||||
if (
|
||||
/export\s+const\s+dynamic\s*=\s*["']force-dynamic["']/.test(src)
|
||||
) {
|
||||
hits.push(p.replace(/\\/g, "/"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
walk("src/app/admin");
|
||||
walk("src/app/mod");
|
||||
expect(hits.sort()).toEqual([
|
||||
"src/app/admin/layout.tsx",
|
||||
"src/app/mod/layout.tsx",
|
||||
]);
|
||||
});
|
||||
|
||||
it("caches analytics via redisCache", () => {
|
||||
for (const path of [
|
||||
"src/app/admin/analytics/page.tsx",
|
||||
|
||||
Reference in new issue
Block a user