Files
PrivateCaptcha/pkg/common/timecount_test.go
T
Taras Kushnir 0f70c38529 Add more tests
80% done by Claude Opus 4.5 w/ copilot, but not quite
2026-01-15 14:35:13 +02:00

29 lines
572 B
Go

package common
import "testing"
func TestTimePeriodString(t *testing.T) {
t.Parallel()
tests := []struct {
period TimePeriod
expected string
}{
{TimePeriodToday, "today"},
{TimePeriodWeek, "week"},
{TimePeriodMonth, "month"},
{TimePeriodYear, "year"},
{TimePeriod(100), "unknown"},
{TimePeriod(-1), "unknown"},
}
for _, tt := range tests {
t.Run(tt.expected, func(t *testing.T) {
result := tt.period.String()
if result != tt.expected {
t.Errorf("TimePeriod(%d).String() = %q, want %q", tt.period, result, tt.expected)
}
})
}
}