import fs from "node:fs"; function assert(condition, message) { if (!condition) throw new Error(message); } const picker = fs.readFileSync(new URL("../src/features/calendar/CalendarPicker.tsx", import.meta.url), "utf8"); const moduleSource = fs.readFileSync(new URL("../src/module.ts", import.meta.url), "utf8"); const coreTypes = fs.readFileSync(new URL("../../../govoplan-core/webui/src/types.ts", import.meta.url), "utf8"); assert(moduleSource.includes('"calendar.picker": calendarPicker'), "Calendar must register the named picker capability"); assert(coreTypes.includes("export type CalendarPickerUiCapability"), "Core must expose the narrow cross-module contract"); assert(picker.includes("listCalendars(settings)"), "Picker must use Calendar's authenticated list API"); assert(picker.includes("hasScope(auth, CALENDAR_PICKER_READ_SCOPE)"), "Picker must avoid loading without read permission"); assert(picker.includes("value={value}"), "Picker must remain controlled by its consumer"); assert(picker.includes("onChange={(event) => onChange(event.target.value)}"), "Picker must return the chosen calendar id"); assert(picker.includes("aria-busy={loading || undefined}"), "Picker must expose loading state accessibly"); assert(picker.includes("aria-describedby={status ? statusId : undefined}"), "Picker must associate availability feedback"); console.log("Calendar picker capability structure checks passed.");