import { describe, expect, it } from "vitest";
import {
  contentHeroImages,
  getLocationHeroImage,
  SITE_HERO_IMAGES,
} from "../client/src/lib/pageHeroVisuals";
import { buildSitemap } from "./sitemap";

describe("location hero visuals", () => {
  it("selects a stable property visual for the same location route", () => {
    expect(getLocationHeroImage("maryland", "baltimore-county")).toBe(
      getLocationHeroImage("maryland", "baltimore-county"),
    );
  });

  it("keeps the assigned visual inside the approved hero-image collection", () => {
    expect(Object.values(SITE_HERO_IMAGES)).toContain(
      getLocationHeroImage("texas", "harris-county"),
    );
  });

  it("assigns approved visuals to every new nationwide education page", () => {
    const titles = [
      "Sell a House As-Is",
      "Foreclosure Help and Home-Sale Options",
      "Sell an Inherited Property",
      "Selling a Home During Divorce",
      "Questions to Consider Before You Sell",
      "Direct Sale vs. Listing With an Agent",
      "Seller Education Blog",
      "Cash Sale Benefits and Tradeoffs",
    ];

    for (const title of titles) {
      expect(Object.values(SITE_HERO_IMAGES)).toContain(contentHeroImages[title]);
    }
  });

  it("includes each new nationwide page in the XML sitemap", () => {
    const sitemap = buildSitemap("https://example.com");
    const routes = [
      "/sell-as-is.html",
      "/foreclosure-help.html",
      "/sell-inherited-property.html",
      "/sell-during-divorce.html",
      "/seller-insights.html",
      "/compare-selling-options.html",
      "/blog.html",
      "/cash-sale-benefits.html",
    ];

    for (const route of routes) {
      expect(sitemap).toContain(`https://example.com${route}`);
    }
  });
});
