import { describe, expect, it } from "vitest";
import type { TreeProjectionItemBase } from "@/lib/tree-protocol";

describe("tree-protocol", () => {
  it("冻结共享 tree projection 字段与 file_tree 扩展语义", () => {
    const item: TreeProjectionItemBase = {
      nodeId: "doc_1",
      parentNodeId: null,
      nodeType: "page",
      projectionKind: "file_tree",
      title: "页面 1",
      depth: 0,
      position: 1,
      childCount: 2,
      expandable: true,
      expandedByDefault: true,
      capabilities: ["expand", "open", "drag", "drop", "select", "create-child"],
      resourceMeta: {
        resourceKind: "document",
        documentId: "doc_1",
        assetKind: "file",
        iconHint: "page",
      },
      iconHint: "page",
    };

    expect(item.resourceMeta.resourceKind).toBe("document");
    expect(item.resourceMeta.assetKind).toBe("file");
    expect(item.capabilities).toContain("expand");
    expect(item.expandable).toBe(true);
    expect(item.iconHint).toBe("page");
  });
});
