haixunMaster/haixun-backend/internal/library/knowledge/patrol_resolve_test.go

24 lines
720 B
Go

package knowledge
import "testing"
func TestResolveScanPatrolKeywordsPrefersExplicit(t *testing.T) {
got := ResolveScanPatrolKeywords(
[]string{"手動 關鍵字"},
[]string{"已儲存"},
PatrolTagInput{Questions: []string{"敏感肌 怎麼辦"}},
nil,
)
if len(got) != 1 || got[0] != "手動 關鍵字" {
t.Fatalf("ResolveScanPatrolKeywords() = %#v, want explicit keyword", got)
}
}
func TestResolveScanPatrolKeywordsFromResearchMapWithoutGraph(t *testing.T) {
got := ResolveScanPatrolKeywords(nil, nil, PatrolTagInput{
Questions: []string{"化療後 皮膚乾 怎麼辦"},
}, nil)
if len(got) == 0 {
t.Fatal("expected research map questions to produce patrol keywords without graph nodes")
}
}