import { describe, expect, it } from "vitest"; import { buildPageTreeProjectionItems } from "@/lib/tree-projection"; describe("tree-projection contract", () => { it("page_tree projection item 持续输出共享 contract 字段", () => { const items = buildPageTreeProjectionItems([ { access_scope: "private", id: "root", workspace_id: "ws_1", title: "Root", parent_id: null, sort_order: 0, is_starred: false, is_template: false, created_at: "2026-04-18T00:00:00Z", updated_at: null, children: [], }, ]); expect(items).toHaveLength(1); expect(items[0]).toMatchObject({ rowId: "page:root", nodeId: "root", parentNodeId: null, projectionKind: "page_tree", expandable: false, expandedByDefault: true, iconHint: "page", resourceMeta: { resourceKind: "document", documentId: "root", iconHint: "page", }, }); expect(items[0]?.capabilities).toContain("open"); }); });