MCPcopy Create free account
hub / github.com/github/gh-aw / TestMcpErrorData_Map

Function TestMcpErrorData_Map

pkg/cli/mcp_server_helpers_test.go:32–45  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30}
31
32func TestMcpErrorData_Map(t *testing.T) {
33 input := map[string]any{"error": "something went wrong", "code": 42}
34 result := mcpErrorData(input)
35 if result == nil {
36 t.Fatal("mcpErrorData(map) = nil, want non-nil")
37 }
38 var got map[string]any
39 if err := json.Unmarshal(result, &got); err != nil {
40 t.Fatalf("failed to unmarshal result: %v", err)
41 }
42 if got["error"] != "something went wrong" {
43 t.Errorf("mcpErrorData map[\"error\"] = %v, want %q", got["error"], "something went wrong")
44 }
45}
46
47func TestMcpErrorData_UnmarshalableType(t *testing.T) {
48 // channels cannot be marshaled to JSON

Callers

nothing calls this directly

Calls 2

mcpErrorDataFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected