(t *testing.T)
| 35 | } |
| 36 | |
| 37 | func TestDefaultCodeForStatus(t *testing.T) { |
| 38 | cases := map[int]string{ |
| 39 | http.StatusBadRequest: "bad_request", |
| 40 | http.StatusUnauthorized: "unauthorized", |
| 41 | http.StatusForbidden: "forbidden", |
| 42 | http.StatusNotFound: "not_found", |
| 43 | http.StatusConflict: "conflict", |
| 44 | http.StatusTooManyRequests: "rate_limited", |
| 45 | http.StatusInternalServerError: "internal_error", |
| 46 | http.StatusBadGateway: "internal_error", |
| 47 | 418: "error", |
| 48 | } |
| 49 | for status, want := range cases { |
| 50 | if got := defaultCodeForStatus(status); got != want { |
| 51 | t.Errorf("status %d: got %q want %q", status, got, want) |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | func TestHumaErrorConstructorEnvelope(t *testing.T) { |
| 57 | // The constructor installed as huma.NewError must yield our envelope so |
nothing calls this directly
no test coverage detected