(t *testing.T, actualBody, expectedBody []byte)
| 451 | |
| 452 | compareJSONBodies(t, got, []byte(tc.expected)) |
| 453 | }) |
| 454 | } |
| 455 | } |
| 456 | |
| 457 | func compareJSONBodies(t *testing.T, actualBody, expectedBody []byte) { |
| 458 | t.Helper() |
| 459 | var actualObj, expectedObj any |
| 460 | err := json.Unmarshal(actualBody, &actualObj) |
| 461 | if err != nil { |
| 462 | t.Fatal("failed to parse json from actual response") |
| 463 | } |
| 464 | err = json.Unmarshal(expectedBody, &expectedObj) |
| 465 | if err != nil { |
| 466 | t.Fatal("failed to parse json from expected response") |
| 467 | } |
| 468 | |
| 469 | if diff := cmp.Diff(expectedObj, actualObj); diff != "" { |
| 470 | t.Errorf("JSON mismatch (-want +got):\n%s", diff) |
| 471 | } |
no outgoing calls
no test coverage detected