perf : improve more
CI / Verify (push) Successful in 1m12s
CI / Build immutable images and deploy (push) Successful in 1m46s

This commit is contained in:
2026-09-08 18:29:56 +07:00 Unverified
parent 5e4d07f59f
commit bb28d79aee
5 changed files with 14965 additions and 3064 deletions
+17 -2
View File
@@ -2,6 +2,8 @@ import { readFile } from "node:fs/promises";
import { describe, expect, it } from "vitest";
import robots from "@/app/robots";
async function repositoryFile(path: string): Promise<string> {
return readFile(new URL(`../${path}`, import.meta.url), "utf8");
}
@@ -27,11 +29,24 @@ describe("public rendering performance", () => {
expect(header).toContain("<AdminEditLink");
});
it("preloads only the first directory cover", async () => {
it("gives only the first directory cover high fetch priority", async () => {
const directory = await repositoryFile(
"components/public/structured-directory.tsx",
);
expect(directory).toContain("preload={index === 0}");
expect(directory).toContain(
'fetchPriority={index === 0 ? "high" : undefined}',
);
expect(directory).not.toContain("preload={index === 0}");
});
it("publishes a public-only crawler policy", () => {
expect(robots()).toEqual({
rules: {
userAgent: "*",
allow: "/",
disallow: ["/admin", "/api", "/register"],
},
});
});
});