fix
This commit is contained in:
@@ -113,6 +113,8 @@ func TestResolveProductPromptTemplates_derivesFormulaFromPromptHTML(t *testing.T
|
||||
aiprompts.SectionDescriptionStart + "\n" +
|
||||
`<H2>{Napiši Novo ime izdelka in izpostavi en benefit}</H2>` +
|
||||
`<p>{Napiši odstavek, ki je dolg 100 besed.}</p>` +
|
||||
`<H2>{Izpostavi en benefit}</H2>` +
|
||||
`<p>{Napiši odstavek z tipom izdelka lowercase.}</p>` +
|
||||
`<b>{Tehnične specifikacije}</b><ul><li>{Napiši 3-10 tehničnih specifikacij}</li></ul>` + "\n" +
|
||||
aiprompts.SectionDescriptionEnd
|
||||
sys, user := resolveProductPromptTemplates(ProductInput{
|
||||
@@ -133,9 +135,22 @@ func TestResolveProductPromptTemplates_derivesFormulaFromPromptHTML(t *testing.T
|
||||
if !strings.Contains(sys, `"name" MUST be rewritten`) {
|
||||
t.Fatalf("missing title rewrite system override:\n%s", sys)
|
||||
}
|
||||
if descriptionSatisfiesFormula("plain Slovenian prose without tags", aiprompts.EffectiveDescriptionTemplateAny(nil, prompt)) {
|
||||
if !strings.Contains(user, "Title instructions (REQUIRED") {
|
||||
t.Fatalf("missing Title section constraint:\n%s", user)
|
||||
}
|
||||
effective := aiprompts.EffectiveDescriptionTemplateAny(nil, prompt)
|
||||
if descriptionSatisfiesFormula("plain Slovenian prose without tags", effective) {
|
||||
t.Fatal("plain prose must fail derived formula gate")
|
||||
}
|
||||
// One h2 is not enough when formula asks for two.
|
||||
thin := "<h2>A</h2><p>One</p><p>Two</p><ul><li>x</li></ul>"
|
||||
if descriptionSatisfiesFormula(thin, effective) {
|
||||
t.Fatal("under-counted h2 must fail formula gate")
|
||||
}
|
||||
ok := "<h2>A</h2><p>One</p><h2>B</h2><p>Two</p><ul><li>x</li></ul>"
|
||||
if !descriptionSatisfiesFormula(ok, effective) {
|
||||
t.Fatal("full section count must pass formula gate")
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveProductPromptTemplates_fallsBackToCompany(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user