70 lines
1.4 KiB
Go
70 lines
1.4 KiB
Go
package models
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestTicketStatusConstants(t *testing.T) {
|
|
tests := []struct {
|
|
status TicketStatus
|
|
expected string
|
|
}{
|
|
{TicketStatusOpen, "open"},
|
|
{TicketStatusInProgress, "in_progress"},
|
|
{TicketStatusClosed, "closed"},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
if string(tt.status) != tt.expected {
|
|
t.Errorf("expected TicketStatus %q, got %q", tt.expected, string(tt.status))
|
|
}
|
|
}
|
|
}
|
|
|
|
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 TestTicketStatusValues_AreDistinct(t *testing.T) {
|
|
statuses := []TicketStatus{
|
|
TicketStatusOpen,
|
|
TicketStatusInProgress,
|
|
TicketStatusClosed,
|
|
}
|
|
|
|
seen := make(map[TicketStatus]bool)
|
|
for _, s := range statuses {
|
|
if seen[s] {
|
|
t.Errorf("duplicate TicketStatus value: %q", s)
|
|
}
|
|
seen[s] = true
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|
|
}
|