Files
geo/server/internal/tenant/app/question_search_term_validation_test.go
T

49 lines
1.0 KiB
Go
Raw Normal View History

package app
import "testing"
func TestQuestionLooksValidAcceptsGenericSearchTerms(t *testing.T) {
tests := []string{
"全屋定制",
"GEO排名优化",
"AI搜索排名",
}
for _, text := range tests {
if !questionLooksValid(text) {
t.Fatalf("questionLooksValid(%q) = false, want true", text)
}
}
}
func TestBuildCandidateKeepsGenericSearchTermSavable(t *testing.T) {
candidate := buildCandidate(
"全屋定制",
QuestionSourceManual,
false,
map[string]struct{}{},
&questionBrandContext{BrandName: "安徽海翔家居用品销售有限公司"},
)
if candidate.TooShort {
t.Fatal("expected generic search term not to be marked too short")
}
if candidate.SuggestSkip {
t.Fatal("expected generic search term not to be suggested for skip")
}
}
func TestQuestionLooksValidRejectsEmptyOrTooShortTerms(t *testing.T) {
tests := []string{
"",
"!?。",
"AI",
}
for _, text := range tests {
if questionLooksValid(text) {
t.Fatalf("questionLooksValid(%q) = true, want false", text)
}
}
}