(t *testing.T)
| 259 | } |
| 260 | |
| 261 | func TestServer_HandleRequest_InvalidParams(t *testing.T) { |
| 262 | system := actor.NewSystem("test-a2a") |
| 263 | defer system.Shutdown() |
| 264 | |
| 265 | taskStore := NewInMemoryTaskStore() |
| 266 | server := NewServer(system, taskStore) |
| 267 | |
| 268 | // 无效的参数 |
| 269 | req := &JSONRPCRequest{ |
| 270 | JSONRPC: "2.0", |
| 271 | ID: "req-1", |
| 272 | Method: "message/send", |
| 273 | Params: []byte("invalid json"), |
| 274 | } |
| 275 | |
| 276 | ctx := context.Background() |
| 277 | resp := server.HandleRequest(ctx, "agent-1", req) |
| 278 | |
| 279 | require.NotNil(t, resp) |
| 280 | assert.NotNil(t, resp.Error) |
| 281 | assert.Equal(t, ErrorCodeInvalidParams, resp.Error.Code) |
| 282 | } |
| 283 | |
| 284 | func TestJSONRPCError(t *testing.T) { |
| 285 | // 测试错误响应的创建 |
nothing calls this directly
no test coverage detected