34 lines
994 B
Go
34 lines
994 B
Go
package outreach
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
personadomain "haixun-backend/internal/model/persona/domain/usecase"
|
|
)
|
|
|
|
func TestFormatVoicePersonaBlockUsesPersonaAndGoals(t *testing.T) {
|
|
block := FormatVoicePersonaBlock(&personadomain.PersonaSummary{
|
|
DisplayName: "小安",
|
|
Persona: "溫柔媽媽,說話慢一點、會先共情",
|
|
Goals: "讓對方覺得被理解,再輕鬆分享經驗",
|
|
})
|
|
if !strings.Contains(block, "溫柔媽媽") {
|
|
t.Fatalf("expected persona text, got %q", block)
|
|
}
|
|
if !strings.Contains(block, "小安") {
|
|
t.Fatalf("expected display name, got %q", block)
|
|
}
|
|
if !strings.Contains(block, "讓對方覺得被理解") {
|
|
t.Fatalf("expected goals, got %q", block)
|
|
}
|
|
}
|
|
|
|
func TestFormatVoicePersonaBlockEmpty(t *testing.T) {
|
|
if FormatVoicePersonaBlock(nil) != "" {
|
|
t.Fatal("expected empty block for nil persona")
|
|
}
|
|
if FormatVoicePersonaBlock(&personadomain.PersonaSummary{}) != "" {
|
|
t.Fatal("expected empty block for blank persona")
|
|
}
|
|
} |