- 前端: 所有界面显示、i18n 文本、组件中的品牌名称 - 后端: 服务层、设置默认值、邮件模板、安装向导 - 数据库: 迁移脚本注释 - 保持功能完全一致,仅更改品牌名称 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
46 lines
893 B
Go
46 lines
893 B
Go
//go:build unit
|
|
|
|
package repository
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestVerifyCodeKey(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
email string
|
|
expected string
|
|
}{
|
|
{
|
|
name: "normal_email",
|
|
email: "user@example.com",
|
|
expected: "verify_code:user@example.com",
|
|
},
|
|
{
|
|
name: "empty_email",
|
|
email: "",
|
|
expected: "verify_code:",
|
|
},
|
|
{
|
|
name: "email_with_plus",
|
|
email: "user+tag@example.com",
|
|
expected: "verify_code:user+tag@example.com",
|
|
},
|
|
{
|
|
name: "email_with_special_chars",
|
|
email: "user.name+tag@sub.domain.com",
|
|
expected: "verify_code:user.name+tag@sub.domain.com",
|
|
},
|
|
}
|
|
|
|
for _, tc := range tests {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
got := verifyCodeKey(tc.email)
|
|
require.Equal(t, tc.expected, got)
|
|
})
|
|
}
|
|
}
|