feat: complete tree shell cutover and regression coverage
This commit is contained in:
@@ -221,11 +221,32 @@ describe("buildSidebarInitialData", () => {
|
||||
nodeId: "doc_1",
|
||||
parentNodeId: null,
|
||||
nodeType: "page",
|
||||
projectionKind: "sidebar_tree",
|
||||
title: "页面 1",
|
||||
depth: 0,
|
||||
position: 1,
|
||||
childCount: 0,
|
||||
expandable: false,
|
||||
expandedByDefault: true,
|
||||
capabilities: [
|
||||
"open",
|
||||
"drag",
|
||||
"drop",
|
||||
"select",
|
||||
"create-child",
|
||||
"rename",
|
||||
"archive",
|
||||
"restore",
|
||||
"context-menu",
|
||||
"reorder",
|
||||
],
|
||||
resourceMeta: {
|
||||
resourceKind: "document",
|
||||
documentId: "doc_1",
|
||||
workspaceId: "ws_1",
|
||||
iconHint: "page",
|
||||
},
|
||||
iconHint: "page",
|
||||
},
|
||||
],
|
||||
edges: [],
|
||||
@@ -276,11 +297,32 @@ describe("buildSidebarInitialData", () => {
|
||||
nodeId: "doc_1",
|
||||
parentNodeId: null,
|
||||
nodeType: "page",
|
||||
projectionKind: "sidebar_tree",
|
||||
title: "页面 1",
|
||||
depth: 0,
|
||||
position: 1,
|
||||
childCount: 0,
|
||||
expandable: false,
|
||||
expandedByDefault: true,
|
||||
capabilities: [
|
||||
"open",
|
||||
"drag",
|
||||
"drop",
|
||||
"select",
|
||||
"create-child",
|
||||
"rename",
|
||||
"archive",
|
||||
"restore",
|
||||
"context-menu",
|
||||
"reorder",
|
||||
],
|
||||
resourceMeta: {
|
||||
resourceKind: "document",
|
||||
documentId: "doc_1",
|
||||
workspaceId: "ws_1",
|
||||
iconHint: "page",
|
||||
},
|
||||
iconHint: "page",
|
||||
},
|
||||
],
|
||||
edges: [],
|
||||
@@ -319,7 +361,7 @@ describe("buildSidebarInitialData", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("缺少 kernel projection 时不再本地补真相,而是返回空契约 projection", () => {
|
||||
it("缺少 kernel projection 时会按 documents 重建 projection 并保留层级", () => {
|
||||
expect(
|
||||
mapSidebarDatasetListQueryResultToInitialData({
|
||||
active_workspace_id: "ws_1",
|
||||
@@ -337,6 +379,18 @@ describe("buildSidebarInitialData", () => {
|
||||
created_at: "2026-04-14T00:00:00Z",
|
||||
updated_at: null,
|
||||
},
|
||||
{
|
||||
id: "doc_2",
|
||||
workspace_id: "ws_1",
|
||||
title: "页面 2",
|
||||
parent_id: "doc_1",
|
||||
sort_order: 0,
|
||||
is_starred: false,
|
||||
access_scope: "private",
|
||||
is_template: false,
|
||||
created_at: "2026-04-14T00:01:00Z",
|
||||
updated_at: null,
|
||||
},
|
||||
],
|
||||
trashed_documents: [],
|
||||
media_assets: [],
|
||||
@@ -351,13 +405,16 @@ describe("buildSidebarInitialData", () => {
|
||||
).toMatchObject({
|
||||
activeWorkspaceId: "ws_1",
|
||||
kernelSidebarProjection: {
|
||||
projectionId: "kernel_projection:sidebar_tree:missing",
|
||||
items: [],
|
||||
edges: [],
|
||||
projectionId: "kernel_projection:sidebar_tree:workspace_root",
|
||||
},
|
||||
kernelSidebarTree: [
|
||||
{
|
||||
id: "doc_1",
|
||||
children: [
|
||||
{
|
||||
id: "doc_2",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user