39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
package processing
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestAppendDescriptionRichnessOverrideIsIdempotent(t *testing.T) {
|
|
once := AppendDescriptionRichnessOverride("base system")
|
|
if !strings.HasPrefix(once, "base system\n") || !strings.Contains(once, "Description depth (platform rule") {
|
|
t.Fatalf("override not appended: %q", once)
|
|
}
|
|
if twice := AppendDescriptionRichnessOverride(once); twice != once {
|
|
t.Fatal("override appended twice")
|
|
}
|
|
if AppendDescriptionRichnessOverride("") != descriptionRichnessOverride {
|
|
t.Fatal("empty system should become the override alone")
|
|
}
|
|
}
|
|
|
|
func TestResolveProductPromptTemplatesAddsRichnessOverride(t *testing.T) {
|
|
cases := map[string]ProductInput{
|
|
"category prompt": {
|
|
CategoryEnhancePrompt: "Opis: {{description}} {{attrs}}",
|
|
CategoryUniqueID: "televizorji",
|
|
},
|
|
"no prompt": {},
|
|
}
|
|
for name, in := range cases {
|
|
sys, _ := resolveProductPromptTemplates(in)
|
|
if !strings.Contains(sys, "Description depth (platform rule") {
|
|
t.Errorf("%s: system prompt lacks richness override", name)
|
|
}
|
|
if !strings.Contains(sys, "never") && !strings.Contains(sys, "Do not invent") {
|
|
t.Errorf("%s: override must keep the no-invention rule", name)
|
|
}
|
|
}
|
|
}
|