import { test, expect } from "@playwright/test";

test.describe("Meta and Robots", () => {
  test("robots.txt should contain Disallow: /", async ({ request }) => {
    const response = await request.get("/robots.txt");
    const text = await response.text();
    expect(text).toContain("User-agent: *");
    expect(text).toContain("Disallow: /");
  });

  test("home page should have noindex meta tag", async ({ page }) => {
    await page.goto("/");
    const robotsMeta = page.locator('meta[name="robots"]');
    await expect(robotsMeta).toHaveAttribute("content", /noindex/);
    await expect(robotsMeta).toHaveAttribute("content", /nofollow/);
    await expect(robotsMeta).toHaveAttribute("content", /noarchive/);
    await expect(robotsMeta).toHaveAttribute("content", /nosnippet/);
  });

  test("home page should contain JSON-LD LocalBusiness", async ({ page }) => {
    await page.goto("/");
    const jsonld = page.locator('script[type="application/ld+json"]');
    const content = await jsonld.textContent();
    expect(content).toContain("LocalBusiness");
    expect(content).toContain("Hammerschmidt");
  });
});
