import { describe, expect, test } from "bun:test";
import { readFileSync } from "node:fs";
import { getEventFormValuesFromEvent } from "@/lib/event-form";

describe("EventDialog public modes", () => {
	test("accepts AI-prefilled editable initial values through its public props", () => {
		const initialValues = getEventFormValuesFromEvent({
			title: "AI Draft",
			start: "2026-04-09T10:00:00.000Z",
			recurrenceRule: "FREQ=WEEKLY;INTERVAL=1;BYDAY=TH",
		});

		expect(initialValues.title).toBe("AI Draft");
		expect(initialValues.start).toBe("2026-04-09T10:00:00.000Z");
		expect(initialValues.recurrenceRule).toBe("FREQ=WEEKLY;INTERVAL=1;BYDAY=TH");
	});

	test("dialog content uses console surface classes instead of generic border and shadow", () => {
		const source = readFileSync("src/components/ui/dialog.tsx", "utf8");

		expect(source).toContain("rounded-[10px]");
		expect(source).toContain("shadow-xl");
		expect(source).not.toContain("rounded-lg border p-6 shadow-lg");
	});

	test("dialog source uses console section labels and grouped field regions", () => {
		const source = readFileSync("src/components/event-dialog.tsx", "utf8");

		expect(source).toContain("Event details");
		expect(source).toContain("Schedule");
		expect(source).toContain("Recurrence");
	});
});
