thread-master/backend/internal/library/clock/clock_test.go

25 lines
482 B
Go

package clock
import (
"testing"
"time"
)
func TestNow_IsUTC(t *testing.T) {
now := Now()
if now.Location() != time.UTC {
t.Fatalf("location = %v, want UTC", now.Location())
}
}
func TestFromUnixNano_RoundTrip(t *testing.T) {
nano := NowUnixNano()
parsed := FromUnixNano(nano)
if parsed.UnixNano() != nano {
t.Fatalf("parsed = %d, want %d", parsed.UnixNano(), nano)
}
if parsed.Location() != time.UTC {
t.Fatalf("location = %v, want UTC", parsed.Location())
}
}