(t *testing.T)
| 254 | } |
| 255 | |
| 256 | func TestDateTimeUnix(t *testing.T) { |
| 257 | scenarios := []struct { |
| 258 | date string |
| 259 | expected int64 |
| 260 | }{ |
| 261 | {"", -62135596800}, |
| 262 | {"2022-01-01 11:23:45.678Z", 1641036225}, |
| 263 | } |
| 264 | |
| 265 | for i, s := range scenarios { |
| 266 | t.Run(fmt.Sprintf("%d_%s", i, s.date), func(t *testing.T) { |
| 267 | dt, err := types.ParseDateTime(s.date) |
| 268 | if err != nil { |
| 269 | t.Fatal(err) |
| 270 | } |
| 271 | |
| 272 | v := dt.Unix() |
| 273 | |
| 274 | if v != s.expected { |
| 275 | t.Fatalf("Expected %d, got %d", s.expected, v) |
| 276 | } |
| 277 | }) |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | func TestDateTimeIsZero(t *testing.T) { |
| 282 | dt0 := types.DateTime{} |
nothing calls this directly
no test coverage detected
searching dependent graphs…