spark-server/internal/module/user/entity/bot_test.go
DESKTOP-L8OUL9F\gfl0034 ce2cdf6bf3 feat: music 运营曲目、seed 机器人欢迎消息,并补充 novels/music OpenAPI
合并 origin/main 设备注册后,纳入本地 music 模块、seed 命令与 popadmin 相关路由/文档;music migration 编号为 0020 以避免与 0019_devices 冲突。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-23 16:07:05 +08:00

25 lines
638 B
Go

package entity
import "testing"
func TestBotEmailAndSparkID(t *testing.T) {
if BotEmail(0) != "" || BotEmail(101) != "" {
t.Fatal("out of range")
}
if got := BotEmail(1); got != "bot001@spark.bot" {
t.Fatalf("email %s", got)
}
if got := BotEmail(100); got != "bot100@spark.bot" {
t.Fatalf("email %s", got)
}
if !IsBotEmail("bot001@spark.bot") || !IsBotEmail("BOT050@SPARK.BOT") {
t.Fatal("IsBotEmail true")
}
if IsBotEmail("test01@spark.com") || IsBotEmail("bot101@spark.bot") {
t.Fatal("IsBotEmail false")
}
if sid := BotSparkID(7); sid != "sparkbot007" || !ValidSparkID(sid) {
t.Fatalf("spark_id %s", sid)
}
}