This commit is contained in:
2026-08-16 19:21:49 +02:00
parent d6fe7c38d5
commit 106f602232
8 changed files with 212 additions and 15 deletions
@@ -46,6 +46,30 @@ func TestIsWeakPriorEnhanceDescription_fillerPhrases(t *testing.T) {
}
}
func TestSynthesizeProductDescription_formulaHTML(t *testing.T) {
t.Parallel()
title := "GIGABYTE GS27QC"
attrs := map[string]any{"brand": "GIGABYTE", "width": "61 cm"}
tpl := map[string]any{
"sections": []any{
map[string]any{"type": "h1", "instructions": "Main heading"},
map[string]any{"type": "p", "instructions": "Intro"},
map[string]any{"type": "ul", "instructions": "Specs"},
},
}
got := synthesizeProductDescription(title, "Gaming monitorji", "sl", attrs, tpl)
if !strings.Contains(got, "<h1>") || !strings.Contains(got, "<p>") || !strings.Contains(got, "<ul>") {
t.Fatalf("expected HTML skeleton from formula, got %q", got)
}
if !strings.Contains(got, title) {
t.Fatalf("expected title in formula synth: %q", got)
}
plain := synthesizeProductDescription(title, "Gaming monitorji", "sl", attrs, nil)
if strings.Contains(plain, "<h1>") {
t.Fatalf("nil formula should stay plain: %q", plain)
}
}
func TestSynthesizeDescriptionFromTitle_brandModelCategory(t *testing.T) {
title := "Vogel's WALL 3245 TV Wall Mount"
attrs := map[string]any{