Files
silk/server-go/internal/model/knowledge_seed_test.go
T

50 lines
1.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package model
import "testing"
func TestSeedDiseasesCoverCoreFour(t *testing.T) {
core := []string{"核型多角体病", "白僵病", "软化病", "微粒子病"}
got := map[string]bool{}
for _, d := range SeedDiseases {
got[d.Name] = true
}
for _, name := range core {
if !got[name] {
t.Errorf("核心蚕病缺失: %s", name)
}
}
}
func TestSeedDiseasesRequiredFields(t *testing.T) {
for _, d := range SeedDiseases {
if d.Name == "" || d.Category == "" {
t.Errorf("病种名称/类别不能为空: %+v", d)
}
if d.Pathogen == "" || d.Symptoms == "" || d.Transmission == "" || d.Prevention == "" {
t.Errorf("病种必备字段缺失(病原/症状/传播途径/防治指南): %s", d.Name)
}
}
}
func TestSeedDiseasesNamesUnique(t *testing.T) {
seen := map[string]bool{}
for _, d := range SeedDiseases {
if seen[d.Name] {
t.Errorf("病种名称重复: %s", d.Name)
}
seen[d.Name] = true
}
}
func TestSeedKnowledgeArticlesHasAIGuide(t *testing.T) {
found := false
for _, a := range SeedKnowledgeArticles {
if a.Kind == "ai_guide" && a.Title != "" && a.Content != "" {
found = true
}
}
if !found {
t.Error("缺少 AI 结果解读文章(kind=ai_guide")
}
}