37 lines
686 B
Go
37 lines
686 B
Go
package models
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestTokenTypeConstants(t *testing.T) {
|
|
tests := []struct {
|
|
tokenType TokenType
|
|
expected string
|
|
}{
|
|
{TokenTypeVerifyEmail, "verify_email"},
|
|
{TokenTypeResetPassword, "reset_password"},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
if string(tt.tokenType) != tt.expected {
|
|
t.Errorf("expected TokenType %q, got %q", tt.expected, string(tt.tokenType))
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestTokenTypeValues_AreDistinct(t *testing.T) {
|
|
types := []TokenType{
|
|
TokenTypeVerifyEmail,
|
|
TokenTypeResetPassword,
|
|
}
|
|
|
|
seen := make(map[TokenType]bool)
|
|
for _, tt := range types {
|
|
if seen[tt] {
|
|
t.Errorf("duplicate TokenType value: %q", tt)
|
|
}
|
|
seen[tt] = true
|
|
}
|
|
}
|