fix
This commit is contained in:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user