(t *testing.T)
| 332 | } |
| 333 | |
| 334 | func TestDateTimeUnmarshalJSON(t *testing.T) { |
| 335 | scenarios := []struct { |
| 336 | date string |
| 337 | expected string |
| 338 | }{ |
| 339 | {"", ""}, |
| 340 | {"invalid_json", ""}, |
| 341 | {"'123'", ""}, |
| 342 | {"2022-01-01 11:23:45.678", ""}, |
| 343 | {`"2022-01-01 11:23:45.678"`, "2022-01-01 11:23:45.678Z"}, |
| 344 | } |
| 345 | |
| 346 | for i, s := range scenarios { |
| 347 | t.Run(fmt.Sprintf("%d_%s", i, s.date), func(t *testing.T) { |
| 348 | dt := types.DateTime{} |
| 349 | dt.UnmarshalJSON([]byte(s.date)) |
| 350 | |
| 351 | if dt.String() != s.expected { |
| 352 | t.Fatalf("Expected %q, got %q", s.expected, dt.String()) |
| 353 | } |
| 354 | }) |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | func TestDateTimeValue(t *testing.T) { |
| 359 | scenarios := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…