Files
JuYou/API/internal/worker/script_analysis_prompt_test.go
T
2026-08-25 17:59:42 +08:00

20 lines
660 B
Go

package worker
import (
"strings"
"testing"
)
func TestScriptAnalysisSystemPromptKeepsGoalAndFixedSchema(t *testing.T) {
prompt := scriptAnalysisSystemPrompt("你是一名分析师。\n\n分析目标:\n分析拍摄预算")
if !strings.Contains(prompt, "分析目标:\n分析拍摄预算") {
t.Fatal("prompt does not contain the analysis goal")
}
if strings.Count(prompt, "你是一名分析师") != 1 {
t.Fatal("prompt unexpectedly duplicates the database prompt")
}
if !strings.Contains(prompt, `"custom_analysis"`) || !strings.Contains(prompt, `"unmatched_objectives"`) {
t.Fatal("prompt does not contain the fixed fallback schema")
}
}