import { describe, expect, it } from "vitest"; import { ROBOTS_DISALLOWED_PATHS, buildRobots } from "@/app/robots"; describe("buildRobots", () => { it("blocks everything when not indexable and omits the sitemap", () => { const robots = buildRobots({ indexable: false }); expect(robots.rules).toEqual([{ userAgent: "*", disallow: "/" }]); expect(robots.sitemap).toBeUndefined(); }); it("allows crawling but hides admin, api and utility pages when indexable", () => { const robots = buildRobots({ indexable: true }); const rule = Array.isArray(robots.rules) ? robots.rules[0] : robots.rules; expect(rule.allow).toBe("/"); expect(rule.disallow).toEqual(ROBOTS_DISALLOWED_PATHS); expect(rule.disallow).toEqual(expect.arrayContaining(["/admin-internal", "/root", "/api/", "/success", "/coming-soon"])); expect(robots.sitemap).toBe("https://mohfarawati.de/sitemap.xml"); }); });