This commit is contained in:
2026-08-16 21:35:48 +02:00
parent 106f602232
commit 389608ea56
28 changed files with 2491 additions and 115 deletions
@@ -76,6 +76,36 @@ func TestAppendDescriptionFormulaSystemOverride(t *testing.T) {
}
}
func TestDescriptionSatisfiesFormula(t *testing.T) {
t.Parallel()
tpl := map[string]any{
"sections": []any{
map[string]any{"type": "h1", "instructions": "Heading"},
map[string]any{"type": "p", "instructions": "Body"},
map[string]any{"type": "ul", "instructions": "Specs"},
},
}
if descriptionSatisfiesFormula("", tpl) {
t.Fatal("empty must fail")
}
if descriptionSatisfiesFormula("GIGABYTE GS27QC is a gaming monitor with a 61 cm curved panel for immersive play.", tpl) {
t.Fatal("plain prose must fail multi-section formula")
}
if !descriptionSatisfiesFormula("<h1>GIGABYTE GS27QC</h1><p>Gaming monitor.</p><ul><li>61 cm</li></ul>", tpl) {
t.Fatal("full HTML skeleton must pass")
}
if !descriptionSatisfiesFormula("any copy", nil) {
t.Fatal("nil formula always satisfied")
}
if descriptionNeedsEnhanceRepair(
"GIGABYTE GS27QC is a gaming monitor with a 61 cm curved panel for immersive play.",
tpl,
"GIGABYTE GS27QC",
) != true {
t.Fatal("non-weak prose that ignores formula must need repair")
}
}
func TestAppendFormulaConstraints_injectedIntoResolve(t *testing.T) {
t.Parallel()
title := map[string]any{