落地 synastry/star/ask API 与 H5 页面,补齐 cece-frontend-re complete-design 证据文档,并加入 Android 模拟器截图抓取脚本。 Co-authored-by: Cursor <cursoragent@cursor.com>
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
package ask
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestBuildReply_profileAware(t *testing.T) {
|
|
birth := time.Date(1990, 5, 12, 0, 0, 0, 0, time.UTC)
|
|
out := BuildReply(ReplyInput{
|
|
DisplayName: "我",
|
|
BirthDate: birth,
|
|
Relation: "self",
|
|
Scene: "self",
|
|
UserMessage: "我想更了解自己",
|
|
})
|
|
if !strings.Contains(out, "我") {
|
|
t.Fatalf("expected name in reply: %s", out)
|
|
}
|
|
if strings.Contains(out, "算命") || strings.Contains(out, "运势") || strings.Contains(out, "吉凶") {
|
|
t.Fatalf("forbidden lexicon in reply: %s", out)
|
|
}
|
|
if !strings.Contains(out, "不构成") {
|
|
t.Fatalf("expected disclaimer: %s", out)
|
|
}
|
|
}
|
|
|
|
func TestBuildReply_relationFocus(t *testing.T) {
|
|
birth := time.Date(1992, 8, 1, 0, 0, 0, 0, time.UTC)
|
|
out := BuildReply(ReplyInput{
|
|
DisplayName: "TA",
|
|
BirthDate: birth,
|
|
Relation: "other",
|
|
UserMessage: "和伴侣沟通总是卡住怎么办",
|
|
})
|
|
if !strings.Contains(out, "关系") && !strings.Contains(out, "相处") && !strings.Contains(out, "复述") {
|
|
t.Fatalf("expected relation-oriented reply: %s", out)
|
|
}
|
|
}
|