package catalog import ( "strings" "testing" "github.com/descrybe/descrybe-v2/apps/api/internal/aiprompts" "github.com/descrybe/descrybe-v2/apps/api/internal/company" ) func TestCategoryEnhanceTemplateHasAttrs(t *testing.T) { t.Parallel() tpl := aiprompts.CategoryEnhanceUserTemplate if !strings.Contains(tpl, "{{attrs}}") { t.Fatalf("template missing {{attrs}}: %q", tpl) } if !aiprompts.CategoryEnhanceHasRoleSections(tpl) { t.Fatal("repaired template must include title/description/meta/attributes sections") } if !aiprompts.CategoryEnhancePromptNeedsRepair("legacy HTML prompt without attrs") { t.Fatal("expected legacy prompt to need repair") } if aiprompts.CategoryEnhancePromptNeedsRepair(tpl) { t.Fatal("canonical template should not need repair") } } func TestPlatformDemoNameConstant(t *testing.T) { t.Parallel() if platformDemoCompanyName != "Platform Demo" { t.Fatalf("got %q", platformDemoCompanyName) } } func TestRepairedCategoryEnhancePromptMapMatchesA1Demo(t *testing.T) { t.Parallel() want, err := repairedCategoryEnhancePromptMap() if err != nil { t.Fatal(err) } tpl := strings.TrimSpace(aiprompts.CategoryEnhanceUserTemplate) if want["sl"] != tpl || want[company.LangPromptAny] != tpl { t.Fatalf("want sl+* template, got %#v", want) } if !strings.Contains(tpl, "{{attrs}}") { t.Fatal("template must include {{attrs}}") } }