Files
mtusi2026lab2/dto/timestamp_test.go
2026-10-06 22:45:35 +03:00

16 lines
355 B
Go

package dto
import (
"encoding/json"
"testing"
"time"
)
func TestTimestampFixedMicroseconds(t *testing.T) {
timestamp := Timestamp(time.Date(2026, 1, 2, 3, 4, 5, 123400000, time.UTC))
encoded, err := json.Marshal(timestamp)
if err != nil || string(encoded) != `"2026-01-02T03:04:05.123400Z"` {
t.Fatalf("timestamp=%s err=%v", encoded, err)
}
}