import { describe, expect, it } from "vitest";
import {
  brand,
  founders,
  locales,
  metrics,
  pageSlugs,
  publishedArticleSlugs,
} from "../content/site";
import { getServiceBySlug, serviceKeys, servicePath } from "../content/services";
import { getArticleSummaries } from "../lib/library";

describe("technical foundation content guardrails", () => {
  it("keeps French as the default and exports the three approved locales", () => {
    expect(locales).toEqual(["fr", "en", "ar"]);
    expect(locales[0]).toBe("fr");
  });

  it("preserves confirmed contact and company data", () => {
    expect(brand.email).toBe("videography.yashal@gmail.com");
    expect(founders).toHaveLength(3);
    expect(metrics.map(({ value }) => value)).toEqual(["20+", "20+", "5M+", "50+", "5+", "5"]);
  });

  it("does not publish excluded routes or draft articles", () => {
    expect(pageSlugs).not.toContain("industries");
    expect(pageSlugs).not.toContain("solution");
    expect(publishedArticleSlugs).toEqual([]);
  });

  it("defines six localized, reversible service routes", () => {
    expect(serviceKeys).toHaveLength(6);
    for (const locale of locales) {
      for (const service of serviceKeys) {
        const path = servicePath(locale, service);
        const slug = decodeURIComponent(path.split("/").filter(Boolean)[2]);
        expect(getServiceBySlug(locale, slug)?.key).toBe(service);
      }
    }
  });

  it("publishes only reviewed Markdown articles", () => {
    expect(getArticleSummaries("fr")).toHaveLength(6);
    expect(getArticleSummaries("en")).toHaveLength(6);
    expect(getArticleSummaries("ar")).toHaveLength(0);
    expect(getArticleSummaries("fr").every((article) => !article.draft)).toBe(true);
    expect(getArticleSummaries("en").every((article) => !article.draft)).toBe(true);
  });
});
