(t *testing.T)
| 3452 | } |
| 3453 | |
| 3454 | func TestCompareHttpResponse(t *testing.T) { |
| 3455 | t.Parallel() |
| 3456 | testcases := map[string]struct { |
| 3457 | h1 *http.Response |
| 3458 | h2 *http.Response |
| 3459 | expected bool |
| 3460 | }{ |
| 3461 | "both are nil": { |
| 3462 | expected: true, |
| 3463 | }, |
| 3464 | "both are non nil - same StatusCode": { |
| 3465 | expected: true, |
| 3466 | h1: &http.Response{StatusCode: 200}, |
| 3467 | h2: &http.Response{StatusCode: 200}, |
| 3468 | }, |
| 3469 | "both are non nil - different StatusCode": { |
| 3470 | expected: false, |
| 3471 | h1: &http.Response{StatusCode: 200}, |
| 3472 | h2: &http.Response{StatusCode: 404}, |
| 3473 | }, |
| 3474 | "one is nil, other is not": { |
| 3475 | expected: false, |
| 3476 | h2: &http.Response{}, |
| 3477 | }, |
| 3478 | } |
| 3479 | |
| 3480 | for name, tc := range testcases { |
| 3481 | t.Run(name, func(t *testing.T) { |
| 3482 | t.Parallel() |
| 3483 | v := compareHTTPResponse(tc.h1, tc.h2) |
| 3484 | if tc.expected != v { |
| 3485 | t.Errorf("Expected %t, got %t for (%#v, %#v)", tc.expected, v, tc.h1, tc.h2) |
| 3486 | } |
| 3487 | }) |
| 3488 | } |
| 3489 | } |
| 3490 | |
| 3491 | func TestErrorResponse_Is(t *testing.T) { |
| 3492 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…