package aiprompts
import (
"strings"
"testing"
)
func TestDedupeA1DescriptionBlocks(t *testing.T) {
input := `--- Title ---
Napiši ime v slovenščini
--- End Title ---
--- Description ---
{Benefit one}
{No title}
{Benefit two}
{Include title}
{Benefit one}
{No title}
{Benefit two}
{Exclude title}
{Benefit two}
{Include title}
{Tehnične specifikacije}
--- End Description ---
--- Meta ---
140 znakov
--- End Meta ---`
got, n := DedupeA1DescriptionBlocks(input)
if n != 2 {
t.Fatalf("removed=%d want 2", n)
}
if strings.Count(got, "") != 3 {
t.Fatalf("H2 count changed incorrectly: %s", got)
}
for _, want := range []string{"Napiši ime", "140 znakov", "Tehnične specifikacije", "Exclude title"} {
if !strings.Contains(got, want) {
t.Fatalf("lost %q", want)
}
}
again, n := DedupeA1DescriptionBlocks(got)
if n != 0 || again != got {
t.Fatal("cleanup not idempotent")
}
}