Files
sub2api/backend/internal/repository/email_cache_test.go
T

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)
})
}
}