MCPcopy Create free account
hub / github.com/astercloud/aster / TestJSONRPCError

Function TestJSONRPCError

pkg/a2a/server_test.go:284–294  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

282}
283
284func TestJSONRPCError(t *testing.T) {
285 // 测试错误响应的创建
286 resp := NewErrorResponse("req-1", ErrorCodeInvalidParams, "Invalid parameters", map[string]string{"field": "message"})
287
288 assert.Equal(t, "2.0", resp.JSONRPC)
289 assert.Equal(t, "req-1", resp.ID)
290 assert.NotNil(t, resp.Error)
291 assert.Equal(t, ErrorCodeInvalidParams, resp.Error.Code)
292 assert.Equal(t, "Invalid parameters", resp.Error.Message)
293 assert.Nil(t, resp.Result)
294}
295
296func TestJSONRPCSuccess(t *testing.T) {
297 // 测试成功响应的创建

Callers

nothing calls this directly

Calls 1

NewErrorResponseFunction · 0.85

Tested by

no test coverage detected