36 lines
738 B
Go
36 lines
738 B
Go
package domain
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestPasswordHistory_TableName(t *testing.T) {
|
|
var h PasswordHistory
|
|
if got := h.TableName(); got != "password_histories" {
|
|
t.Errorf("expected table name 'password_histories', got %q", got)
|
|
}
|
|
}
|
|
|
|
func TestPasswordHistory_StructTags(t *testing.T) {
|
|
h := PasswordHistory{
|
|
ID: 1,
|
|
UserID: 2,
|
|
PasswordHash: "hash123",
|
|
CreatedAt: time.Now(),
|
|
}
|
|
|
|
if h.ID != 1 {
|
|
t.Errorf("expected ID 1, got %d", h.ID)
|
|
}
|
|
if h.UserID != 2 {
|
|
t.Errorf("expected UserID 2, got %d", h.UserID)
|
|
}
|
|
if h.PasswordHash != "hash123" {
|
|
t.Errorf("expected PasswordHash 'hash123', got %q", h.PasswordHash)
|
|
}
|
|
if h.CreatedAt.IsZero() {
|
|
t.Error("expected CreatedAt to be set")
|
|
}
|
|
}
|