import { readFile } from "node:fs/promises";
import path from "node:path";

import { describe, expect, it } from "vitest";

async function read(rel: string) {
  return await readFile(path.join(process.cwd(), rel), "utf8");
}

describe("card layout", () => {
  it("uses a shared StandardCard component for content and blog cards", async () => {
    const contentCard = await read("src/components/ContentCard.astro");
    expect(contentCard).toContain('import StandardCard from "./StandardCard.astro";');
    expect(contentCard).toContain("<StandardCard");

    const blogPostCard = await read("src/components/BlogPostCard.astro");
    expect(blogPostCard).toContain('import StandardCard from "./StandardCard.astro";');
    expect(blogPostCard).toContain("<StandardCard");
  });

  it("defines standardized card CSS (content band + footer bar)", async () => {
    const css = await read("src/styles/global.css");

    expect(css).toContain(".card-content");
    expect(css).toContain("justify-content: space-between");
    expect(css).toContain(".card-footer");
    expect(css).toContain(".card-summary");
  });
});
