Files
vcr-calendar/src/render/agenda.test.ts

59 lines
1.8 KiB
TypeScript
Raw Normal View History

import { describe, it, expect } from "vitest";
import { renderAgenda } from "./agenda";
import type { Show, Preferences } from "../types";
const babShow: Show = {
slug: "bowl-after-bowl",
name: "Bowl After Bowl",
shortDescription: "The flagship Small Group talk show.",
websiteUrl: "https://bowlafterbowl.com",
feedUrl: "",
accentColor: "#f2b705",
hosts: ["Spencer", "DuhLaurien"],
isSmallGroup: true,
isVcr: true,
isActive: true,
schedule: { day: "tuesday", startTime: "22:00", endTime: "01:00+1", timezone: "America/New_York", recurrence: "weekly" },
};
const vcrPrefs: Preferences = { tz: "eastern", theme: "system", mode: "vcr", week: "2026-W45", setCookies: [] };
describe("renderAgenda", () => {
it("returns HTML with agenda class", () => {
const html = renderAgenda([babShow], vcrPrefs);
expect(html).toContain("agenda");
});
it("groups shows under day headings", () => {
const html = renderAgenda([babShow], vcrPrefs);
expect(html).toContain("Tuesday");
});
it("renders show entries as links", () => {
const html = renderAgenda([babShow], vcrPrefs);
expect(html).toContain('href="/show/bowl-after-bowl');
});
it("includes time display", () => {
const html = renderAgenda([babShow], vcrPrefs);
expect(html).toMatch(/10:00\s*PM/i);
});
it("omits days with no shows", () => {
const html = renderAgenda([babShow], vcrPrefs);
expect(html).not.toContain("Wednesday");
expect(html).not.toContain("Thursday");
});
it("applies accent color as border style", () => {
const html = renderAgenda([babShow], vcrPrefs);
expect(html).toContain("#f2b705");
});
it("lists overnight shows under their start day", () => {
const html = renderAgenda([babShow], vcrPrefs);
expect(html).toContain("Tuesday");
expect(html).not.toMatch(/Wednesday.*Bowl After Bowl/s);
});
});