mirror of
https://gh-proxy.org/https://github.com/klinsmaya/sub2api.git
synced 2026-11-08 22:07:19 +08:00
46 lines
848 B
Go
46 lines
848 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: "[email protected]",
|
|
expected: "verify_code:[email protected]",
|
|
},
|
|
{
|
|
name: "empty_email",
|
|
email: "",
|
|
expected: "verify_code:",
|
|
},
|
|
{
|
|
name: "email_with_plus",
|
|
email: "[email protected]",
|
|
expected: "verify_code:[email protected]",
|
|
},
|
|
{
|
|
name: "email_with_special_chars",
|
|
email: "[email protected]",
|
|
expected: "verify_code:[email protected]",
|
|
},
|
|
}
|
|
|
|
for _, tc := range tests {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
got := verifyCodeKey(tc.email)
|
|
require.Equal(t, tc.expected, got)
|
|
})
|
|
}
|
|
}
|