(t *testing.T)
| 85 | } |
| 86 | |
| 87 | func TestConvertResult(t *testing.T) { |
| 88 | t.Parallel() |
| 89 | |
| 90 | tests := []struct { |
| 91 | name string |
| 92 | // input is a pointer so we can test nil. |
| 93 | input *mcp.CallToolResult |
| 94 | want workspacesdk.CallMCPToolResponse |
| 95 | }{ |
| 96 | { |
| 97 | name: "NilInput", |
| 98 | input: nil, |
| 99 | want: workspacesdk.CallMCPToolResponse{}, |
| 100 | }, |
| 101 | { |
| 102 | name: "TextContent", |
| 103 | input: &mcp.CallToolResult{ |
| 104 | Content: []mcp.Content{ |
| 105 | mcp.TextContent{Type: "text", Text: "hello"}, |
| 106 | }, |
| 107 | }, |
| 108 | want: workspacesdk.CallMCPToolResponse{ |
| 109 | Content: []workspacesdk.MCPToolContent{ |
| 110 | {Type: "text", Text: "hello"}, |
| 111 | }, |
| 112 | }, |
| 113 | }, |
| 114 | { |
| 115 | name: "ImageContent", |
| 116 | input: &mcp.CallToolResult{ |
| 117 | Content: []mcp.Content{ |
| 118 | mcp.ImageContent{ |
| 119 | Type: "image", |
| 120 | Data: "base64data", |
| 121 | MIMEType: "image/png", |
| 122 | }, |
| 123 | }, |
| 124 | }, |
| 125 | want: workspacesdk.CallMCPToolResponse{ |
| 126 | Content: []workspacesdk.MCPToolContent{ |
| 127 | {Type: "image", Data: "base64data", MediaType: "image/png"}, |
| 128 | }, |
| 129 | }, |
| 130 | }, |
| 131 | { |
| 132 | name: "AudioContent", |
| 133 | input: &mcp.CallToolResult{ |
| 134 | Content: []mcp.Content{ |
| 135 | mcp.AudioContent{ |
| 136 | Type: "audio", |
| 137 | Data: "base64audio", |
| 138 | MIMEType: "audio/mp3", |
| 139 | }, |
| 140 | }, |
| 141 | }, |
| 142 | want: workspacesdk.CallMCPToolResponse{ |
| 143 | Content: []workspacesdk.MCPToolContent{ |
| 144 | {Type: "audio", Data: "base64audio", MediaType: "audio/mp3"}, |
nothing calls this directly
no test coverage detected