fix
This commit is contained in:
@@ -317,3 +317,33 @@ func TestEnforceV1ProcessCompletedItem_refreshesPromptLeakageMeta(t *testing.T)
|
||||
t.Fatalf("prompt-leakage meta_description preserved: %q", md)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEnforceV1ProcessCompletedItem_preservesFormulaHTML(t *testing.T) {
|
||||
t.Parallel()
|
||||
htmlDesc := `<h1>Anker Soundcore Space One Pro</h1><p>Zložljive ANC slušalke z bogatim zvokom.</p><ul><li>Bluetooth 5.3</li></ul>`
|
||||
item := V1ProcessJobItem{
|
||||
"ean": "1",
|
||||
"status": "processed",
|
||||
"id": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
|
||||
"processed_product_id": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
|
||||
"raw_product_id": "cccccccc-cccc-cccc-cccc-cccccccccccc",
|
||||
"title": "Anker Soundcore Space One Pro",
|
||||
"description": htmlDesc,
|
||||
"category": "48",
|
||||
"category_name": "Slušalke",
|
||||
"attributes": map[string]any{"brand": "Anker"},
|
||||
"eprel": nil,
|
||||
}
|
||||
out := EnforceV1ProcessCompletedItem(item, "sl", nil)
|
||||
desc, _ := out["description"].(string)
|
||||
for _, tag := range []string{"<h1>", "<p>", "<ul>"} {
|
||||
if !strings.Contains(desc, tag) {
|
||||
t.Fatalf("EnforceV1 must keep formula HTML %q, got %q", tag, desc)
|
||||
}
|
||||
}
|
||||
// meta_description must stay plain (no tags).
|
||||
md := fmt.Sprint(out["meta_description"])
|
||||
if strings.Contains(md, "<h1>") || strings.Contains(md, "<p>") {
|
||||
t.Fatalf("meta_description should be plain, got %q", md)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user