0b5d8d72f2
Deployment Config CI / Deployment Config (push) Successful in 27s
Frontend CI / Frontend (push) Successful in 2m53s
Backend CI / Backend (push) Successful in 16m53s
Desktop Client Build / Resolve Build Metadata (push) Waiting to run
Desktop Client Build / Build Desktop Client (push) Blocked by required conditions
Desktop Client Build / Publish Client Artifacts to NAS (push) Has been cancelled
Search terms like "全屋定制" or "GEO排名优化" were rejected as invalid because both the Vue candidate validator and the Go question_metadata classifier required interrogative cues (什么/如何/为什么/...). Lexicon entries are search terms, not questions, so require only letters or digits plus the existing 4-char minimum. Rename helpers to searchTermLooksValid/questionLooksValid to reflect the looser semantics, and relabel the navigation entry from "公司和词库" to "品牌和词库" to match the actual domain.
49 lines
1.0 KiB
Go
49 lines
1.0 KiB
Go
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)
|
|
}
|
|
}
|
|
}
|