(t *testing.T)
| 304 | } |
| 305 | |
| 306 | func TestDateTimeMarshalJSON(t *testing.T) { |
| 307 | scenarios := []struct { |
| 308 | date string |
| 309 | expected string |
| 310 | }{ |
| 311 | {"", `""`}, |
| 312 | {"2022-01-01 11:23:45.678", `"2022-01-01 11:23:45.678Z"`}, |
| 313 | } |
| 314 | |
| 315 | for i, s := range scenarios { |
| 316 | t.Run(fmt.Sprintf("%d_%s", i, s.date), func(t *testing.T) { |
| 317 | dt, err := types.ParseDateTime(s.date) |
| 318 | if err != nil { |
| 319 | t.Fatal(err) |
| 320 | } |
| 321 | |
| 322 | result, err := dt.MarshalJSON() |
| 323 | if err != nil { |
| 324 | t.Fatal(err) |
| 325 | } |
| 326 | |
| 327 | if string(result) != s.expected { |
| 328 | t.Fatalf("Expected %q, got %q", s.expected, string(result)) |
| 329 | } |
| 330 | }) |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | func TestDateTimeUnmarshalJSON(t *testing.T) { |
| 335 | scenarios := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…