This commit is contained in:
2026-08-17 00:39:25 +02:00
parent 92f046b542
commit 93dc70123c
54 changed files with 25528 additions and 20666 deletions
@@ -21,19 +21,19 @@ func TestRepairedCategoryEnhancePromptMap(t *testing.T) {
if want[company.LangPromptAny] != tpl {
t.Fatalf("want * = shared template")
}
if !categoryEnhancePromptMapOK(want, want) {
if !categoryEnhancePromptMapOK(want) {
t.Fatal("canonical map should be OK")
}
legacy := company.LangPromptMap{"sl": "<H2>legacy HTML marketing</H2>"}
if categoryEnhancePromptMapOK(legacy, want) {
if categoryEnhancePromptMapOK(legacy) {
t.Fatal("legacy HTML must need repair")
}
slOnly := company.LangPromptMap{"sl": tpl}
if !categoryEnhancePromptMapOK(slOnly, want) {
if !categoryEnhancePromptMapOK(slOnly) {
t.Fatal("sl-only repaired map should be OK (idempotent)")
}
starOnly := company.LangPromptMap{company.LangPromptAny: tpl}
if !categoryEnhancePromptMapOK(starOnly, want) {
if !categoryEnhancePromptMapOK(starOnly) {
t.Fatal("*-only repaired map should be OK (idempotent)")
}
}
@@ -46,7 +46,28 @@ func TestRepairTargetsUseSharedTemplate(t *testing.T) {
t.Fatalf("shared template missing {{%s}}", v)
}
}
if !strings.Contains(strings.ToLower(tpl), "never brand-only") {
t.Fatal("Title section must forbid brand-only names")
}
if a1CompanyID == "" || platformDemoCompanyName == "" {
t.Fatal("missing company target constants")
}
}
func TestLegacyTitleRulesFromSeedShape(t *testing.T) {
t.Parallel()
seed := `Ustvari nov opis
GPT predloga:
<name>{Napiši novo ime izdelka po formuli: "tip izdelka sentence case", "znamka s pravilno kapitalizacijo", "poln model izdelka". Ne uporabljaj vejic.}</name>
<metaDescription>{140 znakov}</metaDescription>
<H2>{benefit}</H2>`
rules := legacyTitleRules(nil, seed)
if !strings.Contains(strings.ToLower(rules), "znamka") {
t.Fatalf("expected title rules from seed, got %q", rules)
}
raw := aiprompts.DeriveTitleTemplateJSON(rules)
if aiprompts.TitleTemplateNeedsRepair(raw) {
t.Fatalf("derived title_template still needs repair: %s", raw)
}
}