An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
// SiYuan - https://github.com/siyuan-note/siyuan
// Copyright (c) 2020-present, b3log.org
// SPDX-License-Identifier: AGPL-3.0-or-later
package model
import (
"testing"
"github.com/88250/lute/ast"
"github.com/88250/lute/parse"
)
func TestNormalizeTreeAddsTypedMindmapIDs(t *testing.T) {
root := &ast.Node{Type: ast.NodeDocument}
list := &ast.Node{Type: ast.NodeMindmap, ListData: &ast.ListData{}}
item := &ast.Node{Type: ast.NodeMindmapItem, ListData: &ast.ListData{}}
root.AppendChild(list)
list.AppendChild(item)
root.AppendChild(&ast.Node{Type: ast.NodeKramdownBlockIAL, Tokens: []byte(`{: id="20260925000000-root001"}`)})
normalizeTree(&parse.Tree{Root: root})
for _, node := range []*ast.Node{list, item} {
if node.ID == "" || node.IALAttr("id") != node.ID || node.IALAttr("updated") == "" {
t.Fatalf("typed mind map block has no ID: %s", node.Type)
}
}
}