Files
apocapoc-api/internal/domain/entities/user_test.go
T
david 358f844073 Remove unnecessary comments from codebase
Clean up obvious and redundant comments that don't add value:
- Remove step-by-step comments in command handlers
- Remove obvious test setup comments
- Keep only meaningful comments that explain why, not what
2025-11-27 00:48:50 +01:00

48 lines
1.0 KiB
Go

package entities
import (
"testing"
"time"
)
func TestNewUser(t *testing.T) {
email := "test@example.com"
passwordHash := "hashed_password_123"
timezone := "Europe/Madrid"
user := NewUser(email, passwordHash, timezone)
if user.Email != email {
t.Errorf("Expected email %s, got %s", email, user.Email)
}
if user.PasswordHash != passwordHash {
t.Errorf("Expected password hash %s, got %s", passwordHash, user.PasswordHash)
}
if user.Timezone != timezone {
t.Errorf("Expected timezone %s, got %s", timezone, user.Timezone)
}
if user.CreatedAt.IsZero() {
t.Error("CreatedAt should not be zero")
}
if user.UpdatedAt.IsZero() {
t.Error("UpdatedAt should not be zero")
}
diff := user.UpdatedAt.Sub(user.CreatedAt)
if diff < 0 || diff > time.Second {
t.Errorf("CreatedAt and UpdatedAt should be nearly identical, diff: %v", diff)
}
}
func TestUser_DefaultTimezone(t *testing.T) {
user := NewUser("test@example.com", "hash", "")
if user.Timezone != "UTC" {
t.Errorf("Expected default timezone UTC, got %s", user.Timezone)
}
}