package knowledge

import (
	"fmt"
	"testing"
)

func TestGraphTooThin(t *testing.T) {
	thin := Graph{
		Nodes: []Node{
			{Label: "a", Layer: 0, Relation: "短", PlacementValue: "短"},
		},
	}
	if !GraphTooThin(thin) {
		t.Fatal("expected thin graph")
	}

	nodes := []Node{{Label: "core", Layer: 0, Relation: "核心種子主題的完整說明文字", PlacementValue: "核心痛點帖最常求推薦適合自然回覆"}}
	for i := 0; i < 7; i++ {
		nodes = append(nodes, Node{
			Label:          fmt.Sprintf("l1-%d", i),
			Layer:          1,
			NodeKind:       "pain",
			Relation:       "這是 L1 節點與種子詞之間的完整脈絡說明",
			PlacementValue: "這類討論串常求產品推薦適合以使用經驗自然帶入",
		})
	}
	for i := 0; i < 11; i++ {
		nodes = append(nodes, Node{
			Label:          fmt.Sprintf("l2-%d", i),
			Layer:          2,
			NodeKind:       "symptom",
			Relation:       "這是 L2 周邊情境與種子詞之間的完整脈絡說明",
			PlacementValue: "周邊情境帖仍有置入空間可分享溫和修護經驗",
		})
	}
	if GraphTooThin(Graph{Nodes: nodes}) {
		t.Fatal("expected rich graph")
	}
}
