import { expectTypeOf, it } from "vitest"; import type { CustomViewSchema, DatabaseArgs, DatabaseHandle, DatePropertyFilter, GroupByFormat, ViewSchema, } from "./index.js"; it("keeps custom views free of standard view query and property configuration", () => { expectTypeOf<{ resourceId: "custom-view"; dataSourceResourceId: "source"; type: "custom"; customBlockKey: "board"; }>().toExtend(); expectTypeOf<{ resourceId: "custom-view"; dataSourceResourceId: "source"; type: "custom"; customBlockKey: "board"; sorts: []; }>().not.toExtend(); expectTypeOf<{ resourceId: "custom-view"; dataSourceResourceId: "source"; type: "custom"; customBlockKey: "board"; properties: []; }>().not.toExtend(); }); it("requires date properties for calendar and timeline views at both entrypoints", () => { type MissingDateProperty = { resourceId: "view"; dataSourceResourceId: "source"; type: "calendar" | "timeline"; }; expectTypeOf().not.toExtend(); expectTypeOf().not.toExtend[number]>(); expectTypeOf().not.toExtend[0]>(); }); it("couples date operators to their value shapes and requires a range bound", () => { type DateFilter = { type: "property"; propertyId: "due"; propertyType: "date"; }; expectTypeOf< DateFilter & { operator: "date_is_within"; value: { type: "exact_range"; value: { startDate: "2026-01-01" } }; } >().toExtend(); expectTypeOf< DateFilter & { operator: "date_is_within"; value: { type: "exact_range"; value: {} }; } >().not.toExtend(); expectTypeOf< DateFilter & { operator: "date_is_relative_to"; value: { type: "exact"; value: "2026-01-01" }; } >().not.toExtend(); }); it("limits status grouping options to status properties", () => { expectTypeOf<{ type: "status"; property: "status"; statusBy: "group"; }>().toExtend(); expectTypeOf<{ type: "select"; property: "status"; statusBy: "group"; }>().not.toExtend(); });