(t *testing.T, body []byte, expectedCode string)
| 893 | } |
| 894 | |
| 895 | func assertStructuredError(t *testing.T, body []byte, expectedCode string) { |
| 896 | t.Helper() |
| 897 | var parsed map[string]any |
| 898 | if err := json.Unmarshal(body, &parsed); err != nil { |
| 899 | t.Fatalf("response must be valid json: %v", err) |
| 900 | } |
| 901 | |
| 902 | if parsed["status"] != "error" { |
| 903 | t.Fatalf("expected status=error, got %v", parsed["status"]) |
| 904 | } |
| 905 | errorObj, ok := parsed["error"].(map[string]any) |
| 906 | if !ok { |
| 907 | t.Fatalf("expected error object in response") |
| 908 | } |
| 909 | if errorObj["code"] != expectedCode { |
| 910 | t.Fatalf("expected error.code=%s, got %v", expectedCode, errorObj["code"]) |
| 911 | } |
| 912 | } |
| 913 | |
| 914 | type blockingInferAdapter struct { |
| 915 | once sync.Once |
no outgoing calls
no test coverage detected