38 lines
1.0 KiB
Go
38 lines
1.0 KiB
Go
package knowledge
|
|
|
|
import "testing"
|
|
|
|
func TestPlanQueriesCapsAtConfigLimit(t *testing.T) {
|
|
queries := PlanQueries(PlanInput{
|
|
Seed: "敏感肌",
|
|
TargetAudience: "孕婦",
|
|
L1Labels: []string{"a", "b", "c", "d", "e", "f", "g", "h"},
|
|
})
|
|
max := MaxPlanQueriesPerRound()
|
|
if len(queries) > max {
|
|
t.Fatalf("expected <= %d queries, got %d", max, len(queries))
|
|
}
|
|
if len(queries) < 8 {
|
|
t.Fatalf("expected at least 8 queries, got %d", len(queries))
|
|
}
|
|
}
|
|
|
|
func TestDeriveSearchTagsFromGraph(t *testing.T) {
|
|
graph := Graph{
|
|
Nodes: []Node{
|
|
{ID: "n1", Label: "敏感肌", NodeKind: "pain", Layer: 0},
|
|
{ID: "n2", Label: "屏障受損", NodeKind: "symptom", Layer: 1},
|
|
},
|
|
}
|
|
DeriveSearchTagsFromGraph(&graph)
|
|
if graph.PainTagCount != 2 {
|
|
t.Fatalf("expected pain tag count 2, got %d", graph.PainTagCount)
|
|
}
|
|
if len(graph.Nodes[0].DerivedTags.Relevance) == 0 {
|
|
t.Fatal("expected relevance tags on core node")
|
|
}
|
|
if len(graph.Nodes[0].DerivedTags.Recency) == 0 {
|
|
t.Fatal("expected recency tags on pain node")
|
|
}
|
|
}
|