fixes
This commit is contained in:
1 parent
c92ee93482
commit
af670e79f0
9 files changed
+667
-104
No files matched your search
@@ -64,3 +64,21 @@ func TestSEOUpgradeHasPreviousVersionAndDifferentHashSource(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestEveryLocalizedDefaultUsesDistinctBracedMetaFields(t *testing.T) {
|
||||
for _, lang := range OfflinePromptLanguages() {
|
||||
prompt, err := OfflineDefaultPrompt(lang)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
meta := ExtractEnhanceSectionBody(prompt, SectionMetaStart, SectionMetaEnd)
|
||||
if strings.Count(meta, "{meta_title:") != 1 || strings.Count(meta, "{meta_description:") != 1 || strings.Count(meta, "}") != 2 {
|
||||
t.Fatalf("%s SEO meta has inconsistent brace structure: %s", lang, meta)
|
||||
}
|
||||
parts := LegacyEnhanceParts{MetaRules: meta, WasLegacy: true}
|
||||
result := DeriveDescriptionFormulaFromLegacyParts(parts)
|
||||
if result.MetaTitle == "" || result.MetaDescription == "" || strings.Contains(result.MetaTitle, "meta_description:") {
|
||||
t.Fatalf("%s metadata parser lost a field: %+v", lang, result)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user