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