(t *testing.T)
| 54 | } |
| 55 | |
| 56 | func TestHumaErrorConstructorEnvelope(t *testing.T) { |
| 57 | // The constructor installed as huma.NewError must yield our envelope so |
| 58 | // Huma's built-in validation errors render in the same shape. |
| 59 | se := humaErrorConstructor(http.StatusUnprocessableEntity, "validation failed") |
| 60 | env, ok := se.(*ErrorEnvelope) |
| 61 | if !ok { |
| 62 | t.Fatalf("expected *ErrorEnvelope, got %T", se) |
| 63 | } |
| 64 | if env.GetStatus() != http.StatusUnprocessableEntity { |
| 65 | t.Fatalf("status: %d", env.GetStatus()) |
| 66 | } |
| 67 | if env.Code() != "unprocessable_entity" { |
| 68 | t.Fatalf("code: %q", env.Code()) |
| 69 | } |
| 70 | } |
nothing calls this directly
no test coverage detected