feat(knowledge): SERS 教程、四季防控提醒、「其它/未知」病种种子数据
This commit is contained in:
@@ -59,3 +59,46 @@ func TestSeedKnowledgeArticlesHasLAMPGuid(t *testing.T) {
|
||||
t.Error("缺少 LAMP 操作教程文章(kind=lamp_guide)")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSeedKnowledgeArticlesHasSERSGuide(t *testing.T) {
|
||||
found := false
|
||||
for _, a := range SeedKnowledgeArticles {
|
||||
if a.Kind == "sers_guide" && a.Title != "" && a.Content != "" {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
t.Error("缺少 SERS 操作教程文章(kind=sers_guide)")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSeedKnowledgeArticlesHasSeasonalTips(t *testing.T) {
|
||||
seasons := map[string]bool{}
|
||||
for _, a := range SeedKnowledgeArticles {
|
||||
if a.Kind != "seasonal_tip" || a.Content == "" {
|
||||
continue
|
||||
}
|
||||
for _, s := range []string{"春季", "夏季", "秋季", "冬季"} {
|
||||
if len(a.Title) >= len(s) && a.Title[:len(s)] == s {
|
||||
seasons[s] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, s := range []string{"春季", "夏季", "秋季", "冬季"} {
|
||||
if !seasons[s] {
|
||||
t.Errorf("缺少季节防控提醒文章: %s", s)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSeedDiseasesHasUnknownCategory(t *testing.T) {
|
||||
found := false
|
||||
for _, d := range SeedDiseases {
|
||||
if d.Category == "other" && d.Name != "" {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
t.Error("缺少「其它/未知」类别的病种条目")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user