Files
rootandClaude Opus 4.7 79ac89b458 Initial commit
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-11-07 10:47:18 +08:00

26 lines
1.0 KiB
Go

package playletmod
import "testing"
func TestBuildPlayletDescription(t *testing.T) {
tests := []struct {
name string
playName string
title string
totalEpisode int64
want string
}{
{name: "剧名优先", playName: " 测试短剧 ", title: "后台标题", totalEpisode: 12, want: "黄豆短剧《测试短剧》全集在线观看,已更新至第12集,免费高清持续更新。"},
{name: "剧名为空回退标题", title: "后台标题", totalEpisode: 8, want: "黄豆短剧《后台标题》全集在线观看,已更新至第8集,免费高清持续更新。"},
{name: "集数未知", playName: "测试短剧", want: "黄豆短剧《测试短剧》全集在线观看,免费高清持续更新。"},
{name: "名称缺失", totalEpisode: 8, want: ""},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := BuildPlayletDescription(tt.playName, tt.title, tt.totalEpisode); got != tt.want {
t.Fatalf("BuildPlayletDescription() = %q, want %q", got, tt.want)
}
})
}
}