feat: complete tree shell cutover and regression coverage

This commit is contained in:
lix-2026
2026-04-18 09:38:16 +08:00
parent d3876e56eb
commit 111a87d4fd
53 changed files with 5440 additions and 516 deletions
@@ -0,0 +1,39 @@
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");
});
});