MCPcopy Create free account
hub / github.com/InferCore/InferCore / assertStructuredError

Function assertStructuredError

internal/server/server_test.go:895–912  ·  view source on GitHub ↗
(t *testing.T, body []byte, expectedCode string)

Source from the content-addressed store, hash-verified

893}
894
895func 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
914type blockingInferAdapter struct {
915 once sync.Once

Calls

no outgoing calls

Tested by

no test coverage detected