import nextConfig from "../next.config"; describe("next.config", () => { it("does not announce the framework in the X-Powered-By header", () => { expect(nextConfig.poweredByHeader).toBe(false); }); it("serves AVIF before WebP, because the browser takes the first format of the list it accepts", () => { expect(nextConfig.images?.formats).toEqual(["image/avif", "image/webp"]); }); it("leaves the image cache time to the framework default instead of revalidating every minute", () => { expect(nextConfig.images).not.toHaveProperty("minimumCacheTTL"); }); it("keeps the CSP in Report-Only (Google Ads is allowed in it now, but the owner activates it later), never enforcing it by accident", async () => { const rules = (await nextConfig.headers?.()) ?? []; const site = rules.find(({ source }) => source === "/(.*)"); const names = site?.headers.map(({ key }) => key) ?? []; expect(names).toContain("Content-Security-Policy-Report-Only"); expect(names).not.toContain("Content-Security-Policy"); }); });