package knowledge import ( "strings" "testing" ) func TestShortPatrolSearchCoreDropsIntentNoise(t *testing.T) { got := ShortPatrolSearchCore("化療 無香 洗衣精 推薦 請問") if got == "" { t.Fatal("expected non-empty core") } if len([]rune(got)) > maxThreadsSearchRunes { t.Fatalf("core too long: %q", got) } if strings.Contains(got, "推薦") || strings.Contains(got, "請問") { t.Fatalf("expected intent words stripped for API core, got %q", got) } if !strings.Contains(got, "無香") && !strings.Contains(got, "洗衣精") { t.Fatalf("expected pain/product tokens kept, got %q", got) } } func TestFullPatrolWebSearchTagKeepsIntent(t *testing.T) { got := FullPatrolWebSearchTag("化療 無香 洗衣精") if !strings.Contains(got, "推薦") && !strings.Contains(got, "請問") && !strings.Contains(got, "怎麼辦") { t.Fatalf("expected relevance tag to include intent marker, got %q", got) } } func TestThreadsAPIKeywordUsesShortCore(t *testing.T) { long := "化療後皮膚敏感要換什麼無香洗衣精 推薦" got := ThreadsAPIKeyword(long) if got == "" || len([]rune(got)) > maxThreadsSearchRunes { t.Fatalf("unexpected threads keyword %q", got) } }