This commit is contained in:
greeneclipse committed 2026-10-14 19:23:16 +02:00
1 parent ff6c2df618
commit 43cfaa0411
18 files changed
+683 -299

No files matched your search

@@ -324,3 +324,27 @@ func TestCategoryFormulasFor_explicitWins(t *testing.T) {
t.Fatal("expected cache formula")
}
}
func TestSEODefaultDescriptionOptionalBlocks(t *testing.T) {
t.Parallel()
tpl := map[string]any{"sections": []any{
map[string]any{"type": "p", "instructions": "Factual intro"},
map[string]any{"type": "h2", "instructions": "Documented benefit", "optional": true},
map[string]any{"type": "p", "instructions": "Benefit details", "optional": true},
map[string]any{"type": "h2", "instructions": "Technical specifications", "optional": true},
map[string]any{"type": "ul", "instructions": "Verified properties only", "optional": true},
}}
if !descriptionSatisfiesFormula("<p>A factual product introduction.</p>", tpl) {
t.Fatal("intro-only HTML must be valid if optional benefits and specs are absent")
}
if descriptionSatisfiesFormula("Only plain text, no HTML", tpl) {
t.Fatal("missing required introductory paragraph must be rejected")
}
if descriptionSatisfiesFormula("", tpl) {
t.Fatal("empty description must be rejected")
}
block := FormatDescriptionFormulaConstraint(tpl)
if !strings.Contains(block, "optional when no sourced facts") || !strings.Contains(block, "No H1") {
t.Fatalf("optional or semantic-HTML constraints missing: %s", block)
}
}