(t *testing.T)
| 282 | } |
| 283 | |
| 284 | func 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 | |
| 296 | func TestJSONRPCSuccess(t *testing.T) { |
| 297 | // 测试成功响应的创建 |
nothing calls this directly
no test coverage detected